mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Modify build script naming convention
This commit is contained in:
parent
2cf84b332f
commit
22416f66bf
1 changed files with 29 additions and 29 deletions
|
@ -26,14 +26,14 @@ 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";
|
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;
|
readonly bool _doCoreBuildOnly;
|
||||||
|
|
||||||
[Solution("LibHac.sln")] readonly Solution Solution;
|
[Solution("LibHac.sln")] readonly Solution _solution;
|
||||||
[GitRepository] readonly GitRepository GitRepository;
|
[GitRepository] readonly GitRepository _gitRepository;
|
||||||
[GitVersion] readonly GitVersion GitVersion;
|
[GitVersion] readonly GitVersion _gitVersion;
|
||||||
|
|
||||||
AbsolutePath SourceDirectory => RootDirectory / "src";
|
AbsolutePath SourceDirectory => RootDirectory / "src";
|
||||||
AbsolutePath TestsDirectory => RootDirectory / "tests";
|
AbsolutePath TestsDirectory => RootDirectory / "tests";
|
||||||
|
@ -47,9 +47,9 @@ namespace LibHacBuild
|
||||||
|
|
||||||
AbsolutePath CliMergedExe => ArtifactsDirectory / "hactoolnet.exe";
|
AbsolutePath CliMergedExe => ArtifactsDirectory / "hactoolnet.exe";
|
||||||
|
|
||||||
Project LibHacProject => Solution.GetProject("LibHac").NotNull();
|
Project LibHacProject => _solution.GetProject("LibHac").NotNull();
|
||||||
Project LibHacTestProject => Solution.GetProject("LibHac.Tests").NotNull();
|
Project LibHacTestProject => _solution.GetProject("LibHac.Tests").NotNull();
|
||||||
Project HactoolnetProject => Solution.GetProject("hactoolnet").NotNull();
|
Project HactoolnetProject => _solution.GetProject("hactoolnet").NotNull();
|
||||||
|
|
||||||
string AppVeyorVersion { get; set; }
|
string AppVeyorVersion { get; set; }
|
||||||
Dictionary<string, object> VersionProps { get; set; } = new Dictionary<string, object>();
|
Dictionary<string, object> VersionProps { get; set; } = new Dictionary<string, object>();
|
||||||
|
@ -57,30 +57,30 @@ namespace LibHacBuild
|
||||||
const string CertFileName = "cert.pfx";
|
const string CertFileName = "cert.pfx";
|
||||||
|
|
||||||
Target SetVersion => _ => _
|
Target SetVersion => _ => _
|
||||||
.OnlyWhenStatic(() => GitRepository != null)
|
.OnlyWhenStatic(() => _gitRepository != null)
|
||||||
.Executes(() =>
|
.Executes(() =>
|
||||||
{
|
{
|
||||||
AppVeyorVersion = $"{GitVersion.AssemblySemVer}";
|
AppVeyorVersion = $"{_gitVersion.AssemblySemVer}";
|
||||||
if (!string.IsNullOrWhiteSpace(GitVersion.PreReleaseTag))
|
if (!string.IsNullOrWhiteSpace(_gitVersion.PreReleaseTag))
|
||||||
{
|
{
|
||||||
AppVeyorVersion += $"-{GitVersion.PreReleaseTag}+{GitVersion.Sha.Substring(0, 8)}";
|
AppVeyorVersion += $"-{_gitVersion.PreReleaseTag}+{_gitVersion.Sha.Substring(0, 8)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
string suffix = GitVersion.PreReleaseTag;
|
string suffix = _gitVersion.PreReleaseTag;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(suffix))
|
if (!string.IsNullOrWhiteSpace(suffix))
|
||||||
{
|
{
|
||||||
if (!GitRepository.IsOnMasterBranch())
|
if (!_gitRepository.IsOnMasterBranch())
|
||||||
{
|
{
|
||||||
suffix = $"-{suffix}";
|
suffix = $"-{suffix}";
|
||||||
}
|
}
|
||||||
|
|
||||||
suffix += $"+{GitVersion.Sha.Substring(0, 8)}";
|
suffix += $"+{_gitVersion.Sha.Substring(0, 8)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
VersionProps = new Dictionary<string, object>
|
VersionProps = new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
["VersionPrefix"] = GitVersion.AssemblySemVer,
|
["VersionPrefix"] = _gitVersion.AssemblySemVer,
|
||||||
["VersionSuffix"] = suffix
|
["VersionSuffix"] = suffix
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ namespace LibHacBuild
|
||||||
.Executes(() =>
|
.Executes(() =>
|
||||||
{
|
{
|
||||||
DotNetRestoreSettings settings = new DotNetRestoreSettings()
|
DotNetRestoreSettings settings = new DotNetRestoreSettings()
|
||||||
.SetProjectFile(Solution);
|
.SetProjectFile(_solution);
|
||||||
|
|
||||||
DotNetRestore(s => settings);
|
DotNetRestore(s => settings);
|
||||||
});
|
});
|
||||||
|
@ -117,19 +117,19 @@ namespace LibHacBuild
|
||||||
.Executes(() =>
|
.Executes(() =>
|
||||||
{
|
{
|
||||||
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)
|
||||||
|
@ -137,7 +137,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)
|
||||||
|
@ -163,13 +163,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);
|
||||||
|
@ -189,7 +189,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");
|
||||||
|
@ -223,9 +223,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);
|
||||||
});
|
});
|
||||||
|
@ -242,7 +242,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}");
|
||||||
|
@ -299,7 +299,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(() =>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue