From 9d813ade18c0f7187bf80f3a47d8f62a24e475a5 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Fri, 9 Aug 2019 20:29:06 -0500 Subject: [PATCH] Use .NET Framework reference assemblies from NuGet (#77) * Use .NET Framework reference assemblies from NuGet * Update build packages. Specify --no-build when publishing * Don't sign on Linux --- DotnetCliVersion.txt | 2 +- build.sh | 2 +- build/Build.cs | 38 +++++++++----------------- build/_build.csproj | 6 ++-- src/LibHac/LibHac.csproj | 4 +++ src/hactoolnet/hactoolnet.csproj | 4 +++ tests/LibHac.Tests/LibHac.Tests.csproj | 4 +++ 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/DotnetCliVersion.txt b/DotnetCliVersion.txt index c4d6f4ec..e290f404 100644 --- a/DotnetCliVersion.txt +++ b/DotnetCliVersion.txt @@ -1 +1 @@ -2.2.103 \ No newline at end of file +2.2.401 \ No newline at end of file diff --git a/build.sh b/build.sh index ed21297c..ea31a5cb 100644 --- a/build.sh +++ b/build.sh @@ -3,7 +3,7 @@ echo $(bash --version 2>&1 | head -n 1) #CUSTOMPARAM=0 -BUILD_ARGUMENTS=("-DoCoreBuildOnly") +BUILD_ARGUMENTS=("") for i in "$@"; do case $(echo $1 | awk '{print tolower($0)}') in # -custom-param) CUSTOMPARAM=1;; diff --git a/build/Build.cs b/build/Build.cs index b07b1881..086169bf 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -31,9 +31,6 @@ namespace LibHacBuild [Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] public readonly string Configuration = IsLocalBuild ? "Debug" : "Release"; - [Parameter("Build only .NET Core targets if true. Default is false on Windows")] - public readonly bool DoCoreBuildOnly; - [Solution("LibHac.sln")] readonly Solution _solution; [GitRepository] readonly GitRepository _gitRepository; [GitVersion] readonly GitVersion _gitVersion; @@ -62,7 +59,6 @@ namespace LibHacBuild private const string MyGetSource = "https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"; const string CertFileName = "cert.pfx"; - private const string CoreFrameworks = "netcoreapp2.1;netstandard2.0"; private bool IsMasterBranch => _gitVersion?.BranchName.Equals("master") ?? false; @@ -140,8 +136,6 @@ namespace LibHacBuild .SetProperties(VersionProps) .SetProperty("BuildType", "Release"); - if (DoCoreBuildOnly) buildSettings = buildSettings.SetProperty("TargetFrameworks", CoreFrameworks); - DotNetBuild(s => buildSettings); DotNetPublishSettings publishSettings = new DotNetPublishSettings() @@ -152,16 +146,15 @@ namespace LibHacBuild .SetProject(HactoolnetProject) .SetFramework("netcoreapp2.1") .SetOutput(CliCoreDir) + .SetNoBuild(true) .SetProperties(VersionProps)); - if (!DoCoreBuildOnly) - { - DotNetPublish(s => publishSettings - .SetProject(HactoolnetProject) - .SetFramework("net46") - .SetOutput(CliFrameworkDir) - .SetProperties(VersionProps)); - } + DotNetPublish(s => publishSettings + .SetProject(HactoolnetProject) + .SetFramework("net46") + .SetOutput(CliFrameworkDir) + .SetNoBuild(true) + .SetProperties(VersionProps)); // Hack around OS newline differences if (EnvironmentInfo.IsUnix) @@ -186,9 +179,6 @@ namespace LibHacBuild .SetOutputDirectory(ArtifactsDirectory) .SetProperties(VersionProps); - if (DoCoreBuildOnly) - settings = settings.SetProperty("TargetFrameworks", CoreFrameworks); - DotNetPack(s => settings); foreach (string filename in Directory.EnumerateFiles(ArtifactsDirectory, "*.*nupkg")) @@ -206,7 +196,8 @@ namespace LibHacBuild Target Merge => _ => _ .DependsOn(Compile) - .OnlyWhenStatic(() => !DoCoreBuildOnly) + // Merging on Linux blocked by https://github.com/gluck/il-repack/issues/230 + .OnlyWhenStatic(() => !EnvironmentInfo.IsUnix) .Executes(() => { string[] libraries = Directory.GetFiles(CliFrameworkDir, "*.dll"); @@ -242,7 +233,7 @@ namespace LibHacBuild .EnableNoBuild() .SetConfiguration(Configuration); - if (DoCoreBuildOnly) settings = settings.SetProperty("TargetFrameworks", CoreFrameworks); + if (EnvironmentInfo.IsUnix) settings = settings.SetProperty("TargetFramework", "netcoreapp2.1"); DotNetTest(s => settings); }); @@ -259,11 +250,8 @@ namespace LibHacBuild .Concat(Directory.EnumerateFiles(CliCoreDir, "*.dll")) .ToArray(); - if (!DoCoreBuildOnly) - { - ZipFiles(CliFrameworkZip, namesFx); - Console.WriteLine($"Created {CliFrameworkZip}"); - } + ZipFiles(CliFrameworkZip, namesFx); + Console.WriteLine($"Created {CliFrameworkZip}"); ZipFiles(CliCoreZip, namesCore); Console.WriteLine($"Created {CliCoreZip}"); @@ -365,8 +353,8 @@ namespace LibHacBuild Target Sign => _ => _ .DependsOn(Test, Zip, Merge) - .OnlyWhenStatic(() => !DoCoreBuildOnly) .OnlyWhenStatic(() => File.Exists(CertFileName)) + .OnlyWhenStatic(() => !EnvironmentInfo.IsUnix) .Executes(() => { string pwd = ReadPassword(); diff --git a/build/_build.csproj b/build/_build.csproj index 2786a599..eb229050 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -10,10 +10,10 @@ - + - - + + diff --git a/src/LibHac/LibHac.csproj b/src/LibHac/LibHac.csproj index d1e6fccc..a93b1bd6 100644 --- a/src/LibHac/LibHac.csproj +++ b/src/LibHac/LibHac.csproj @@ -52,4 +52,8 @@ + + + + diff --git a/src/hactoolnet/hactoolnet.csproj b/src/hactoolnet/hactoolnet.csproj index 39713272..6bf3d34a 100644 --- a/src/hactoolnet/hactoolnet.csproj +++ b/src/hactoolnet/hactoolnet.csproj @@ -20,4 +20,8 @@ + + + + diff --git a/tests/LibHac.Tests/LibHac.Tests.csproj b/tests/LibHac.Tests/LibHac.Tests.csproj index fa70a93c..b9308a3a 100644 --- a/tests/LibHac.Tests/LibHac.Tests.csproj +++ b/tests/LibHac.Tests/LibHac.Tests.csproj @@ -16,4 +16,8 @@ + + + +