Skip to content

Commit

Permalink
Merge pull request #278 from CodebreakerApp/276-libs-dotnet9
Browse files Browse the repository at this point in the history
analyzer lib .net 9 #277
  • Loading branch information
christiannagel authored Nov 16, 2024
2 parents 7205346 + b577f62 commit ec29d79
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codebreaker-lib-analyzers-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x

- name: Build the library
run: dotnet build -c Release ${{ env.solutionfile-path }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/codebreaker-lib-analyzers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
version-offset: 38
solutionfile-path: src/Codebreaker.Analyzers.sln
projectfile-path: src/services/common/Codebreaker.GameAPIs.Analyzers/Codebreaker.Analyzers.csproj
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'
artifact-name: codebreaker-analyzers
branch-name: main

Expand All @@ -38,6 +38,8 @@ jobs:
artifact-name: codebreaker-analyzers
secrets: inherit

# NuGet publish is now done with codebreaker-lib-stable.yml
# In case a preview version will be published again to NuGet, this can be uncommented.
# publishnuget:
# uses: CodebreakerApp/Codebreaker.Backend/.github/workflows/publishnuget-nugetserver.yml@main
# needs: publishdevops
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -10,15 +10,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public abstract class GameGuessAnalyzer<TField, TResult>(IGame game, TField[] guesses, int moveNumber) : IGameGuessAnalyzer<TResult>
where TResult : struct
{
protected readonly IGame _game = game;
private protected readonly IGame _game = game;
private readonly int _moveNumber = moveNumber;

protected TField[] Guesses { get; private set; } = guesses;
Expand All @@ -32,7 +32,9 @@ private void ValidateGuess()
{
/// The number of codes in the game does not match the number of pegs in the move.
if (_game.NumberCodes != Guesses.Length)
{
throw new ArgumentException($"Invalid guess number {Guesses.Length} for {_game.NumberCodes} code numbers") { HResult = 4200 };
}

ValidateGuessValues();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

<PropertyGroup>
<PackageId>CNinnovation.Codebreaker.Analyzers</PackageId>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<LangVersion>13.0</LangVersion>
<PackageTags>
Codebreaker;CNinnovation;GameAnalyzers
</PackageTags>
Expand All @@ -15,10 +15,7 @@
</Description>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<PackageIcon>codebreaker.jpeg</PackageIcon>
</PropertyGroup>

<PropertyGroup>
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">true</IsAotCompatible>
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public partial record class ShapeAndColorField(string Shape, string Color)
{
internal static ShapeAndColorField Empty => new ShapeAndColorField(string.Empty, string.Empty);
internal static ShapeAndColorField Empty => new(string.Empty, string.Empty);

private const char Separator = ';';
public override string ToString() => $"{Shape}{Separator}{Color}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, [Ma
values[i] = (ResultValue)(s[j] - '0');
}
result = new SimpleColorResult(values);
return s != default;
return !s.IsEmpty;
}

public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out SimpleColorResult result) =>
Expand Down

0 comments on commit ec29d79

Please sign in to comment.