Skip to content

Commit

Permalink
Merge pull request planetarium#3900 from s2quake/exp/sdk/net8
Browse files Browse the repository at this point in the history
Bump dotnet to 8 in Libplanet SDK
  • Loading branch information
riemannulus authored Aug 5, 2024
2 parents f3c695b + a2f3484 commit 7e26f3a
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 30 deletions.
28 changes: 14 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ commands:
keys:
- v1-deps-{{ arch }}-{{ checksum ".combined-package-files.txt" }}
- v1-deps-{{ arch }}
- run:
name: Install .NET 8.0 SDK for Libplanet-SDK
shell: bash
command: |
curl -sSL https://dot.net/v1/dotnet-install.sh | \
bash /dev/stdin --channel 8.0 --install-dir /usr/share/dotnet
- run: dotnet restore
- save_cache:
key: v1-deps-{{ arch }}-{{ checksum ".combined-package-files.txt" }}
Expand Down Expand Up @@ -243,6 +249,12 @@ commands:
name: Install lib6c-dev (for RocksDBSharp)
shell: bash
command: apt update -y && apt install -y libc6-dev liblz4-dev zlib1g-dev libsnappy-dev libzstd-dev
- run:
name: Install .NET 8.0 SDK for Libplanet-SDK
shell: bash
command: |
curl -sSL https://dot.net/v1/dotnet-install.sh | \
bash /dev/stdin --channel 8.0 --install-dir /usr/share/dotnet
- netcore_test_base:
collect_tests_from: "<<parameters.collect_tests_from>>"
locale: "<<parameters.locale>>"
Expand Down Expand Up @@ -273,22 +285,10 @@ commands:
echo export DOTNET_ROOT="$HOME/.dotnet"
} >> $BASH_ENV
- run:
name: Install .NET 6.0 SDK
name: Install .NET 8.0 SDK for Libplanet-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
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 8.0
- save_cache:
key: v1-macos-dotnet-sdk-6.0
paths:
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 7e26f3a

Please sign in to comment.