From 78b52a89f35863a343b9a7d5ef3fc5f1cf797cd6 Mon Sep 17 00:00:00 2001
From: Benjamin Hodgson <3857587+benjamin-hodgson@users.noreply.github.com>
Date: Thu, 16 Nov 2023 21:13:55 +0000
Subject: [PATCH] build with net8
---
.devcontainer/devcontainer.json | 2 +-
.github/workflows/build.yml | 1 +
Directory.Build.props | 1 +
Directory.Packages.props | 19 ++++++++++---------
.../Eighty.AspNetCore.TestApp.csproj | 2 ++
.../Views/Bench/EightyRenderer.cs | 5 +----
Eighty.Bench/Eighty.Bench.csproj | 2 ++
Eighty.Bench/SimpleBench.cs | 4 +++-
Eighty.BuildTool.props | 8 +++++---
Eighty.Tests/Eighty.Tests.csproj | 2 ++
Eighty.Tests/HtmlAsyncTests.cs | 2 ++
Eighty.Tests/HtmlTests.cs | 2 ++
dotnet-tools.json | 4 ++--
global.json | 3 +--
14 files changed, 35 insertions(+), 22 deletions(-)
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index d78cd87..1a0b936 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,3 +1,3 @@
{
- "image": "mcr.microsoft.com/devcontainers/dotnet:7.0"
+ "image": "mcr.microsoft.com/devcontainers/dotnet:dev-8.0"
}
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ecd6a24..14d0678 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -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 }}
diff --git a/Directory.Build.props b/Directory.Build.props
index e9a7f47..c26df97 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -13,6 +13,7 @@
$(MSBuildThisFileDirectory)Eighty.snk
true
+ true
enable
diff --git a/Directory.Packages.props b/Directory.Packages.props
index c06ea07..91481e1 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -1,22 +1,23 @@
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
+
+
+
diff --git a/Eighty.AspNetCore.TestApp/Eighty.AspNetCore.TestApp.csproj b/Eighty.AspNetCore.TestApp/Eighty.AspNetCore.TestApp.csproj
index 87f45ff..d898255 100644
--- a/Eighty.AspNetCore.TestApp/Eighty.AspNetCore.TestApp.csproj
+++ b/Eighty.AspNetCore.TestApp/Eighty.AspNetCore.TestApp.csproj
@@ -1,8 +1,10 @@
+
+
diff --git a/Eighty.AspNetCore.TestApp/Views/Bench/EightyRenderer.cs b/Eighty.AspNetCore.TestApp/Views/Bench/EightyRenderer.cs
index 565bfe2..8689b10 100644
--- a/Eighty.AspNetCore.TestApp/Views/Bench/EightyRenderer.cs
+++ b/Eighty.AspNetCore.TestApp/Views/Bench/EightyRenderer.cs
@@ -11,10 +11,7 @@ public class EightyRenderer : IHtmlRenderer
{
public Html Render(BenchModel model)
{
- if (model == null)
- {
- throw new ArgumentNullException(nameof(model));
- }
+ ArgumentNullException.ThrowIfNull(model);
var builder = ImmutableArray.CreateBuilder(model.Iterations);
for (var i = 0; i < model.Iterations; i++)
diff --git a/Eighty.Bench/Eighty.Bench.csproj b/Eighty.Bench/Eighty.Bench.csproj
index 1323e9d..a5f8c31 100644
--- a/Eighty.Bench/Eighty.Bench.csproj
+++ b/Eighty.Bench/Eighty.Bench.csproj
@@ -1,4 +1,5 @@
+
@@ -16,4 +17,5 @@
+
diff --git a/Eighty.Bench/SimpleBench.cs b/Eighty.Bench/SimpleBench.cs
index ae29086..4638894 100644
--- a/Eighty.Bench/SimpleBench.cs
+++ b/Eighty.Bench/SimpleBench.cs
@@ -95,6 +95,7 @@ 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()
@@ -102,6 +103,7 @@ 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]
@@ -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));
diff --git a/Eighty.BuildTool.props b/Eighty.BuildTool.props
index 48cb781..9149cef 100644
--- a/Eighty.BuildTool.props
+++ b/Eighty.BuildTool.props
@@ -1,8 +1,10 @@
+
false
- net7.0
- major
- $(NoWarn);SA0001;CS1591
+ net8.0
+ $(NoWarn);SA0001
+ $(NoWarn);CS1591
+
diff --git a/Eighty.Tests/Eighty.Tests.csproj b/Eighty.Tests/Eighty.Tests.csproj
index 08fc103..8160a22 100644
--- a/Eighty.Tests/Eighty.Tests.csproj
+++ b/Eighty.Tests/Eighty.Tests.csproj
@@ -1,4 +1,5 @@
+
@@ -20,4 +21,5 @@
+
diff --git a/Eighty.Tests/HtmlAsyncTests.cs b/Eighty.Tests/HtmlAsyncTests.cs
index e3fcb8f..0cd4195 100644
--- a/Eighty.Tests/HtmlAsyncTests.cs
+++ b/Eighty.Tests/HtmlAsyncTests.cs
@@ -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' });
@@ -100,6 +101,7 @@ public async Task Text_BadSurrogatePair()
H html = new string(new[] { '\xdc1c', '\xd83c', '\xdc1c' });
Assert.Equal("\uFFFD🀜", 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]
diff --git a/Eighty.Tests/HtmlTests.cs b/Eighty.Tests/HtmlTests.cs
index d7e32d4..9e4272b 100644
--- a/Eighty.Tests/HtmlTests.cs
+++ b/Eighty.Tests/HtmlTests.cs
@@ -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' });
@@ -97,6 +98,7 @@ public void Text_BadSurrogatePair()
H html = new string(new[] { '\xdc1c', '\xd83c', '\xdc1c' });
Assert.Equal("\uFFFD🀜", 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]
diff --git a/dotnet-tools.json b/dotnet-tools.json
index 9bccf81..bc40a9e 100644
--- a/dotnet-tools.json
+++ b/dotnet-tools.json
@@ -3,10 +3,10 @@
"isRoot": true,
"tools": {
"docfx": {
- "version": "2.70.3",
+ "version": "2.73.2",
"commands": [
"docfx"
]
}
}
-}
\ No newline at end of file
+}
diff --git a/global.json b/global.json
index 38817c8..ea05896 100644
--- a/global.json
+++ b/global.json
@@ -1,7 +1,6 @@
{
"sdk": {
- "version": "7.0.100",
- "rollForward": "latestMajor"
+ "version": "8.0.100"
},
"msbuild-sdks": {
"Microsoft.Build.NoTargets": "3.7.0"