Move PullNupkgFilesFromBlob into FinalizeBuild.

Also, update dotnet/versions for the DotNetHost and NetCore.App packages.

Fix #3031
This commit is contained in:
Eric Erhardt 2016-05-19 19:07:33 -05:00
parent 54ab5b8385
commit 78e34c6eb7
6 changed files with 87 additions and 137 deletions

View file

@ -0,0 +1,32 @@
using System.IO;
using System.Reflection;
using Microsoft.DotNet.Cli.Build.Framework;
using NugetProgram = NuGet.CommandLine.XPlat.Program;
namespace Microsoft.DotNet.Cli.Build
{
public static class NuGetUtil
{
public static void PushPackages(string packagesPath, string destinationUrl, string apiKey)
{
int result = RunNuGetCommand(
"push",
"-s", destinationUrl,
"-k", apiKey,
Path.Combine(packagesPath, "*.nupkg"));
if (result != 0)
{
throw new BuildFailureException($"NuGet Push failed with exit code '{result}'.");
}
}
private static int RunNuGetCommand(params string[] nugetArgs)
{
var nugetAssembly = typeof(NugetProgram).GetTypeInfo().Assembly;
var mainMethod = nugetAssembly.EntryPoint;
return (int)mainMethod.Invoke(null, new object[] { nugetArgs });
}
}
}