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)
#CUSTOMPARAM=0
BUILD_ARGUMENTS=("-DoCoreBuildOnly")
BUILD_ARGUMENTS=("")
for i in "$@"; do
case $(echo $1 | awk '{print tolower($0)}') in
# -custom-param) CUSTOMPARAM=1;;

View file

@ -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)
.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(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();

View file

@ -10,10 +10,10 @@
</PropertyGroup>
<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="NuGet.CommandLine" Version="5.0.2" />
<PackageReference Include="Nuke.Common" Version="0.21.0" />
<PackageReference Include="NuGet.CommandLine" Version="5.1.0" />
<PackageReference Include="Nuke.Common" Version="0.21.2" />
<PackageReference Include="SharpZipLib" Version="1.1.0" />
</ItemGroup>

View file

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

View file

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

View file

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