From 9b914bfc296d21929c45361f49929695a486af1b Mon Sep 17 00:00:00 2001 From: erri120 Date: Mon, 4 Nov 2024 19:09:58 +0100 Subject: [PATCH 1/6] Use CPM and net8 --- Directory.Build.props | 6 ++-- Directory.Packages.props | 31 ++++++++++++++++++ NexusMods.Paths.sln | 1 + .../NexusMods.Paths.Extensions.Nx.csproj | 8 +++-- .../NexusMods.Paths.Benchmarks.csproj | 7 ++-- .../NexusMods.Paths.TestingHelpers.csproj | 2 +- src/NexusMods.Paths/NexusMods.Paths.csproj | 6 ++-- src/NexusMods.Paths/RelativePath.cs | 3 +- src/NexusMods.Paths/Utilities/PathHelpers.cs | 9 ++++-- tests/Directory.Build.props | 32 +++++++++---------- 10 files changed, 71 insertions(+), 34 deletions(-) create mode 100644 Directory.Packages.props diff --git a/Directory.Build.props b/Directory.Build.props index eb38266..28d36cf 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - net7.0 - false + net7.0;net8.0 + true @@ -21,6 +21,6 @@ - + diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 0000000..ea7ba57 --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + all + runtime; build; contentfiles; analyzers; buildtransitive + + + + + + + + + + \ No newline at end of file diff --git a/NexusMods.Paths.sln b/NexusMods.Paths.sln index d057d4a..ee5d494 100644 --- a/NexusMods.Paths.sln +++ b/NexusMods.Paths.sln @@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".solutionItems", ".solution NuGet.Build.props = NuGet.Build.props icon.png = icon.png mkdocs.yml = mkdocs.yml + Directory.Packages.props = Directory.Packages.props EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0377EBE6-F147-4233-86AD-32C821B9567E}" diff --git a/src/Extensions/NexusMods.Paths.Extensions.Nx/NexusMods.Paths.Extensions.Nx.csproj b/src/Extensions/NexusMods.Paths.Extensions.Nx/NexusMods.Paths.Extensions.Nx.csproj index 74f764e..a561854 100644 --- a/src/Extensions/NexusMods.Paths.Extensions.Nx/NexusMods.Paths.Extensions.Nx.csproj +++ b/src/Extensions/NexusMods.Paths.Extensions.Nx/NexusMods.Paths.Extensions.Nx.csproj @@ -6,11 +6,15 @@ - + - + + + + + diff --git a/src/NexusMods.Paths.Benchmarks/NexusMods.Paths.Benchmarks.csproj b/src/NexusMods.Paths.Benchmarks/NexusMods.Paths.Benchmarks.csproj index 1269eb3..7947176 100644 --- a/src/NexusMods.Paths.Benchmarks/NexusMods.Paths.Benchmarks.csproj +++ b/src/NexusMods.Paths.Benchmarks/NexusMods.Paths.Benchmarks.csproj @@ -2,18 +2,15 @@ Exe - net8.0 - enable - enable true - + - + diff --git a/src/NexusMods.Paths.TestingHelpers/NexusMods.Paths.TestingHelpers.csproj b/src/NexusMods.Paths.TestingHelpers/NexusMods.Paths.TestingHelpers.csproj index 608a0ed..0686bbb 100644 --- a/src/NexusMods.Paths.TestingHelpers/NexusMods.Paths.TestingHelpers.csproj +++ b/src/NexusMods.Paths.TestingHelpers/NexusMods.Paths.TestingHelpers.csproj @@ -2,7 +2,7 @@ - + diff --git a/src/NexusMods.Paths/NexusMods.Paths.csproj b/src/NexusMods.Paths/NexusMods.Paths.csproj index 48afe29..49cb47a 100644 --- a/src/NexusMods.Paths/NexusMods.Paths.csproj +++ b/src/NexusMods.Paths/NexusMods.Paths.csproj @@ -6,9 +6,9 @@ - - - + + + diff --git a/src/NexusMods.Paths/RelativePath.cs b/src/NexusMods.Paths/RelativePath.cs index 7779e17..581d6ca 100644 --- a/src/NexusMods.Paths/RelativePath.cs +++ b/src/NexusMods.Paths/RelativePath.cs @@ -189,7 +189,8 @@ public RelativePath[] GetParts() return Array.Empty(); // Count the number of parts in the path based on the directory separator character - var partCount = path.Count(PathHelpers.DirectorySeparatorChar); // This operation is SIMD accelerated + // ReSharper disable once RedundantNameQualifier + var partCount = Reloaded.Memory.Extensions.SpanExtensions.Count(path, PathHelpers.DirectorySeparatorChar); // Allocate an array to hold the parts var parts = GC.AllocateUninitializedArray(partCount + 1); diff --git a/src/NexusMods.Paths/Utilities/PathHelpers.cs b/src/NexusMods.Paths/Utilities/PathHelpers.cs index 6856685..52ab655 100644 --- a/src/NexusMods.Paths/Utilities/PathHelpers.cs +++ b/src/NexusMods.Paths/Utilities/PathHelpers.cs @@ -97,7 +97,8 @@ public static bool IsSanitized(ReadOnlySpan path, IOSInformation os, bool if (path.DangerousGetReferenceAt(path.Length - 1) == DirectorySeparatorChar) return false; // Paths on Windows that use backwards slashes '\' instead of forward ones are invalid. - if (path.Count('\\') != 0) return false; + // ReSharper disable once RedundantNameQualifier + if (Reloaded.Memory.Extensions.SpanExtensions.Count(path, '\\') != 0) return false; // Everything else is valid. return true; @@ -124,7 +125,8 @@ public static string Sanitize(ReadOnlySpan path, IOSInformation os) if (IsSanitized(path, os)) return path.ToString(); // Paths without backslashes only need to be checked for trailing directory separators. - if (path.Count('\\') == 0) return RemoveTrailingDirectorySeparator(path).ToString(); + // ReSharper disable once RedundantNameQualifier + if (Reloaded.Memory.Extensions.SpanExtensions.Count(path, '\\') == 0) return RemoveTrailingDirectorySeparator(path).ToString(); // Paths with backslashes instead of forward slashes need to be fixed. var buffer = path.Length > 512 @@ -547,7 +549,8 @@ public static string ReplaceExtension(string oldPath, string newExtension) public static int GetDirectoryDepth(ReadOnlySpan path, IOSInformation os) { DebugAssertIsSanitized(path, os); - return path.Count(DirectorySeparatorChar); + // ReSharper disable once RedundantNameQualifier + return Reloaded.Memory.Extensions.SpanExtensions.Count(path, DirectorySeparatorChar); } /// diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 9f456ab..d5b9654 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -7,43 +7,43 @@ - + - - - + + + - - - + + + all runtime; build; contentfiles; analyzers; buildtransitive - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive From b5112bdadede2e22b083c9a9e7c073f072fb2da7 Mon Sep 17 00:00:00 2001 From: erri120 Date: Mon, 4 Nov 2024 19:12:49 +0100 Subject: [PATCH 2/6] Upgrade submodule --- extern/meta | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/meta b/extern/meta index 75faebd..9c48444 160000 --- a/extern/meta +++ b/extern/meta @@ -1 +1 @@ -Subproject commit 75faebd40fc091fcaf995c6c174867537caf2b05 +Subproject commit 9c4844439c53f8b8b9f64fb707c91b469238b15e From ed598b880268d66fd78cd67f4e5eda8a8636e8a3 Mon Sep 17 00:00:00 2001 From: halgari Date: Mon, 11 Nov 2024 17:16:05 -0700 Subject: [PATCH 3/6] Resolve package issues, and update to .NET 9 --- Directory.Build.props | 2 +- Directory.Packages.props | 8 +++----- NuGet.Build.props | 4 ---- .../NexusMods.Paths.Extensions.Nx.csproj | 5 ----- tests/Directory.Build.props | 5 ----- 5 files changed, 4 insertions(+), 20 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 28d36cf..bf1c21b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - net7.0;net8.0 + net9.0 true diff --git a/Directory.Packages.props b/Directory.Packages.props index ea7ba57..f362e5d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -2,19 +2,17 @@ + - - + - - - + all diff --git a/NuGet.Build.props b/NuGet.Build.props index 87aeb6c..8ffbc3a 100644 --- a/NuGet.Build.props +++ b/NuGet.Build.props @@ -31,8 +31,4 @@ - - - - diff --git a/src/Extensions/NexusMods.Paths.Extensions.Nx/NexusMods.Paths.Extensions.Nx.csproj b/src/Extensions/NexusMods.Paths.Extensions.Nx/NexusMods.Paths.Extensions.Nx.csproj index a561854..028e59b 100644 --- a/src/Extensions/NexusMods.Paths.Extensions.Nx/NexusMods.Paths.Extensions.Nx.csproj +++ b/src/Extensions/NexusMods.Paths.Extensions.Nx/NexusMods.Paths.Extensions.Nx.csproj @@ -12,9 +12,4 @@ - - - - - diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index d5b9654..cb67b83 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -6,13 +6,8 @@ true - - - - - From 044208de1e2a81a4aefa2d26472481297a914dac Mon Sep 17 00:00:00 2001 From: halgari Date: Mon, 11 Nov 2024 17:25:03 -0700 Subject: [PATCH 4/6] Not sure why this exists, it's a bit too hard to work with during transitions between frameworks. So I'm removing it for now. --- .github/workflows/compare-to-meta.yaml | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 .github/workflows/compare-to-meta.yaml diff --git a/.github/workflows/compare-to-meta.yaml b/.github/workflows/compare-to-meta.yaml deleted file mode 100644 index 461af51..0000000 --- a/.github/workflows/compare-to-meta.yaml +++ /dev/null @@ -1,11 +0,0 @@ -name: Compare to meta-repo - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - compare: - uses: Nexus-Mods/NexusMods.App.Meta/.github/workflows/compare-to-meta.yaml@fc9c9eae43a7c70eaa4d66b3717cd9cd35cc2bbb From 693b7c61526efd623d1b30f0907b5cc50e675834 Mon Sep 17 00:00:00 2001 From: halgari Date: Mon, 11 Nov 2024 17:40:14 -0700 Subject: [PATCH 5/6] net9.0 seems to hang on Mac? Let's revert that change and see what's still broken --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index bf1c21b..44b54ba 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - net9.0 + net8.0 true From b2d178cf6391b32ac75135b92569a6111d42dc26 Mon Sep 17 00:00:00 2001 From: halgari Date: Mon, 11 Nov 2024 17:40:51 -0700 Subject: [PATCH 6/6] Revert the agent file as well --- .github/workflows/dotnet-build-and-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-build-and-test.yaml b/.github/workflows/dotnet-build-and-test.yaml index 2732cb5..5e6729f 100644 --- a/.github/workflows/dotnet-build-and-test.yaml +++ b/.github/workflows/dotnet-build-and-test.yaml @@ -16,4 +16,4 @@ on: jobs: build-and-test: - uses: Nexus-Mods/NexusMods.App.Meta/.github/workflows/dotnet-build-and-test-with-osx.yaml@main + uses: Nexus-Mods/NexusMods.App.Meta/.github/workflows/dotnet-build-and-test-with-osx.yaml@ae64a3be780a74e94b59ee463a413083013c8b0c