Skip to content

Commit

Permalink
Merge pull request #176 from leancodepl/upgrade-to-net9
Browse files Browse the repository at this point in the history
Update everything to .NET 9
  • Loading branch information
jakubfijalkowski authored Dec 5, 2024
2 parents f8777e2 + 840db27 commit c1f6ed7
Show file tree
Hide file tree
Showing 26 changed files with 881 additions and 131 deletions.
2 changes: 1 addition & 1 deletion FinalizeTemplate.proj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<Target Name="FormatBackendCode">
<Exec Command="dotnet tool restore" WorkingDirectory="$(MSBuildThisFileDirectory)backend" />
<Exec Command="dotnet tool run dotnet-format ." WorkingDirectory="$(MSBuildThisFileDirectory)backend" />
<Exec Command="dotnet format ." WorkingDirectory="$(MSBuildThisFileDirectory)backend" />
<Exec Command="dotnet tool run dotnet-csharpier ." WorkingDirectory="$(MSBuildThisFileDirectory)backend" />
</Target>

Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
leancode.builder('exampleapp-template')
.withMonorepoTest(['backend', 'dev-cluster', 'infrastructure', '.template.config', 'FinalizeTemplate.proj', 'Jenkinsfile.template'])
.withDotnet([version: '8.0', image: 'mcr.microsoft.com/dotnet/sdk'])
.withDotnet([version: '9.0', image: 'mcr.microsoft.com/dotnet/sdk'])
.runOnSpot()
.run {

Expand Down
19 changes: 8 additions & 11 deletions backend/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,25 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.29.2",
"version": "0.30.2",
"commands": [
"dotnet-csharpier"
]
],
"rollForward": false
},
"dotnet-ef": {
"version": "8.0.8",
"version": "9.0.0",
"commands": [
"dotnet-ef"
]
},
"dotnet-format": {
"version": "5.1.250801",
"commands": [
"dotnet-format"
]
],
"rollForward": false
},
"dotnet-contracts-generate": {
"version": "3.0.0",
"commands": [
"dotnet-contracts-generate"
]
],
"rollForward": false
}
}
}
2 changes: 1 addition & 1 deletion backend/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PropertyGroup>
<PackageId>$(AssemblyName)</PackageId>
<RootNamespace>$(AssemblyName)</RootNamespace>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
Expand Down
67 changes: 34 additions & 33 deletions backend/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>

<CoreLibVersion>8.1.2527</CoreLibVersion>
<ExtensionsVersion>8.0.1</ExtensionsVersion>
<EFCoreVersion>8.0.8</EFCoreVersion>
<AspNetCoreVersion>8.0.8</AspNetCoreVersion>
<MassTransitVersion>8.2.5</MassTransitVersion>
<NpgsqlVersion>8.0.3</NpgsqlVersion>
<NpgsqlEFCoreVersion>8.0.4</NpgsqlEFCoreVersion>
<LeanPipeVersion>0.2.5</LeanPipeVersion>
<AppRatingVersion>1.0.46</AppRatingVersion>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>

<CoreLibVersion>9.0.2542-preview</CoreLibVersion>
<ExtensionsVersion>9.0.0</ExtensionsVersion>
<EFCoreVersion>9.0.0</EFCoreVersion>
<AspNetCoreVersion>9.0.0</AspNetCoreVersion>
<MassTransitVersion>8.3.2</MassTransitVersion>
<NpgsqlVersion>9.0.1</NpgsqlVersion>
<NpgsqlEFCoreVersion>9.0.1</NpgsqlEFCoreVersion>
<LeanPipeVersion>0.3.0</LeanPipeVersion>
<AppRatingVersion>2.0.52</AppRatingVersion>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -62,23 +63,23 @@
<PackageVersion Include="Azure.Extensions.AspNetCore.DataProtection.Blobs" Version="1.3.4" />
<PackageVersion Include="Azure.Extensions.AspNetCore.DataProtection.Keys" Version="1.2.4" />

<PackageVersion Include="Azure.Storage.Blobs" Version="12.22.1" />
<PackageVersion Include="Azure.Storage.Blobs" Version="12.23.0" />

<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="$(EFCoreVersion)" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="$(EFCoreVersion)" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(EFCoreVersion)" />

<PackageVersion Include="Microsoft.Extensions.Azure" Version="1.7.6" />
<PackageVersion Include="Microsoft.Extensions.Azure" Version="1.9.0" />

<PackageVersion Include="Microsoft.Extensions.Configuration" Version="$(ExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="$(ExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="$(ExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(ExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="$(ExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(ExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="$(AspNetCoreVersion)" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="$(ExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="$(ExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(ExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="$(ExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="$(ExtensionsVersion)" />
Expand All @@ -96,44 +97,44 @@
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(NpgsqlEFCoreVersion)" />
<PackageVersion Include="Npgsql.OpenTelemetry" Version="$(NpgsqlVersion)" />

<PackageVersion Include="OpenTelemetry" Version="1.9.0" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.10.0" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.10.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.10.0" />

<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.1.1" />
<PackageVersion Include="Microsoft.IdentityModel.Tokens" Version="8.1.1" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.2.1" />
<PackageVersion Include="Microsoft.IdentityModel.Tokens" Version="8.2.1" />
</ItemGroup>

<ItemGroup>
<PackageVersion Include="Dapper" Version="2.1.35" />
<PackageVersion Include="LeanCode.Pipe" Version="$(LeanPipeVersion)" />
<PackageVersion Include="Polly" Version="8.4.2" />
</ItemGroup>

<ItemGroup>
<PackageVersion Include="FluentAssertions" Version="6.12.1" />
<PackageVersion Include="FluentAssertions" Version="7.0.0" />
<PackageVersion Include="LeanCode.Pipe.TestClient" Version="$(LeanPipeVersion)" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="NSubstitute" Version="5.1.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.analyzers" Version="1.16.0" />
<PackageVersion Include="xunit.analyzers" Version="1.17.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>

<ItemGroup>
<PackageVersion Include="Serilog" Version="4.0.2" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageVersion Include="Serilog.Sinks.Seq" Version="8.0.0" />
<PackageVersion Include="Serilog.Formatting.Compact" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
<GlobalPackageReference Include="LeanCode.CodeAnalysis" Version="$(CoreLibVersion)" />
<GlobalPackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.4" />
<GlobalPackageReference Include="SerilogAnalyzer" Version="0.15.0" />
</ItemGroup>

<!-- These are overrides of transitive dependencies to either fix broken deps or fix security vulns -->
<ItemGroup>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.11.0" />
<PackageVersion Include="System.Formats.Asn1" Version="9.0.0" />
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion backend/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def dbPassword = 'Passw12#'
leancode.builder('exampleapp-backend')
.withMonorepoTest(['backend'])
.withBuildKit()
.withDotnet([version: '8.0', image: 'mcr.microsoft.com/dotnet/sdk'])
.withDotnet([version: '9.0', image: 'mcr.microsoft.com/dotnet/sdk'])
.withDefaultContainer(
name: 'postgres',
image: 'postgres',
Expand Down
2 changes: 1 addition & 1 deletion backend/dev/Dockerfile.api
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0
FROM mcr.microsoft.com/dotnet/sdk:9.0

USER root

Expand Down
2 changes: 1 addition & 1 deletion backend/dev/Dockerfile.integration_tests
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0
FROM mcr.microsoft.com/dotnet/sdk:9.0

USER root

Expand Down
2 changes: 1 addition & 1 deletion backend/dev/Dockerfile.leanpipe_funnel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0
FROM mcr.microsoft.com/dotnet/sdk:9.0

USER root

Expand Down
2 changes: 1 addition & 1 deletion backend/dev/Dockerfile.migrations
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0
FROM mcr.microsoft.com/dotnet/aspnet:9.0

USER $APP_UID

Expand Down
2 changes: 1 addition & 1 deletion backend/dev/Dockerfile.tests
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0
FROM mcr.microsoft.com/dotnet/sdk:9.0

USER root

Expand Down
2 changes: 1 addition & 1 deletion backend/release/Dockerfile.api
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0
FROM mcr.microsoft.com/dotnet/aspnet:9.0

USER $APP_UID

Expand Down
2 changes: 1 addition & 1 deletion backend/release/Dockerfile.migrations
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0
FROM mcr.microsoft.com/dotnet/aspnet:9.0

USER $APP_UID

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ public ExamplesDbContext(DbContextOptions<ExamplesDbContext> options)

protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
//-:cnd:noEmit
#if CHECK_EFCORE_PG_2977
#error Check if this workaround is still required.
#else
// workaround for https://github.com/npgsql/efcore.pg/issues/2977
configurationBuilder.Properties<JsonElement?>().HaveColumnType("jsonb");
#endif
//+:cnd:noEmit

#if Example
ConfigureExampleAppConventions(configurationBuilder);
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable
Expand Down
Loading

0 comments on commit c1f6ed7

Please sign in to comment.