Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CPM and net8 #59

Merged
merged 7 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .github/workflows/compare-to-meta.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/dotnet-build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<IsPackable>false</IsPackable>
<TargetFramework>net8.0</TargetFramework>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
Expand All @@ -21,6 +21,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2023.*" PrivateAssets="all" />
<PackageReference Include="JetBrains.Annotations" PrivateAssets="all" />
</ItemGroup>
</Project>
29 changes: 29 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project>
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageVersion Include="Reloaded.Memory" Version="9.4.2" />
<PackageVersion Include="Reloaded.Memory.Extensions" Version="9.4.2" />
<PackageVersion Include="TransparentValueObjects" Version="1.0.1" />
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="NexusMods.Archives.Nx" Version="0.6.1" />
<PackageVersion Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageVersion Include="AutoFixture" Version="4.18.1" />
<PackageVersion Include="AutoFixture.Xunit2" Version="4.18.1" />
<PackageVersion Include="FluentAssertions" Version="6.12.2" />
<PackageVersion Include="FluentAssertions.OneOf" Version="0.0.5" />
<PackageVersion Include="FluentAssertions.Analyzers" Version="0.34.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.4.13" />
<PackageVersion Include="Xunit.DependencyInjection" Version="9.6.0" />
<PackageVersion Include="Xunit.DependencyInjection.Logging" Version="9.0.0" />
<PackageVersion Include="Xunit.DependencyInjection.SkippableFact" Version="9.0.0" />
<PackageVersion Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions NexusMods.Paths.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
4 changes: 0 additions & 4 deletions NuGet.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,4 @@
<None Include="$(MSBuildThisFileDirectory)icon.png" Pack="true" PackagePath="assets" />
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="docs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.*" PrivateAssets="all" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion extern/meta
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NexusMods.Archives.Nx" Version="0.5.0" />
<PackageReference Include="NexusMods.Archives.Nx" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\NexusMods.Paths\NexusMods.Paths.csproj" />
<ProjectReference Include="..\..\NexusMods.Paths\NexusMods.Paths.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.8" />
<PackageReference Include="BenchmarkDotNet" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\NexusMods.Paths\NexusMods.Paths.csproj" />
<ProjectReference Include="..\NexusMods.Paths\NexusMods.Paths.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="$([MSBuild]::GetPathOfFileAbove('NuGet.Build.props', '$(MSBuildThisFileDirectory)../'))" />

<ItemGroup>
<PackageReference Include="AutoFixture.Xunit2" Version="4.18.*" />
<PackageReference Include="AutoFixture.Xunit2" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/NexusMods.Paths/NexusMods.Paths.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Reloaded.Memory" Version="9.4.1" />
<PackageReference Include="TransparentValueObjects" PrivateAssets="all" OutputItemType="Analyzer" ReferenceOutputAssembly="false" Version="1.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
<PackageReference Include="Reloaded.Memory"/>
<PackageReference Include="TransparentValueObjects" PrivateAssets="all" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/NexusMods.Paths/RelativePath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ public RelativePath[] GetParts()
return Array.Empty<RelativePath>();

// 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<RelativePath>(partCount + 1);
Expand Down
9 changes: 6 additions & 3 deletions src/NexusMods.Paths/Utilities/PathHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public static bool IsSanitized(ReadOnlySpan<char> 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;
Expand All @@ -124,7 +125,8 @@ public static string Sanitize(ReadOnlySpan<char> 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
Expand Down Expand Up @@ -547,7 +549,8 @@ public static string ReplaceExtension(string oldPath, string newExtension)
public static int GetDirectoryDepth(ReadOnlySpan<char> path, IOSInformation os)
{
DebugAssertIsSanitized(path, os);
return path.Count(DirectorySeparatorChar);
// ReSharper disable once RedundantNameQualifier
return Reloaded.Memory.Extensions.SpanExtensions.Count(path, DirectorySeparatorChar);
}

/// <summary>
Expand Down
33 changes: 14 additions & 19 deletions tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,38 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Moq" Version="4.*" />
<PackageReference Include="AutoFixture" />
<PackageReference Include="AutoFixture.Xunit2"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoFixture" Version="4.*" />
<PackageReference Include="AutoFixture.AutoMoq" Version="4.*" />
<PackageReference Include="AutoFixture.Xunit2" Version="4.*" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.*" />
<PackageReference Include="FluentAssertions.OneOf" Version="0.0.5" />
<PackageReference Include="FluentAssertions.Analyzers" Version="0.18.0">
<PackageReference Include="FluentAssertions" />
<PackageReference Include="FluentAssertions.OneOf"/>
<PackageReference Include="FluentAssertions.Analyzers" >
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="xunit" Version="2.4.*" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.*">
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Xunit.SkippableFact" Version="1.4.*" />
<PackageReference Include="Xunit.DependencyInjection" Version="8.*" />
<PackageReference Include="Xunit.DependencyInjection.Logging" Version="8.*" />
<PackageReference Include="Xunit.DependencyInjection.SkippableFact" Version="8.*" />
<PackageReference Include="Xunit.SkippableFact"/>
<PackageReference Include="Xunit.DependencyInjection"/>
<PackageReference Include="Xunit.DependencyInjection.Logging" />
<PackageReference Include="Xunit.DependencyInjection.SkippableFact" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.*" />
<PackageReference Include="coverlet.collector" Version="6.*">
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="coverlet.collector">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="GitHubActionsTestLogger" Version="2.*">
<PackageReference Include="GitHubActionsTestLogger">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Loading