From e7b642380c7eee6b53064abcc4f3921f4508d758 Mon Sep 17 00:00:00 2001
From: Alex Barney <thealexbarney@gmail.com>
Date: Sun, 8 Oct 2023 21:03:56 -0700
Subject: [PATCH] Update build and test dependencies

---
 .nuke/build.schema.json                |  4 ++--
 DotnetCliVersion.txt                   |  2 +-
 build/Build.cs                         | 25 +++++++++++--------------
 build/CodeGen/_buildCodeGen.csproj     |  2 +-
 build/RepackNuget.cs                   |  6 ++----
 build/_build.csproj                    |  9 ++++++---
 tests/LibHac.Tests/LibHac.Tests.csproj | 13 ++++++++-----
 tests/LibHac.Tests/ResultAsserts.cs    |  2 +-
 tests/LibHac.Tests/SpanEqualAsserts.cs |  2 +-
 9 files changed, 33 insertions(+), 32 deletions(-)

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<string> toDelete = GlobDirectories(SourceDirectory, "**/bin", "**/obj")
-                .Concat(GlobDirectories(TestsDirectory, "**/bin", "**/obj")).ToList();
+            List<AbsolutePath> 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 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Nuke.Common" Version="6.3.0" />
+    <PackageReference Include="Nuke.Common" Version="7.0.6" />
   </ItemGroup>
 
   <ItemGroup>
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<string> 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 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageDownload Include="GitVersion.Tool" Version="[5.9.0]" />
+    <PackageDownload Include="GitVersion.Tool" Version="[5.12.0]" />
     <PackageReference Include="CsvHelper" Version="30.0.1" />
-    <PackageReference Include="NuGet.CommandLine" Version="6.4.0" />
-    <PackageReference Include="Nuke.Common" Version="6.3.0" />
+    <PackageReference Include="NuGet.CommandLine" Version="6.7.0">
+      <PrivateAssets>all</PrivateAssets>
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+    </PackageReference>
+    <PackageReference Include="Nuke.Common" Version="7.0.6" />
     <PackageReference Include="SharpZipLib" Version="1.4.2" />
   </ItemGroup>
 
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 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
-    <PackageReference Include="xunit.core" Version="2.4.2" />
-    <PackageReference Include="xunit.analyzers" Version="1.1.0" />
-    <PackageReference Include="xunit.assert.source" Version="2.4.2" />
-    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
+    <PackageReference Include="xunit.core" Version="2.5.1" />
+    <PackageReference Include="xunit.analyzers" Version="1.3.0" />
+    <PackageReference Include="xunit.assert.source" Version="2.5.1" />
+    <PackageReference Include="xunit.runner.visualstudio" Version="2.5.1">
+      <PrivateAssets>all</PrivateAssets>
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+    </PackageReference>
   </ItemGroup>
 
   <ItemGroup>
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<T>(ReadOnlySpan<T> expected, ReadOnlySpan<T> actual) where T : unmanaged, IEquatable<T>
     {
         if (!expected.SequenceEqual(actual))
-            throw new EqualException(expected.ToArray(), actual.ToArray());
+            throw EqualException.ForMismatchedValues(expected.ToArray(), actual.ToArray());
     }
 }
\ No newline at end of file