Skip to content

Commit

Permalink
build with net8
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamin-hodgson committed Nov 16, 2023
1 parent 00b6894 commit 78b52a8
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"image": "mcr.microsoft.com/devcontainers/dotnet:7.0"
"image": "mcr.microsoft.com/devcontainers/dotnet:dev-8.0"
}
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ jobs:
uses: benjamin-hodgson/BuildScripts/.github/workflows/dotnet.yml@main
with:
DOCS_FOLDER: Eighty.Docs
NET8: true
secrets:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)Eighty.snk</AssemblyOriginatorKeyFile>

<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<UseArtifactsOutput>true</UseArtifactsOutput>

<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
19 changes: 10 additions & 9 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<Project>

<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.13.1" />
<PackageVersion Include="coverlet.collector" Version="1.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="6.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageVersion Include="BenchmarkDotNet" Version="0.13.10" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="System.Buffers" Version="4.5.1" />
<PackageVersion Include="System.Memory" Version="4.5.5" />
<PackageVersion Include="System.Collections.Immutable" Version="1.2.0" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.3" />
<PackageVersion Include="System.Text.Encodings.Web" Version="4.5.1" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.4.0" />
<PackageVersion Include="xunit" Version="2.4.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageVersion Include="xunit" Version="2.6.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>

<ItemGroup>
<GlobalPackageReference Include="Benjamin.Pizza.BuildScripts" Version="2.2.2" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" />
<GlobalPackageReference Include="Benjamin.Pizza.BuildScripts" Version="2.2.4" />
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions Eighty.AspNetCore.TestApp/Eighty.AspNetCore.TestApp.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<Import Project="../Eighty.BuildTool.props" />

<ItemGroup>
<ProjectReference Include="..\Eighty\Eighty.csproj" />
<ProjectReference Include="..\Eighty.AspNetCore\Eighty.AspNetCore.csproj" />
</ItemGroup>

</Project>
5 changes: 1 addition & 4 deletions Eighty.AspNetCore.TestApp/Views/Bench/EightyRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ public class EightyRenderer : IHtmlRenderer<BenchModel>
{
public Html Render(BenchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
ArgumentNullException.ThrowIfNull(model);

var builder = ImmutableArray.CreateBuilder<Html>(model.Iterations);
for (var i = 0; i < model.Iterations; i++)
Expand Down
2 changes: 2 additions & 0 deletions Eighty.Bench/Eighty.Bench.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../Eighty.BuildTool.props" />

<PropertyGroup>
Expand All @@ -16,4 +17,5 @@
<ProjectReference Include="..\Eighty\Eighty.csproj" />
<ProjectReference Include="..\Eighty.AspNetCore.TestApp\Eighty.AspNetCore.TestApp.csproj" />
</ItemGroup>

</Project>
4 changes: 3 additions & 1 deletion Eighty.Bench/SimpleBench.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,15 @@ public void Flat_Twenty()
_flatPsTwenty!.Write(writer);
}

#pragma warning disable CA1822 // "Member does not access instance data and can be marked as static"
[BenchmarkCategory("Deep")]
[Benchmark(Baseline = true)]
public void Deep_Eighty_BuildAndRender()
{
using var writer = new StreamWriter("output.html");
DeepPs(1000).Write(writer);
}
#pragma warning restore CA1822 // "Member does not access instance data and can be marked as static"

[BenchmarkCategory("Deep")]
[Benchmark]
Expand All @@ -127,7 +129,7 @@ public void Deep_Twenty()
_deepPsTwenty!.Write(writer);
}

private Html DeepPs(int lvl)
private static Html DeepPs(int lvl)
=> lvl == 0
? Text("")
: p(@class: "para<>")._(DeepPs(lvl - 1));
Expand Down
8 changes: 5 additions & 3 deletions Eighty.BuildTool.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<Project>

<PropertyGroup>
<IsPackable>false</IsPackable>
<TargetFramework>net7.0</TargetFramework>
<RollForward>major</RollForward>
<NoWarn>$(NoWarn);SA0001;CS1591</NoWarn>
<TargetFramework>net8.0</TargetFramework>
<NoWarn>$(NoWarn);SA0001</NoWarn>
<NoWarn>$(NoWarn);CS1591</NoWarn> <!-- "Missing XML comment for publicly visible type or member" -->
</PropertyGroup>

</Project>
2 changes: 2 additions & 0 deletions Eighty.Tests/Eighty.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../Eighty.BuildTool.props" />

<PropertyGroup>
Expand All @@ -20,4 +21,5 @@
<ProjectReference Include="..\Eighty.AspNetCore\Eighty.AspNetCore.csproj" />
<ProjectReference Include="..\Eighty.AspNetCore.TestApp\Eighty.AspNetCore.TestApp.csproj" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions Eighty.Tests/HtmlAsyncTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public async Task TextEscaping_Unicode()
[Fact]
public async Task Text_BadSurrogatePair()
{
#pragma warning disable CA1861 // "Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array"
{
// a low surrogate on its own
H html = new string(new[] { '\xdc1c' });
Expand All @@ -100,6 +101,7 @@ public async Task Text_BadSurrogatePair()
H html = new string(new[] { '\xdc1c', '\xd83c', '\xdc1c' });
Assert.Equal("\uFFFD&#x1F01C;", await GetStringAsync(html));
}
#pragma warning restore CA1861 // "Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array"
}

[Fact]
Expand Down
2 changes: 2 additions & 0 deletions Eighty.Tests/HtmlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public void TextEscaping_Unicode()
[Fact]
public void Text_BadSurrogatePair()
{
#pragma warning disable CA1861 // "Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array"
{
// a low surrogate on its own
H html = new string(new[] { '\xdc1c' });
Expand All @@ -97,6 +98,7 @@ public void Text_BadSurrogatePair()
H html = new string(new[] { '\xdc1c', '\xd83c', '\xdc1c' });
Assert.Equal("\uFFFD&#x1F01C;", html.ToString());
}
#pragma warning restore CA1861 // "Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array"
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"isRoot": true,
"tools": {
"docfx": {
"version": "2.70.3",
"version": "2.73.2",
"commands": [
"docfx"
]
}
}
}
}
3 changes: 1 addition & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"sdk": {
"version": "7.0.100",
"rollForward": "latestMajor"
"version": "8.0.100"
},
"msbuild-sdks": {
"Microsoft.Build.NoTargets": "3.7.0"
Expand Down

0 comments on commit 78b52a8

Please sign in to comment.