Implemented nuget package restore

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 9 years ago
parent bc63ac1ef1
commit ac71515e3c
  1. 6
      BuildServer/lib/tasks/dotnetbuild.js
  2. 18
      BuildServer/lib/tasks/dotnetnugetrestore.js
  3. 1
      DotNetBuilder/MicroBuildServer.DotNetBuilder.csproj
  4. 9
      DotNetBuilder/NuGetRestoreRequest.cs
  5. 24
      DotNetBuilder/NuGetter.cs
  6. 2
      DotNetBuilder/Program.cs

@ -14,6 +14,12 @@ module.exports = function (params, processor) {
skipCodeSigning: params.skipCodeSigning skipCodeSigning: params.skipCodeSigning
} }
}, },
{
type: "dotnetnugetrestore",
params: {
solution: params.solution
}
},
{ {
type: "dotnetbuilderwrapper", type: "dotnetbuilderwrapper",
params: { params: {

@ -0,0 +1,18 @@
"use strict";
var sequential = require('./sequential');
module.exports = function (params, processor) {
return sequential({
tasks: [
{
type: "dotnetbuilderwrapper",
params: {
command: "nugetrestore",
BaseDirectory: processor.context.exported,
SolutionPath: processor.context.exported + "/" + params.solution
}
}
]
}, processor);
};

@ -83,6 +83,7 @@
<Compile Include="CompileRequest.cs" /> <Compile Include="CompileRequest.cs" />
<Compile Include="NuGetPackRequest.cs" /> <Compile Include="NuGetPackRequest.cs" />
<Compile Include="NuGetPushRequest.cs" /> <Compile Include="NuGetPushRequest.cs" />
<Compile Include="NuGetRestoreRequest.cs" />
<Compile Include="NuGetter.cs" /> <Compile Include="NuGetter.cs" />
<Compile Include="PathTools.cs" /> <Compile Include="PathTools.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />

@ -0,0 +1,9 @@
namespace MicroBuildServer.DotNetBuilder
{
class NuGetRestoreRequest
{
public string BaseDirectory { get; set; }
public string SolutionPath { get; set; }
}
}

@ -213,5 +213,29 @@ namespace MicroBuildServer.DotNetBuilder
return new Response {Messages = console.Messages.ToArray()}; return new Response {Messages = console.Messages.ToArray()};
} }
public static Response Restore(NuGetRestoreRequest request)
{
var console = new Console();
PackageBuilder builder = new PackageBuilder();
var command = new RestoreCommand
{
SolutionDirectory = PathTools.OptimizePath(request.BaseDirectory),
Console = console,
Verbosity = Verbosity.Detailed,
};
command.Arguments.Add(request.SolutionPath);
try
{
command.Execute();
}
catch (Exception e)
{
console.WriteError(e);
}
return new Response { Messages = console.Messages.ToArray() };
}
} }
} }

@ -22,6 +22,8 @@ namespace MicroBuildServer.DotNetBuilder
return NuGetter.Pack(JsonConvert.DeserializeObject<NuGetPackRequest>(input)); return NuGetter.Pack(JsonConvert.DeserializeObject<NuGetPackRequest>(input));
case "nugetpush": case "nugetpush":
return NuGetter.Push(JsonConvert.DeserializeObject<NuGetPushRequest>(input)); return NuGetter.Push(JsonConvert.DeserializeObject<NuGetPushRequest>(input));
case "nugetrestore":
return NuGetter.Restore(JsonConvert.DeserializeObject<NuGetRestoreRequest>(input));
default: default:
throw new ApplicationException("Unsupported type '" + args[0] + "'"); throw new ApplicationException("Unsupported type '" + args[0] + "'");
} }

Loading…
Cancel
Save