Skip to content

Commit

Permalink
bump: Bump dotnet sdk version to net8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
s2quake committed Aug 1, 2024
1 parent f3c695b commit b3404fe
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 39 deletions.
51 changes: 28 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ commands:
- run:
command: "echo 'ulimit -n <<parameters.n>>' >> $BASH_ENV"

install_dotnet_sdk:
description: Install .NET SDK
parameters:
version: { type: string }
steps:
- run: |
set -evx
echo $PATH > /dev/stderr
if ! command -v dotnet && [[ ! -f "$HOME/.dotnet/dotnet" ]]; then
curl \
-L \
-o /tmp/dotnet-install.sh \
https://dot.net/v1/dotnet-install.sh
chmod +x /tmp/dotnet-install.sh
/tmp/dotnet-install.sh \
--verbose \
--channel <<parameters.version>>
fi
command -v dotnet
concat_files:
description: Concatenate file contents
parameters:
Expand Down Expand Up @@ -263,7 +283,7 @@ commands:
- ulimit: { n: 10240 }
- restore_cache:
keys:
- v1-macos-dotnet-sdk-6.0
- v1-macos-dotnet-sdk-8.0
- run:
name: Export PATH & DOTNET_ROOT
shell: bash
Expand All @@ -272,25 +292,8 @@ commands:
echo export PATH="$HOME/.dotnet:$PATH"
echo export DOTNET_ROOT="$HOME/.dotnet"
} >> $BASH_ENV
- run:
name: Install .NET 6.0 SDK
shell: bash
command: |
set -evx
echo $PATH > /dev/stderr
if ! command -v dotnet && [[ ! -f "$HOME/.dotnet/dotnet" ]]; then
curl \
-L \
-o /tmp/dotnet-install.sh \
https://dot.net/v1/dotnet-install.sh
chmod +x /tmp/dotnet-install.sh
/tmp/dotnet-install.sh \
--verbose \
--channel 6.0
fi
command -v dotnet
- save_cache:
key: v1-macos-dotnet-sdk-6.0
key: v1-macos-dotnet-sdk-8.0
paths:
- ~/.dotnet/
- netcore_test_base:
Expand Down Expand Up @@ -397,7 +400,7 @@ jobs:
type: string
default: ""
docker:
- image: mcr.microsoft.com/dotnet/sdk:6.0
- image: mcr.microsoft.com/dotnet/sdk:8.0
resource_class: xlarge
working_directory: /mnt/ramdisk
steps:
Expand All @@ -410,7 +413,7 @@ jobs:
type: integer
default: 4
docker:
- image: mcr.microsoft.com/dotnet/sdk:6.0
- image: mcr.microsoft.com/dotnet/sdk:8.0
environment:
TRANSPORT_TYPE: netmq
resource_class: xlarge
Expand All @@ -422,7 +425,7 @@ jobs:

linux-netcore-test-ar-SA:
docker:
- image: mcr.microsoft.com/dotnet/sdk:6.0
- image: mcr.microsoft.com/dotnet/sdk:8.0
resource_class: xlarge
working_directory: /mnt/ramdisk
parallelism: 4
Expand All @@ -433,7 +436,7 @@ jobs:

linux-netcore-test-fr-FR:
docker:
- image: mcr.microsoft.com/dotnet/sdk:6.0
- image: mcr.microsoft.com/dotnet/sdk:8.0
resource_class: xlarge
working_directory: /mnt/ramdisk
parallelism: 4
Expand All @@ -452,6 +455,8 @@ jobs:
resource_class: macos.m1.medium.gen1
parallelism: <<parameters.parallelism>>
steps:
- install_dotnet_sdk: { version: 6.0 }
- install_dotnet_sdk: { version: 8.0 }
- macos_netcore_test_base: { code_coverage: false }

windows-netcore-test:
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name": "C#: Libplanet Node",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/sdk/node/Libplanet.Node.Executable/bin/Debug/net6.0/Libplanet.Node.Executable.dll",
"program": "${workspaceFolder}/sdk/node/Libplanet.Node.Executable/bin/Debug/net8.0/Libplanet.Node.Executable.dll",
"console": "integratedTerminal",
"args": [
],
Expand Down
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"**/obj": true
},
"files.exclude": {
"**/bin": true,
"**/obj": true,
"**/.git": true,
"**/.svn": true,
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.0",
"version": "8.0.0",
"rollForward": "minor"
}
}
2 changes: 1 addition & 1 deletion hooks/check-projects
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if ! [[ -f "$SOLUTION" ]]; then
fi

list-projects() {
dotnet sln "$SOLUTION" list | grep -E $'\\...proj\r?$' | sed 's/[/][^/]*$//'
dotnet sln "$SOLUTION" list | grep -E $'(src|tools|test).+\\...proj\r?$' | sed 's/[/][^/]*$//'
}

# shellcheck source=.github/bin/constants.sh
Expand Down
12 changes: 12 additions & 0 deletions sdk/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,15 @@

# S3903: Types should be defined in named namespaces
dotnet_diagnostic.S3903.severity = none

# IDE0008: Use explicit type
dotnet_diagnostic.IDE0008.severity = none

# MEN016: Avoid top-level statements
dotnet_diagnostic.MEN016.severity = none

[**/obj/**/*.cs]

# CS8981: The type name only contains lower-cased ascii characters
dotnet_diagnostic.CS8981.severity = none

31 changes: 31 additions & 0 deletions sdk/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,41 @@
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />

<PropertyGroup>
<TargetFrameworks Condition="'$(_IsPacking)'=='true'">net8.0</TargetFrameworks>
<TargetFramework Condition="'$(_IsPacking)'!='true'">net8.0</TargetFramework>
<LangVersion>12</LangVersion>
<IsPackable>true</IsPackable>
<IsTestProject>false</IsTestProject>
<Title>$(ProjectName)</Title>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Remove="StyleCop.Analyzers" />
<PackageReference Remove="Menees.Analyzers.2017" />
<PackageReference Remove="Microsoft.DotNet.Analyzers.Compatibility" />
<PackageReference Remove="SonarAnalyzer.CSharp" />

<AdditionalFiles Remove="stylecop.json" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>
runtime; build; native; contentfiles; analyzers
</IncludeAssets>
</PackageReference>
<PackageReference Include="Menees.Analyzers" Version="3.2.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.27.0.93347">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>

<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions sdk/node/Libplanet.Node.Executable/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["sdk/node/Libplanet.Node.API/Libplanet.Node.API.csproj", "sdk/node/Libplanet.Node.API/"]
Expand Down
13 changes: 8 additions & 5 deletions sdk/node/Libplanet.Node.Executable/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
}

// Additional configuration is required to successfully run gRPC on macOS.
// For instructions on how to configure Kestrel and gRPC clients on macOS, visit https://go.microsoft.com/fwlink/?linkid=2099682
// For instructions on how to configure Kestrel and gRPC clients on macOS,
// visit https://go.microsoft.com/fwlink/?linkid=2099682

// Add services to the container.
builder.Services.AddGrpc();
Expand All @@ -26,16 +27,18 @@
.WithSolo();

var app = builder.Build();
var handlerMessage = """
Communication with gRPC endpoints must be made through a gRPC client. To learn how to
create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909
""";

// Configure the HTTP request pipeline.
app.MapGrpcService<GreeterService>();
app.MapGet("/",
() =>
"Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");
app.MapGet("/", () => handlerMessage);

if (builder.Environment.IsDevelopment())
{
app.MapGrpcReflectionService().AllowAnonymous();
}

app.Run();
await app.RunAsync();
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"profiles": {
"Libplanet.Node.API": {
"commandName": "Project",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public GreeterService(ILogger<GreeterService> logger, IReadChainService blockCha

public override Task<HelloReply> SayHello(HelloRequest request, ServerCallContext context)
{
_logger.LogDebug("Saying hello to {Name}", request.Name);
return Task.FromResult(new HelloReply
{
Message = "Hello " + request.Name,
Expand Down
5 changes: 2 additions & 3 deletions sdk/node/Libplanet.Node/Services/SoloProposeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public SoloProposeService(
_blockInterval);
}


protected async override Task ExecuteAsync(CancellationToken stoppingToken)
{
using PeriodicTimer timer = new PeriodicTimer(_blockInterval);
Expand All @@ -44,9 +43,9 @@ protected async override Task ExecuteAsync(CancellationToken stoppingToken)
await ProposeBlockAsync(stoppingToken);
}
}
catch (OperationCanceledException)
catch (OperationCanceledException e)
{
_logger.LogInformation("Timed Hosted Service is stopping.");
_logger.LogInformation(e, "Timed Hosted Service is stopping.");
}
}

Expand Down
8 changes: 8 additions & 0 deletions sdk/stylecop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
"settings": {
"orderingRules": {
"usingDirectivesPlacement": "outsideNamespace"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>$(NoWarn);CS1591;S1118;SA1118</NoWarn>
<NoWarn>$(NoWarn);CS1591;S1118;SA1118;NU1903</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit b3404fe

Please sign in to comment.