Skip to content

Commit ec29d79

Browse files
Merge pull request #278 from CodebreakerApp/276-libs-dotnet9
analyzer lib .net 9 #277
2 parents 7205346 + b577f62 commit ec29d79

File tree

7 files changed

+19
-18
lines changed

7 files changed

+19
-18
lines changed

.github/workflows/codebreaker-lib-analyzers-stable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup .NET
2323
uses: actions/setup-dotnet@v4
2424
with:
25-
dotnet-version: 8.0.x
25+
dotnet-version: 9.0.x
2626

2727
- name: Build the library
2828
run: dotnet build -c Release ${{ env.solutionfile-path }}

.github/workflows/codebreaker-lib-analyzers.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
version-offset: 38
2828
solutionfile-path: src/Codebreaker.Analyzers.sln
2929
projectfile-path: src/services/common/Codebreaker.GameAPIs.Analyzers/Codebreaker.Analyzers.csproj
30-
dotnet-version: '8.0.x'
30+
dotnet-version: '9.0.x'
3131
artifact-name: codebreaker-analyzers
3232
branch-name: main
3333

@@ -38,6 +38,8 @@ jobs:
3838
artifact-name: codebreaker-analyzers
3939
secrets: inherit
4040

41+
# NuGet publish is now done with codebreaker-lib-stable.yml
42+
# In case a preview version will be published again to NuGet, this can be uncommented.
4143
# publishnuget:
4244
# uses: CodebreakerApp/Codebreaker.Backend/.github/workflows/publishnuget-nugetserver.yml@main
4345
# needs: publishdevops

src/services/common/Codebreaker.GameAPIs.Analyzers.Tests/Codebreaker.GameAPIs.Analyzers.Tests.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

@@ -10,15 +10,15 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
14-
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
15-
<PackageReference Include="Moq" Version="4.20.70" />
16-
<PackageReference Include="xunit" Version="2.6.3" />
17-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
14+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
15+
<PackageReference Include="Moq" Version="4.20.72" />
16+
<PackageReference Include="xunit" Version="2.9.2" />
17+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1919
<PrivateAssets>all</PrivateAssets>
2020
</PackageReference>
21-
<PackageReference Include="coverlet.collector" Version="6.0.0">
21+
<PackageReference Include="coverlet.collector" Version="6.0.2">
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2323
<PrivateAssets>all</PrivateAssets>
2424
</PackageReference>

src/services/common/Codebreaker.GameAPIs.Analyzers/Analyzers/GameGuessAnalyzer.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
public abstract class GameGuessAnalyzer<TField, TResult>(IGame game, TField[] guesses, int moveNumber) : IGameGuessAnalyzer<TResult>
99
where TResult : struct
1010
{
11-
protected readonly IGame _game = game;
11+
private protected readonly IGame _game = game;
1212
private readonly int _moveNumber = moveNumber;
1313

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

3739
ValidateGuessValues();
3840

src/services/common/Codebreaker.GameAPIs.Analyzers/Codebreaker.Analyzers.csproj

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
<PropertyGroup>
44
<PackageId>CNinnovation.Codebreaker.Analyzers</PackageId>
5-
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
5+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
8-
<LangVersion>latest</LangVersion>
8+
<LangVersion>13.0</LangVersion>
99
<PackageTags>
1010
Codebreaker;CNinnovation;GameAnalyzers
1111
</PackageTags>
@@ -15,10 +15,7 @@
1515
</Description>
1616
<PackageReadmeFile>readme.md</PackageReadmeFile>
1717
<PackageIcon>codebreaker.jpeg</PackageIcon>
18-
</PropertyGroup>
19-
20-
<PropertyGroup>
21-
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">true</IsAotCompatible>
18+
<IsAotCompatible>true</IsAotCompatible>
2219
</PropertyGroup>
2320

2421
<ItemGroup>

src/services/common/Codebreaker.GameAPIs.Analyzers/Fields/ShapeAndColorField.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public partial record class ShapeAndColorField(string Shape, string Color)
44
{
5-
internal static ShapeAndColorField Empty => new ShapeAndColorField(string.Empty, string.Empty);
5+
internal static ShapeAndColorField Empty => new(string.Empty, string.Empty);
66

77
private const char Separator = ';';
88
public override string ToString() => $"{Shape}{Separator}{Color}";

src/services/common/Codebreaker.GameAPIs.Analyzers/Results/SimpleColorResult_ISpanParsable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, [Ma
3636
values[i] = (ResultValue)(s[j] - '0');
3737
}
3838
result = new SimpleColorResult(values);
39-
return s != default;
39+
return !s.IsEmpty;
4040
}
4141

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

0 commit comments

Comments
 (0)