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
This commit is contained in:
Alex Barney 2019-08-09 20:29:06 -05:00 committed by GitHub
parent 4ef297be7f
commit 9d813ade18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 30 deletions

View file

@ -1 +1 @@
2.2.103 2.2.401

View file

@ -3,7 +3,7 @@
echo $(bash --version 2>&1 | head -n 1) echo $(bash --version 2>&1 | head -n 1)
#CUSTOMPARAM=0 #CUSTOMPARAM=0
BUILD_ARGUMENTS=("-DoCoreBuildOnly") BUILD_ARGUMENTS=("")
for i in "$@"; do for i in "$@"; do
case $(echo $1 | awk '{print tolower($0)}') in case $(echo $1 | awk '{print tolower($0)}') in
# -custom-param) CUSTOMPARAM=1;; # -custom-param) CUSTOMPARAM=1;;

View file

@ -31,9 +31,6 @@ namespace LibHacBuild
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] [Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
public 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")]
public 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;
@ -62,7 +59,6 @@ namespace LibHacBuild
private const string MyGetSource = "https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"; private const string MyGetSource = "https://dotnet.myget.org/F/dotnet-core/api/v3/index.json";
const string CertFileName = "cert.pfx"; const string CertFileName = "cert.pfx";
private const string CoreFrameworks = "netcoreapp2.1;netstandard2.0";
private bool IsMasterBranch => _gitVersion?.BranchName.Equals("master") ?? false; private bool IsMasterBranch => _gitVersion?.BranchName.Equals("master") ?? false;
@ -140,8 +136,6 @@ namespace LibHacBuild
.SetProperties(VersionProps) .SetProperties(VersionProps)
.SetProperty("BuildType", "Release"); .SetProperty("BuildType", "Release");
if (DoCoreBuildOnly) buildSettings = buildSettings.SetProperty("TargetFrameworks", CoreFrameworks);
DotNetBuild(s => buildSettings); DotNetBuild(s => buildSettings);
DotNetPublishSettings publishSettings = new DotNetPublishSettings() DotNetPublishSettings publishSettings = new DotNetPublishSettings()
@ -152,16 +146,15 @@ namespace LibHacBuild
.SetProject(HactoolnetProject) .SetProject(HactoolnetProject)
.SetFramework("netcoreapp2.1") .SetFramework("netcoreapp2.1")
.SetOutput(CliCoreDir) .SetOutput(CliCoreDir)
.SetNoBuild(true)
.SetProperties(VersionProps)); .SetProperties(VersionProps));
if (!DoCoreBuildOnly) DotNetPublish(s => publishSettings
{ .SetProject(HactoolnetProject)
DotNetPublish(s => publishSettings .SetFramework("net46")
.SetProject(HactoolnetProject) .SetOutput(CliFrameworkDir)
.SetFramework("net46") .SetNoBuild(true)
.SetOutput(CliFrameworkDir) .SetProperties(VersionProps));
.SetProperties(VersionProps));
}
// Hack around OS newline differences // Hack around OS newline differences
if (EnvironmentInfo.IsUnix) if (EnvironmentInfo.IsUnix)
@ -186,9 +179,6 @@ namespace LibHacBuild
.SetOutputDirectory(ArtifactsDirectory) .SetOutputDirectory(ArtifactsDirectory)
.SetProperties(VersionProps); .SetProperties(VersionProps);
if (DoCoreBuildOnly)
settings = settings.SetProperty("TargetFrameworks", CoreFrameworks);
DotNetPack(s => settings); DotNetPack(s => settings);
foreach (string filename in Directory.EnumerateFiles(ArtifactsDirectory, "*.*nupkg")) foreach (string filename in Directory.EnumerateFiles(ArtifactsDirectory, "*.*nupkg"))
@ -206,7 +196,8 @@ namespace LibHacBuild
Target Merge => _ => _ Target Merge => _ => _
.DependsOn(Compile) .DependsOn(Compile)
.OnlyWhenStatic(() => !DoCoreBuildOnly) // Merging on Linux blocked by https://github.com/gluck/il-repack/issues/230
.OnlyWhenStatic(() => !EnvironmentInfo.IsUnix)
.Executes(() => .Executes(() =>
{ {
string[] libraries = Directory.GetFiles(CliFrameworkDir, "*.dll"); string[] libraries = Directory.GetFiles(CliFrameworkDir, "*.dll");
@ -242,7 +233,7 @@ namespace LibHacBuild
.EnableNoBuild() .EnableNoBuild()
.SetConfiguration(Configuration); .SetConfiguration(Configuration);
if (DoCoreBuildOnly) settings = settings.SetProperty("TargetFrameworks", CoreFrameworks); if (EnvironmentInfo.IsUnix) settings = settings.SetProperty("TargetFramework", "netcoreapp2.1");
DotNetTest(s => settings); DotNetTest(s => settings);
}); });
@ -259,11 +250,8 @@ namespace LibHacBuild
.Concat(Directory.EnumerateFiles(CliCoreDir, "*.dll")) .Concat(Directory.EnumerateFiles(CliCoreDir, "*.dll"))
.ToArray(); .ToArray();
if (!DoCoreBuildOnly) ZipFiles(CliFrameworkZip, namesFx);
{ Console.WriteLine($"Created {CliFrameworkZip}");
ZipFiles(CliFrameworkZip, namesFx);
Console.WriteLine($"Created {CliFrameworkZip}");
}
ZipFiles(CliCoreZip, namesCore); ZipFiles(CliCoreZip, namesCore);
Console.WriteLine($"Created {CliCoreZip}"); Console.WriteLine($"Created {CliCoreZip}");
@ -365,8 +353,8 @@ namespace LibHacBuild
Target Sign => _ => _ Target Sign => _ => _
.DependsOn(Test, Zip, Merge) .DependsOn(Test, Zip, Merge)
.OnlyWhenStatic(() => !DoCoreBuildOnly)
.OnlyWhenStatic(() => File.Exists(CertFileName)) .OnlyWhenStatic(() => File.Exists(CertFileName))
.OnlyWhenStatic(() => !EnvironmentInfo.IsUnix)
.Executes(() => .Executes(() =>
{ {
string pwd = ReadPassword(); string pwd = ReadPassword();

View file

@ -10,10 +10,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="GitVersion.CommandLine.DotNetCore" Version="4.0.0" /> <PackageReference Include="GitVersion.CommandLine.DotNetCore" Version="5.0.0" />
<PackageReference Include="ILRepack.Lib" Version="2.0.17" NoWarn="NU1701" /> <PackageReference Include="ILRepack.Lib" Version="2.0.17" NoWarn="NU1701" />
<PackageReference Include="NuGet.CommandLine" Version="5.0.2" /> <PackageReference Include="NuGet.CommandLine" Version="5.1.0" />
<PackageReference Include="Nuke.Common" Version="0.21.0" /> <PackageReference Include="Nuke.Common" Version="0.21.2" />
<PackageReference Include="SharpZipLib" Version="1.1.0" /> <PackageReference Include="SharpZipLib" Version="1.1.0" />
</ItemGroup> </ItemGroup>

View file

@ -52,4 +52,8 @@
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" /> <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0-preview.2" />
</ItemGroup>
</Project> </Project>

View file

@ -20,4 +20,8 @@
<ProjectReference Include="..\LibHac\LibHac.csproj" /> <ProjectReference Include="..\LibHac\LibHac.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0-preview.2" />
</ItemGroup>
</Project> </Project>

View file

@ -16,4 +16,8 @@
<ProjectReference Include="..\..\src\LibHac\LibHac.csproj" /> <ProjectReference Include="..\..\src\LibHac\LibHac.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0-preview.2" />
</ItemGroup>
</Project> </Project>