提交 3e126969 编写于 作者: J Jared Parsons

Removed support for a config file in BuildBoss

上级 c104c68d
{
"targets": [
"Roslyn.sln",
"src\\Samples\\Samples.sln"
]
}
......@@ -22,7 +22,6 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="BuildBossConfig.cs" />
<Compile Include="Program.cs" />
<Compile Include="ProjectData.cs" />
<Compile Include="ProjectUtil.cs" />
......
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BuildBoss
{
public sealed class BuildBossConfig
{
/// <summary>
/// The solutions targetted by this scan
/// </summary>
[JsonProperty(PropertyName = "targets")]
public string[] Targets { get; set; }
}
}
......@@ -11,28 +11,14 @@ namespace BuildBoss
{
internal static class Program
{
internal static int Main(string[] args)
internal static int Main(string[] solutionFilePaths)
{
string configFile;
string basePath;
List<string> solutionFilePaths;
if (!ParseCommandLine(args, out configFile, out basePath, out solutionFilePaths))
if (solutionFilePaths.Length == 0)
{
Usage();
return 1;
}
if (configFile != null)
{
var config = JsonConvert.DeserializeObject<BuildBossConfig>(File.ReadAllText(configFile));
foreach (var target in config.Targets)
{
solutionFilePaths.Add(Path.IsPathRooted(target)
? target
: Path.Combine(basePath, target));
}
}
var allGood = true;
foreach (var solutionFilePath in solutionFilePaths)
{
......@@ -86,51 +72,9 @@ private static bool ProcessProject(string solutionPath, ProjectData projectData,
return true;
}
private static bool ParseCommandLine(string[] args, out string configFile, out string basePath, out List<string> solutionFilePaths)
{
configFile = null;
basePath = AppContext.BaseDirectory;
solutionFilePaths = new List<string>();
var i = 0;
while (i < args.Length)
{
var current = args[i];
switch (current.ToLower())
{
case "-config":
if (i + 1 >= args.Length)
{
Console.WriteLine("config requires an argument");
return false;
}
configFile = args[i + 1];
i += 2;
break;
case "-basepath":
if (i + 1 >= args.Length)
{
Console.WriteLine("basePath requise and argument");
return false;
}
basePath = args[i + 1];
i += 2;
break;
default:
solutionFilePaths.Add(current);
i++;
break;
}
}
return true;
}
private static void Usage()
{
Console.WriteLine($"BuildBoss [-config <config file path] [-basePath <base path>] <solution paths>");
Console.WriteLine($"BuildBoss <solution paths>");
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册