diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 0cf25877..8685bda2 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -1,7 +1,7 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Build Schema", "$ref": "#/definitions/build", + "title": "Build Schema", "definitions": { "build": { "type": "object", @@ -133,4 +133,4 @@ } } } -} \ No newline at end of file +} diff --git a/DotnetCliVersion.txt b/DotnetCliVersion.txt index 071eb749..33300325 100644 --- a/DotnetCliVersion.txt +++ b/DotnetCliVersion.txt @@ -1 +1 @@ -7.0.401 \ No newline at end of file +7.0.402 \ No newline at end of file diff --git a/build/Build.cs b/build/Build.cs index 66e84f4f..4112a6e0 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -19,8 +19,6 @@ using Nuke.Common.Tooling; using Nuke.Common.Tools.DotNet; using Nuke.Common.Tools.GitVersion; using Nuke.Common.Tools.SignTool; -using static Nuke.Common.IO.FileSystemTasks; -using static Nuke.Common.IO.PathConstruction; using static Nuke.Common.Tools.DotNet.DotNetTasks; namespace LibHacBuild; @@ -99,10 +97,9 @@ partial class Build : NukeBuild try { - gitRepository = (GitRepository)new GitRepositoryAttribute().GetValue(null, null); + gitRepository = GitRepository.FromLocalDirectory(RootDirectory); gitVersion = GitVersionTasks.GitVersion(s => s - .SetFramework("net6.0") .DisableProcessLogOutput()) .Result; } @@ -127,7 +124,7 @@ partial class Build : NukeBuild HasGitDir = true; if (DateTimeOffset.TryParseExact(gitVersion.CommitDate, "yyyy-MM-dd HH:mm:ss", - CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.AssumeUniversal, out DateTimeOffset commitTime)) + CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.AssumeUniversal, out DateTimeOffset commitTime)) { CommitTime = commitTime.LocalDateTime; } @@ -179,17 +176,17 @@ partial class Build : NukeBuild Target Clean => _ => _ .Executes(() => { - List toDelete = GlobDirectories(SourceDirectory, "**/bin", "**/obj") - .Concat(GlobDirectories(TestsDirectory, "**/bin", "**/obj")).ToList(); + List toDelete = SourceDirectory.GlobDirectories("**/bin", "**/obj") + .Concat(TestsDirectory.GlobDirectories("**/bin", "**/obj")).ToList(); - foreach (string dir in toDelete) + foreach (AbsolutePath dir in toDelete) { - DeleteDirectory(dir); + dir.DeleteDirectory(); } - EnsureCleanDirectory(ArtifactsDirectory); - EnsureCleanDirectory(CliCoreDir); - EnsureCleanDirectory(CliNativeDir); + ArtifactsDirectory.CreateOrCleanDirectory(); + CliCoreDir.CreateOrCleanDirectory(); + CliNativeDir.CreateOrCleanDirectory(); }); Target Restore => _ => _ @@ -293,7 +290,7 @@ partial class Build : NukeBuild .Concat(Directory.EnumerateFiles(CliCoreDir, "*.dll")) .ToArray(); - EnsureExistingDirectory(ArtifactsDirectory); + ArtifactsDirectory.CreateDirectory(); ZipFiles(CliCoreZip, namesCore, CommitTime); Serilog.Log.Debug($"Created {CliCoreZip}"); @@ -396,7 +393,7 @@ partial class Build : NukeBuild ProcessTasks.StartProcess("strip", CliNativeExe).AssertZeroExitCode(); } - EnsureExistingDirectory(ArtifactsDirectory); + ArtifactsDirectory.CreateOrCleanDirectory(); ZipFile(CliNativeZip, CliNativeExe, $"hactoolnet{NativeProgramExtension}", CommitTime); Serilog.Log.Debug($"Created {CliNativeZip}"); diff --git a/build/CodeGen/_buildCodeGen.csproj b/build/CodeGen/_buildCodeGen.csproj index 8805a806..4f94a2ea 100644 --- a/build/CodeGen/_buildCodeGen.csproj +++ b/build/CodeGen/_buildCodeGen.csproj @@ -17,7 +17,7 @@ - + diff --git a/build/RepackNuget.cs b/build/RepackNuget.cs index 6087239f..46f4aa9a 100644 --- a/build/RepackNuget.cs +++ b/build/RepackNuget.cs @@ -23,7 +23,7 @@ public partial class Build try { - EnsureCleanDirectory(tempDir); + tempDir.CreateOrCleanDirectory(); List fileList = UnzipPackage(path, tempDir); string newPsmdcpName = CalcPsmdcpName(libDir); @@ -123,9 +123,7 @@ public partial class Build public void SignNupkg(string pkgPath, string password) { - NuGetTasks.NuGet( - $"sign \"{pkgPath}\" -CertificatePath cert.pfx -CertificatePassword {password} -Timestamper http://timestamp.digicert.com", - outputFilter: x => x.Replace(password, "hunter2")); + NuGetTasks.NuGet($"sign \"{pkgPath}\" -CertificatePath cert.pfx -CertificatePassword {password:r} -Timestamper http://timestamp.digicert.com"); } public static string ToHexString(byte[] arr) diff --git a/build/_build.csproj b/build/_build.csproj index 7c461436..c3d72d46 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -13,10 +13,13 @@ - + - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/tests/LibHac.Tests/LibHac.Tests.csproj b/tests/LibHac.Tests/LibHac.Tests.csproj index 07887457..71b43fae 100644 --- a/tests/LibHac.Tests/LibHac.Tests.csproj +++ b/tests/LibHac.Tests/LibHac.Tests.csproj @@ -9,11 +9,14 @@ - - - - - + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/LibHac.Tests/ResultAsserts.cs b/tests/LibHac.Tests/ResultAsserts.cs index 028f0cd6..b0b494dc 100644 --- a/tests/LibHac.Tests/ResultAsserts.cs +++ b/tests/LibHac.Tests/ResultAsserts.cs @@ -19,6 +19,6 @@ public partial class Assert public static void Result(Result.Base expected, Result actual) { if (!expected.Includes(actual)) - throw new EqualException(expected.Value, actual); + throw EqualException.ForMismatchedValues(expected.Value, actual); } } \ No newline at end of file diff --git a/tests/LibHac.Tests/SpanEqualAsserts.cs b/tests/LibHac.Tests/SpanEqualAsserts.cs index 61d07070..7e6934c5 100644 --- a/tests/LibHac.Tests/SpanEqualAsserts.cs +++ b/tests/LibHac.Tests/SpanEqualAsserts.cs @@ -16,6 +16,6 @@ public partial class Assert public static void Equal(ReadOnlySpan expected, ReadOnlySpan actual) where T : unmanaged, IEquatable { if (!expected.SequenceEqual(actual)) - throw new EqualException(expected.ToArray(), actual.ToArray()); + throw EqualException.ForMismatchedValues(expected.ToArray(), actual.ToArray()); } } \ No newline at end of file