mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Update SourceLink package/info and target .NET Core 3.1 with hactoolnet (#106)
Make hactoolnet target the LTS .NET Core version. LibHac still targets .NET Core 3.0.
This commit is contained in:
parent
5e4ea459cb
commit
e8bef8af6a
6 changed files with 75 additions and 37 deletions
|
@ -1 +1 @@
|
||||||
3.0.100
|
3.1.100
|
|
@ -35,15 +35,13 @@ namespace LibHacBuild
|
||||||
public readonly bool Untrimmed;
|
public readonly bool Untrimmed;
|
||||||
|
|
||||||
[Solution("LibHac.sln")] readonly Solution _solution;
|
[Solution("LibHac.sln")] readonly Solution _solution;
|
||||||
[GitRepository] readonly GitRepository _gitRepository;
|
|
||||||
[GitVersion] readonly GitVersion _gitVersion;
|
|
||||||
|
|
||||||
AbsolutePath SourceDirectory => RootDirectory / "src";
|
AbsolutePath SourceDirectory => RootDirectory / "src";
|
||||||
AbsolutePath TestsDirectory => RootDirectory / "tests";
|
AbsolutePath TestsDirectory => RootDirectory / "tests";
|
||||||
AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
|
AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
|
||||||
AbsolutePath SignedArtifactsDirectory => ArtifactsDirectory / "signed";
|
AbsolutePath SignedArtifactsDirectory => ArtifactsDirectory / "signed";
|
||||||
AbsolutePath TempDirectory => RootDirectory / ".tmp";
|
AbsolutePath TempDirectory => RootDirectory / ".tmp";
|
||||||
AbsolutePath CliCoreDir => TempDirectory / "hactoolnet_netcoreapp3.0";
|
AbsolutePath CliCoreDir => TempDirectory / "hactoolnet_netcoreapp3.1";
|
||||||
AbsolutePath CliNativeDir => TempDirectory / $"hactoolnet_{HostOsName}";
|
AbsolutePath CliNativeDir => TempDirectory / $"hactoolnet_{HostOsName}";
|
||||||
AbsolutePath CliNativeExe => CliNativeDir / $"hactoolnet_native{NativeProgramExtension}";
|
AbsolutePath CliNativeExe => CliNativeDir / $"hactoolnet_native{NativeProgramExtension}";
|
||||||
AbsolutePath CliCoreZip => ArtifactsDirectory / $"hactoolnet-{VersionString}-netcore.zip";
|
AbsolutePath CliCoreZip => ArtifactsDirectory / $"hactoolnet-{VersionString}-netcore.zip";
|
||||||
|
@ -54,6 +52,8 @@ namespace LibHacBuild
|
||||||
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();
|
||||||
|
|
||||||
|
private bool HasGitDir { get; set; }
|
||||||
|
|
||||||
private string NativeRuntime { get; set; }
|
private string NativeRuntime { get; set; }
|
||||||
private string HostOsName { get; set; }
|
private string HostOsName { get; set; }
|
||||||
private string NativeProgramExtension { get; set; }
|
private string NativeProgramExtension { get; set; }
|
||||||
|
@ -86,42 +86,76 @@ namespace LibHacBuild
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsMasterBranch => _gitVersion?.BranchName.Equals("master") ?? false;
|
|
||||||
|
|
||||||
Target SetVersion => _ => _
|
Target SetVersion => _ => _
|
||||||
.OnlyWhenStatic(() => _gitRepository != null)
|
|
||||||
.Executes(() =>
|
.Executes(() =>
|
||||||
{
|
{
|
||||||
VersionString = $"{_gitVersion.MajorMinorPatch}";
|
GitRepository gitRepository = null;
|
||||||
if (!string.IsNullOrWhiteSpace(_gitVersion.PreReleaseTag))
|
GitVersion gitVersion = null;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
VersionString += $"-{_gitVersion.PreReleaseTag}+{_gitVersion.Sha.Substring(0, 8)}";
|
gitRepository = (GitRepository)new GitRepositoryAttribute().GetValue(null, null);
|
||||||
|
|
||||||
|
gitVersion = GitVersionTasks.GitVersion(s => s
|
||||||
|
.SetFramework("netcoreapp3.1")
|
||||||
|
.DisableLogOutput())
|
||||||
|
.Result;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.Error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
string suffix = _gitVersion.PreReleaseTag;
|
if (gitRepository == null || gitVersion == null)
|
||||||
|
{
|
||||||
|
Logger.Normal("Unable to read Git version.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
HasGitDir = true;
|
||||||
|
|
||||||
|
VersionString = $"{gitVersion.MajorMinorPatch}";
|
||||||
|
if (!string.IsNullOrWhiteSpace(gitVersion.PreReleaseTag))
|
||||||
|
{
|
||||||
|
VersionString += $"-{gitVersion.PreReleaseTag}+{gitVersion.Sha.Substring(0, 8)}";
|
||||||
|
}
|
||||||
|
|
||||||
|
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)}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Host == HostType.AppVeyor)
|
||||||
|
{
|
||||||
|
// Workaround GitVersion issue by getting PR info manually https://github.com/GitTools/GitVersion/issues/1927
|
||||||
|
string prNumber = Environment.GetEnvironmentVariable("APPVEYOR_PULL_REQUEST_NUMBER");
|
||||||
|
string branchName = Environment.GetEnvironmentVariable("APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH");
|
||||||
|
|
||||||
|
if (int.TryParse(prNumber, out int prInt) && branchName != null)
|
||||||
|
{
|
||||||
|
string prString = $"PullRequest{prInt:D4}";
|
||||||
|
|
||||||
|
VersionString = VersionString.Replace(branchName, prString);
|
||||||
|
suffix = suffix.Replace(branchName, prString);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetAppVeyorVersion(VersionString);
|
||||||
}
|
}
|
||||||
|
|
||||||
VersionProps = new Dictionary<string, object>
|
VersionProps = new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
["VersionPrefix"] = _gitVersion.AssemblySemVer,
|
["VersionPrefix"] = gitVersion.AssemblySemVer,
|
||||||
["VersionSuffix"] = suffix
|
["VersionSuffix"] = suffix
|
||||||
};
|
};
|
||||||
|
|
||||||
Logger.Normal($"Building version {VersionString}");
|
Logger.Normal($"Building version {VersionString}");
|
||||||
|
|
||||||
if (Host == HostType.AppVeyor)
|
|
||||||
{
|
|
||||||
SetAppVeyorVersion(VersionString);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Target Clean => _ => _
|
Target Clean => _ => _
|
||||||
|
@ -159,7 +193,8 @@ namespace LibHacBuild
|
||||||
.EnableNoRestore()
|
.EnableNoRestore()
|
||||||
.SetConfiguration(Configuration)
|
.SetConfiguration(Configuration)
|
||||||
.SetProperties(VersionProps)
|
.SetProperties(VersionProps)
|
||||||
.SetProperty("BuildType", "Release");
|
.SetProperty("BuildType", "Release")
|
||||||
|
.SetProperty("HasGitDir", HasGitDir);
|
||||||
|
|
||||||
DotNetBuild(s => buildSettings);
|
DotNetBuild(s => buildSettings);
|
||||||
|
|
||||||
|
@ -169,7 +204,7 @@ namespace LibHacBuild
|
||||||
|
|
||||||
DotNetPublish(s => publishSettings
|
DotNetPublish(s => publishSettings
|
||||||
.SetProject(HactoolnetProject)
|
.SetProject(HactoolnetProject)
|
||||||
.SetFramework("netcoreapp3.0")
|
.SetFramework("netcoreapp3.1")
|
||||||
.SetOutput(CliCoreDir)
|
.SetOutput(CliCoreDir)
|
||||||
.SetNoBuild(true)
|
.SetNoBuild(true)
|
||||||
.SetProperties(VersionProps));
|
.SetProperties(VersionProps));
|
||||||
|
@ -221,7 +256,7 @@ namespace LibHacBuild
|
||||||
.EnableNoBuild()
|
.EnableNoBuild()
|
||||||
.SetConfiguration(Configuration);
|
.SetConfiguration(Configuration);
|
||||||
|
|
||||||
if (EnvironmentInfo.IsUnix) settings = settings.SetProperty("TargetFramework", "netcoreapp3.0");
|
if (EnvironmentInfo.IsUnix) settings = settings.SetProperty("TargetFramework", "netcoreapp3.1");
|
||||||
|
|
||||||
DotNetTest(s => settings);
|
DotNetTest(s => settings);
|
||||||
});
|
});
|
||||||
|
@ -335,7 +370,7 @@ namespace LibHacBuild
|
||||||
DotNetPublishSettings publishSettings = new DotNetPublishSettings()
|
DotNetPublishSettings publishSettings = new DotNetPublishSettings()
|
||||||
.SetConfiguration(Configuration)
|
.SetConfiguration(Configuration)
|
||||||
.SetProject(nativeProject)
|
.SetProject(nativeProject)
|
||||||
.SetFramework("netcoreapp3.0")
|
.SetFramework("netcoreapp3.1")
|
||||||
.SetRuntime(NativeRuntime)
|
.SetRuntime(NativeRuntime)
|
||||||
.SetOutput(CliNativeDir)
|
.SetOutput(CliNativeDir)
|
||||||
.SetProperties(VersionProps);
|
.SetProperties(VersionProps);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
<RootNamespace>LibHacBuild</RootNamespace>
|
<RootNamespace>LibHacBuild</RootNamespace>
|
||||||
<IsPackable>False</IsPackable>
|
<IsPackable>False</IsPackable>
|
||||||
|
@ -10,8 +10,8 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageDownload Include="GitVersion.Tool" Version="[5.0.1]" />
|
<PackageDownload Include="GitVersion.Tool" Version="[5.1.3]" />
|
||||||
<PackageReference Include="NuGet.CommandLine" Version="5.3.1" />
|
<PackageReference Include="NuGet.CommandLine" Version="5.4.0" />
|
||||||
<PackageReference Include="Nuke.Common" Version="0.23.4" />
|
<PackageReference Include="Nuke.Common" Version="0.23.4" />
|
||||||
<PackageReference Include="SharpZipLib" Version="1.2.0" />
|
<PackageReference Include="SharpZipLib" Version="1.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
|
<VersionPrefix>0.8.0</VersionPrefix>
|
||||||
<TargetFrameworks>netcoreapp3.0;netstandard2.1</TargetFrameworks>
|
<TargetFrameworks>netcoreapp3.0;netstandard2.1</TargetFrameworks>
|
||||||
<LangVersion>8.0</LangVersion>
|
<LangVersion>8.0</LangVersion>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
@ -13,17 +15,18 @@
|
||||||
<PackageTags>Nintendo;Switch;nca;xci;savefile</PackageTags>
|
<PackageTags>Nintendo;Switch;nca;xci;savefile</PackageTags>
|
||||||
<PackageProjectUrl>https://github.com/Thealexbarney/LibHac</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/Thealexbarney/LibHac</PackageProjectUrl>
|
||||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
<RepositoryType>git</RepositoryType>
|
|
||||||
<RepositoryUrl>https://github.com/Thealexbarney/LibHac</RepositoryUrl>
|
|
||||||
|
|
||||||
<VersionPrefix>0.7.0</VersionPrefix>
|
|
||||||
<PathMap Condition=" '$(BuildType)' == 'Release' ">$(MSBuildProjectDirectory)=C:/LibHac/</PathMap>
|
|
||||||
<IncludeSymbols>true</IncludeSymbols>
|
<IncludeSymbols>true</IncludeSymbols>
|
||||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||||
<IncludeSource>true</IncludeSource>
|
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||||
<NoWarn>$(NoWarn);1591;NU5105</NoWarn>
|
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
|
<!-- When doing a release build with a Git directory, SourceLink will set the SourceRoot needed for DeterministicSourcePaths -->
|
||||||
|
<!-- Otherwise use a manually specified path -->
|
||||||
|
<PathMap Condition=" '$(BuildType)' == 'Release' and '$(HasGitDir)' == 'false' ">$(MSBuildProjectDirectory)=C:/LibHac/</PathMap>
|
||||||
|
<DeterministicSourcePaths Condition=" '$(BuildType)' == 'Release' and '$(HasGitDir)' == 'true' ">true</DeterministicSourcePaths>
|
||||||
|
|
||||||
|
<NoWarn>$(NoWarn);1591;NU5105</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">
|
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">
|
||||||
|
@ -35,7 +38,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19554-01" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
|
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
|
||||||
<LangVersion>8.0</LangVersion>
|
<LangVersion>8.0</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VersionPrefix>0.7.0</VersionPrefix>
|
<VersionPrefix>0.8.0</VersionPrefix>
|
||||||
<PathMap Condition=" '$(BuildType)' == 'Release' ">$(MSBuildProjectDirectory)=C:/hactoolnet/</PathMap>
|
<PathMap Condition=" '$(BuildType)' == 'Release' ">$(MSBuildProjectDirectory)=C:/hactoolnet/</PathMap>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
|
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
Loading…
Reference in a new issue