Skip to content

Commit 4ad29fb

Browse files
Upgrade to .NET 10 (#310)
* Migrate to new solution format * Upgrade .NET 10 Docker image * Update README instructions * Upgrade package and target framework to .NET 10 * Upgrade dockerfile * Inline code * Fix expected tags
1 parent b1eb7b0 commit 4ad29fb

File tree

7 files changed

+20
-51
lines changed

7 files changed

+20
-51
lines changed

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine3.20-amd64 AS build
1+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0.103-alpine3.23 AS build
2+
ARG TARGETARCH
3+
24
WORKDIR /app
35

46
# Copy csproj and restore as distinct layer
57
COPY src/Exercism.Analyzers.CSharp/Exercism.Analyzers.CSharp.csproj .
6-
RUN dotnet restore -r linux-musl-x64
8+
RUN dotnet restore -a $TARGETARCH
79

810
# Copy everything else and build
911
COPY src/Exercism.Analyzers.CSharp .
10-
RUN dotnet publish -r linux-musl-x64 -c Release --self-contained true -o /opt/analyzer
12+
RUN dotnet publish -a $TARGETARCH --no-restore --self-contained true --output /opt/analyzer
1113

1214
# Build runtime image
13-
FROM mcr.microsoft.com/dotnet/runtime-deps:9.0-alpine3.20-amd64 AS runtime
15+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/runtime-deps:10.0.3-alpine3.23 AS runtime
1416
WORKDIR /opt/analyzer
1517

1618
COPY --from=build /opt/analyzer/ .

Excercism.Analyzers.CSharp.sln

Lines changed: 0 additions & 27 deletions
This file was deleted.

Excercism.Analyzers.CSharp.slnx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Solution>
2+
<Folder Name="/src/">
3+
<Project Path="src/Exercism.Analyzers.CSharp/Exercism.Analyzers.CSharp.csproj" />
4+
</Folder>
5+
</Solution>

README.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,15 @@ The C# analyzer implements the [analyzer interface][analyzer-interface]. It uses
99
To analyze a solution, follow these steps:
1010

1111
1. Open a command prompt in the root directory.
12-
1. Run `./analyze.ps1 <exercise> <directory>`. This script will run the analyzer on the specified directory.
12+
1. Run `./bin/run.sh <exercise> <directory>`. This script will run the analyzer on the specified directory.
1313
1. Once the script has completed, the analysis results will be written to `<directory>/analysis.json`.
1414

15-
## Analyzing multiple solutions
16-
17-
To analyze multiple solutions at once, follow these steps:
18-
19-
1. Open a command prompt in the root directory.
20-
1. Run `./bulk-analyze.ps1 <exercise> <directory>`. This script will run the analyzer on each directory sub-directory of `<directory>`.
21-
1. Once the script has completed, it will:
22-
1. Output general staticics to the console.
23-
1. Write detailed analysis results to `<directory>/bulk_analysis.json`.
24-
2515
## Analyzing a solution using Docker
2616

2717
To analyze a solution using a Docker container, follow these steps:
2818

2919
1. Open a command prompt in the root directory.
30-
1. Run `./run-in-docker.ps1 <exercise> <directory>`. This script will:
20+
1. Run `./bin/run-in-docker.sh <exercise> <directory>`. This script will:
3121
1. Build the analyzer Docker image (if necessary).
3222
1. Run the analyzer Docker image (as a container), passing the specified `exercise` and `directory` arguments.
3323
1. Once the script has completed, the analysis result can be found at `<directory>/analysis.json`.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<OutputType>Exe</OutputType>
66
<PublishReadyToRun>true</PublishReadyToRun>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0"/>
10+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
1111
</ItemGroup>
1212

1313
</Project>

src/Exercism.Analyzers.CSharp/Program.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ public static async Task Main(string[] args)
1111
{
1212
var options = new Options(args[0], args[1], args[2]);
1313

14-
await RunAnalysis(options);
15-
}
16-
17-
private static async Task RunAnalysis(Options options)
18-
{
1914
Console.WriteLine($"Analyzing {options.Slug} solution in directory {options.InputDirectory}");
2015

2116
var solution = await Loader.Load(options);

tests/yacht/approaches/linq/expected_tags.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
"technique:boolean-logic",
3333
"technique:exceptions",
3434
"technique:higher-order-functions",
35-
"technique:short-circuiting"
35+
"technique:immutability",
36+
"technique:memory-management",
37+
"technique:performance",
38+
"technique:short-circuiting",
39+
"uses:Span<T>"
3640
]
3741
}

0 commit comments

Comments
 (0)