Fix build parameter variables

This commit is contained in:
Alex Barney 2019-05-30 21:00:22 -05:00
parent 5a4b56efad
commit a7391afa9c

View file

@ -27,10 +27,10 @@ namespace LibHacBuild
public static int Main() => Execute<Build>(x => x.Results); public static int Main() => Execute<Build>(x => x.Results);
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] [Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly string _configuration = IsLocalBuild ? "Debug" : "Release"; public readonly string Configuration = IsLocalBuild ? "Debug" : "Release";
[Parameter("Build only .NET Core targets if true. Default is false on Windows")] [Parameter("Build only .NET Core targets if true. Default is false on Windows")]
readonly bool _doCoreBuildOnly; public readonly bool DoCoreBuildOnly;
[Solution("LibHac.sln")] readonly Solution _solution; [Solution("LibHac.sln")] readonly Solution _solution;
[GitRepository] readonly GitRepository _gitRepository; [GitRepository] readonly GitRepository _gitRepository;
@ -126,17 +126,17 @@ namespace LibHacBuild
DotNetBuildSettings buildSettings = new DotNetBuildSettings() DotNetBuildSettings buildSettings = new DotNetBuildSettings()
.SetProjectFile(_solution) .SetProjectFile(_solution)
.EnableNoRestore() .EnableNoRestore()
.SetConfiguration(_configuration) .SetConfiguration(Configuration)
.SetProperties(VersionProps) .SetProperties(VersionProps)
.SetProperty("BuildType", "Release"); .SetProperty("BuildType", "Release");
if (_doCoreBuildOnly) buildSettings = buildSettings.SetFramework("netcoreapp2.1"); if (DoCoreBuildOnly) buildSettings = buildSettings.SetFramework("netcoreapp2.1");
DotNetBuild(s => buildSettings); DotNetBuild(s => buildSettings);
DotNetPublishSettings publishSettings = new DotNetPublishSettings() DotNetPublishSettings publishSettings = new DotNetPublishSettings()
.EnableNoRestore() .EnableNoRestore()
.SetConfiguration(_configuration); .SetConfiguration(Configuration);
DotNetPublish(s => publishSettings DotNetPublish(s => publishSettings
.SetProject(HactoolnetProject) .SetProject(HactoolnetProject)
@ -144,7 +144,7 @@ namespace LibHacBuild
.SetOutput(CliCoreDir) .SetOutput(CliCoreDir)
.SetProperties(VersionProps)); .SetProperties(VersionProps));
if (!_doCoreBuildOnly) if (!DoCoreBuildOnly)
{ {
DotNetPublish(s => publishSettings DotNetPublish(s => publishSettings
.SetProject(HactoolnetProject) .SetProject(HactoolnetProject)
@ -170,13 +170,13 @@ namespace LibHacBuild
DotNetPackSettings settings = new DotNetPackSettings() DotNetPackSettings settings = new DotNetPackSettings()
.SetProject(LibHacProject) .SetProject(LibHacProject)
.EnableNoBuild() .EnableNoBuild()
.SetConfiguration(_configuration) .SetConfiguration(Configuration)
.EnableIncludeSymbols() .EnableIncludeSymbols()
.SetSymbolPackageFormat(DotNetSymbolPackageFormat.snupkg) .SetSymbolPackageFormat(DotNetSymbolPackageFormat.snupkg)
.SetOutputDirectory(ArtifactsDirectory) .SetOutputDirectory(ArtifactsDirectory)
.SetProperties(VersionProps); .SetProperties(VersionProps);
if (_doCoreBuildOnly) if (DoCoreBuildOnly)
settings = settings.SetProperty("TargetFrameworks", "netcoreapp2.1"); settings = settings.SetProperty("TargetFrameworks", "netcoreapp2.1");
DotNetPack(s => settings); DotNetPack(s => settings);
@ -196,7 +196,7 @@ namespace LibHacBuild
Target Merge => _ => _ Target Merge => _ => _
.DependsOn(Compile) .DependsOn(Compile)
.OnlyWhenStatic(() => !_doCoreBuildOnly) .OnlyWhenStatic(() => !DoCoreBuildOnly)
.Executes(() => .Executes(() =>
{ {
string[] libraries = Directory.GetFiles(CliFrameworkDir, "*.dll"); string[] libraries = Directory.GetFiles(CliFrameworkDir, "*.dll");
@ -230,9 +230,9 @@ namespace LibHacBuild
DotNetTestSettings settings = new DotNetTestSettings() DotNetTestSettings settings = new DotNetTestSettings()
.SetProjectFile(LibHacTestProject) .SetProjectFile(LibHacTestProject)
.EnableNoBuild() .EnableNoBuild()
.SetConfiguration(_configuration); .SetConfiguration(Configuration);
if (_doCoreBuildOnly) settings = settings.SetFramework("netcoreapp2.1"); if (DoCoreBuildOnly) settings = settings.SetFramework("netcoreapp2.1");
DotNetTest(s => settings); DotNetTest(s => settings);
}); });
@ -249,7 +249,7 @@ namespace LibHacBuild
.Concat(Directory.EnumerateFiles(CliCoreDir, "*.dll")) .Concat(Directory.EnumerateFiles(CliCoreDir, "*.dll"))
.ToArray(); .ToArray();
if (!_doCoreBuildOnly) if (!DoCoreBuildOnly)
{ {
ZipFiles(CliFrameworkZip, namesFx); ZipFiles(CliFrameworkZip, namesFx);
Console.WriteLine($"Created {CliFrameworkZip}"); Console.WriteLine($"Created {CliFrameworkZip}");
@ -306,7 +306,7 @@ namespace LibHacBuild
Target Sign => _ => _ Target Sign => _ => _
.DependsOn(Test, Zip, Merge) .DependsOn(Test, Zip, Merge)
.OnlyWhenStatic(() => !_doCoreBuildOnly) .OnlyWhenStatic(() => !DoCoreBuildOnly)
.OnlyWhenStatic(() => File.Exists(CertFileName)) .OnlyWhenStatic(() => File.Exists(CertFileName))
.Executes(() => .Executes(() =>
{ {