提交 995ff71f 编写于 作者: A Andy Gocke

Merge pull request #5939 from agocke/AddOutputDirToBuildNuGetsCsx

Add outdir parameter to BuildNuGets.csx
......@@ -2,18 +2,27 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
string usage = @"usage: BuildNuGets.csx <binaries-dir> <build-version>";
string usage = @"usage: BuildNuGets.csx <binaries-dir> <build-version> <output-directory>";
if (Args.Length != 2)
if (Args.Count() != 3)
{
Console.WriteLine(usage);
Environment.Exit(1);
}
var binDir = Path.GetFullPath(Args[0]);
var csiRoot = AppDomain.CurrentDomain.BaseDirectory;
var slnRoot = Path.GetFullPath(Path.Combine(csiRoot, "../../"));
// Strip trailing '\' characters because if the path is later passed on the
// command line when surrounded by quotes (in case the path has spaces) some
// utilities will consider the '\"' as an escape sequence for the end quote
var binDir = Path.GetFullPath(Args[0]).TrimEnd('\\');
var buildVersion = Args[1].Trim();
var nuspecDirPath = Path.GetFullPath("../../src/NuGet");
var nuspecDirPath = Path.GetFullPath(Path.Combine(slnRoot, "src/NuGet"));
var outDir = Path.GetFullPath(Args[2]).TrimEnd('\\');
var licenseUrl = @"http://go.microsoft.com/fwlink/?LinkId=529443";
var authors = @"Microsoft";
......@@ -21,23 +30,35 @@ var projectURL = @"http://msdn.com/roslyn";
var tags = @"Roslyn CodeAnalysis Compiler CSharp VB VisualBasic Parser Scanner Lexer Emit CodeGeneration Metadata IL Compilation Scripting Syntax Semantics";
var files = Directory.GetFiles(nuspecDirPath, "*.nuspec");
var procs = new List<Process>(files.Length);
int exit = 0;
foreach (var file in files)
{
var nugetArgs = $@"pack {file} " +
$@"-BasePath ""{binDir}"" " +
$@"-OutputDirectory ""{outDir}"" " +
"-ExcludeEmptyDirectories " +
$@"-prop licenseUrl=""{licenseUrl}"" " +
$@"-prop version=""{buildVersion}"" " +
$"-prop authors={authors} " +
$@"-prop projectURL=""{projectURL}"" " +
$@"-prop tags=""{tags}""";
Console.WriteLine(nugetArgs);
var p = Process.Start(Path.GetFullPath("../../nuget.exe"), nugetArgs);
}
var nugetExePath = Path.GetFullPath(Path.Combine(slnRoot, "nuget.exe"));
var p = new Process();
p.StartInfo.FileName = nugetExePath;
p.StartInfo.Arguments = nugetArgs;
p.StartInfo.UseShellExecute = false;
foreach (var p in procs)
{
Console.WriteLine($"Running: nuget.exe {nugetArgs}");
p.Start();
p.WaitForExit();
exit = p.ExitCode;
if (exit != 0)
{
break;
}
}
Environment.Exit(exit);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册