From 14d2acdf5f1440c279736f377af6d80afec0ee24 Mon Sep 17 00:00:00 2001 From: Marko Lahma Date: Thu, 27 Nov 2025 20:19:27 +0200 Subject: [PATCH] Use NET 10 SDK and upgrade to NUKE 10 --- .github/workflows/ci.yml | 10 +- .github/workflows/publish.yml | 5 +- .nuke/build.schema.json | 191 +++++++++--------- Directory.Packages.props | 4 +- .../nuke-build/Build.Documentation.cs | 8 +- build-support/nuke-build/Build.cs | 4 +- build-support/nuke-build/_build.csproj | 2 +- global.json | 2 +- .../Expressions/PropertyOrFieldNode.cs | 28 +-- .../Factory/Config/DependencyDescriptor.cs | 74 ++++--- src/Spring/Spring.Core/Spring.Core.csproj | 5 - 11 files changed, 165 insertions(+), 168 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6343fa8c1..b56195cdb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,14 +20,20 @@ jobs: build-windows: runs-on: windows-latest steps: - - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v5 + with: + dotnet-version: 10.0 + - uses: actions/checkout@v5 - name: Run './build.cmd ci' run: ./build.cmd ci build-linux: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v5 + with: + dotnet-version: 10.0 + - uses: actions/checkout@v5 - name: Run './build.cmd ci' run: ./build.sh ci diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1286816e9..5085eb001 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,10 @@ jobs: publish: runs-on: windows-latest steps: - - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v5 + with: + dotnet-version: 10.0 + - uses: actions/checkout@v5 - name: Publish run: ./build.cmd test publish env: diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 39fa67468..6c323a9c0 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -1,23 +1,58 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "#/definitions/build", - "title": "Build Schema", "definitions": { - "build": { - "type": "object", + "Host": { + "type": "string", + "enum": [ + "AppVeyor", + "AzurePipelines", + "Bamboo", + "Bitbucket", + "Bitrise", + "GitHubActions", + "GitLab", + "Jenkins", + "Rider", + "SpaceAutomation", + "TeamCity", + "Terminal", + "TravisCI", + "VisualStudio", + "VSCode" + ] + }, + "ExecutableTarget": { + "type": "string", + "enum": [ + "Antlr", + "Ci", + "Clean", + "Compile", + "CompileExamples", + "CompileSolution", + "Docs", + "DocsReference", + "DocsSdk", + "Pack", + "PackBinaries", + "Publish", + "Restore", + "Test", + "Website" + ] + }, + "Verbosity": { + "type": "string", + "description": "", + "enum": [ + "Verbose", + "Normal", + "Minimal", + "Quiet" + ] + }, + "NukeBuild": { "properties": { - "BuildEms": { - "type": "boolean", - "description": "Build EMS" - }, - "Configuration": { - "type": "string", - "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)", - "enum": [ - "Debug", - "Release" - ] - }, "Continue": { "type": "boolean", "description": "Indicates to continue a previously failed build attempt" @@ -27,37 +62,13 @@ "description": "Shows the help text for this build assembly" }, "Host": { - "type": "string", "description": "Host for execution. Default is 'automatic'", - "enum": [ - "AppVeyor", - "AzurePipelines", - "Bamboo", - "Bitbucket", - "Bitrise", - "GitHubActions", - "GitLab", - "Jenkins", - "Rider", - "SpaceAutomation", - "TeamCity", - "Terminal", - "TravisCI", - "VisualStudio", - "VSCode" - ] + "$ref": "#/definitions/Host" }, "NoLogo": { "type": "boolean", "description": "Disables displaying the NUKE logo" }, - "NuGetApiKey": { - "type": "string", - "default": "Secrets must be entered via 'nuke :secrets [profile]'" - }, - "NuGetSource": { - "type": "string" - }, "Partition": { "type": "string", "description": "Partition to use on CI" @@ -73,10 +84,6 @@ "type": "string" } }, - "ProjectVersion": { - "type": "string", - "description": "Version" - }, "Root": { "type": "string", "description": "Root directory during build execution" @@ -85,54 +92,53 @@ "type": "array", "description": "List of targets to be skipped. Empty list skips all dependencies", "items": { - "type": "string", - "enum": [ - "Antlr", - "Ci", - "Clean", - "Compile", - "CompileExamples", - "CompileSolution", - "Docs", - "DocsReference", - "DocsSdk", - "Pack", - "PackBinaries", - "Publish", - "Restore", - "Test", - "Website" - ] + "$ref": "#/definitions/ExecutableTarget" } }, - "Solution": { - "type": "string", - "description": "Path to a solution file that is automatically loaded" - }, "Target": { "type": "array", "description": "List of targets to be invoked. Default is '{default_target}'", "items": { - "type": "string", - "enum": [ - "Antlr", - "Ci", - "Clean", - "Compile", - "CompileExamples", - "CompileSolution", - "Docs", - "DocsReference", - "DocsSdk", - "Pack", - "PackBinaries", - "Publish", - "Restore", - "Test", - "Website" - ] + "$ref": "#/definitions/ExecutableTarget" } }, + "Verbosity": { + "description": "Logging verbosity during build execution. Default is 'Normal'", + "$ref": "#/definitions/Verbosity" + } + } + } + }, + "allOf": [ + { + "properties": { + "BuildEms": { + "type": "boolean", + "description": "Build EMS" + }, + "Configuration": { + "type": "string", + "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)", + "enum": [ + "Debug", + "Release" + ] + }, + "NuGetApiKey": { + "type": "string", + "default": "Secrets must be entered via 'nuke :secrets [profile]'" + }, + "NuGetSource": { + "type": "string" + }, + "ProjectVersion": { + "type": "string", + "description": "Version" + }, + "Solution": { + "type": "string", + "description": "Path to a solution file that is automatically loaded" + }, "TestFull": { "type": "boolean" }, @@ -147,18 +153,11 @@ }, "TestIntegrationNms": { "type": "boolean" - }, - "Verbosity": { - "type": "string", - "description": "Logging verbosity during build execution. Default is 'Normal'", - "enum": [ - "Minimal", - "Normal", - "Quiet", - "Verbose" - ] } } + }, + { + "$ref": "#/definitions/NukeBuild" } - } + ] } diff --git a/Directory.Packages.props b/Directory.Packages.props index 5d1b815e6..67387c0c6 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -25,7 +25,7 @@ - + @@ -35,8 +35,6 @@ - - diff --git a/build-support/nuke-build/Build.Documentation.cs b/build-support/nuke-build/Build.Documentation.cs index 1ce3c5281..a905e0f58 100644 --- a/build-support/nuke-build/Build.Documentation.cs +++ b/build-support/nuke-build/Build.Documentation.cs @@ -26,9 +26,9 @@ public partial class Build """ ).AssertWaitForExit(); - FileSystemTasks.CopyDirectoryRecursively(ReferenceDocumentationPath / "src" / "styles", targetDir / "html" / "styles", DirectoryExistsPolicy.Merge); - FileSystemTasks.CopyDirectoryRecursively(ReferenceDocumentationPath / "src" / "images", targetDir / "html" / "images", DirectoryExistsPolicy.Merge, excludeFile: file => file.Extension != ".gif" && file.Extension != ".svg" && file.Extension != ".jpg" && file.Extension != ".png"); - FileSystemTasks.CopyDirectoryRecursively(ReferenceDocumentationPath / "lib" / "docbook-xsl-snapshot" / "images", targetDir / "html" / "images", DirectoryExistsPolicy.Merge); + (ReferenceDocumentationPath / "src" / "styles").CopyToDirectory(targetDir / "html" / "styles", ExistsPolicy.MergeAndOverwrite); + (ReferenceDocumentationPath / "src" / "images").CopyToDirectory(targetDir / "html" / "images", ExistsPolicy.MergeAndOverwrite, excludeFile: file => file.Extension != ".gif" && file.Extension != ".svg" && file.Extension != ".jpg" && file.Extension != ".png"); + (ReferenceDocumentationPath / "lib" / "docbook-xsl-snapshot" / "images").CopyToDirectory(targetDir / "html" / "images", ExistsPolicy.MergeAndOverwrite); }); Target DocsSdk => _ => _ @@ -45,6 +45,6 @@ public partial class Build ProcessTasks.StartProcess("yarn", arguments: "build", workingDirectory: webSiteDir).AssertWaitForExit(); // copy reference docs - FileSystemTasks.CopyDirectoryRecursively(ReferenceDocumentationPath / "target" / "html", webSiteDir / "public" / "doc-latest" / "reference" / "html", DirectoryExistsPolicy.Merge); + (ReferenceDocumentationPath / "target" / "html").CopyToDirectory(webSiteDir / "public" / "doc-latest" / "reference" / "html", ExistsPolicy.MergeAndOverwrite); }); } diff --git a/build-support/nuke-build/Build.cs b/build-support/nuke-build/Build.cs index 995fb0565..b07d3cf9d 100644 --- a/build-support/nuke-build/Build.cs +++ b/build-support/nuke-build/Build.cs @@ -14,7 +14,7 @@ using Nuke.Common.Tools.MSBuild; using Nuke.Common.Utilities.Collections; using Serilog; -using static Nuke.Common.IO.FileSystemTasks; + using static Nuke.Common.Tooling.ProcessTasks; using static Nuke.Common.Tools.DotNet.DotNetTasks; using static Nuke.Common.Tools.MSBuild.MSBuildTasks; @@ -184,7 +184,7 @@ protected override void OnBuildInitialized() foreach (var file in BuildDirectory.GlobFiles(patterns)) { - CopyFileToDirectory(file, binDirectory / "net", FileExistsPolicy.OverwriteIfNewer); + file.CopyToDirectory(binDirectory / "net", ExistsPolicy.FileOverwriteIfNewer); } }); diff --git a/build-support/nuke-build/_build.csproj b/build-support/nuke-build/_build.csproj index 728de56f0..91bddd5f1 100644 --- a/build-support/nuke-build/_build.csproj +++ b/build-support/nuke-build/_build.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net10.0 CS0649;CS0169 ..\.. diff --git a/global.json b/global.json index c19a2e057..1e7fdfa95 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100", + "version": "10.0.100", "rollForward": "latestMinor" } } diff --git a/src/Spring/Spring.Core/Expressions/PropertyOrFieldNode.cs b/src/Spring/Spring.Core/Expressions/PropertyOrFieldNode.cs index b141641d3..80492b937 100644 --- a/src/Spring/Spring.Core/Expressions/PropertyOrFieldNode.cs +++ b/src/Spring/Spring.Core/Expressions/PropertyOrFieldNode.cs @@ -616,32 +616,32 @@ public override bool RequiresRefresh(Type contextType) private class FieldValueAccessor : BaseValueAccessor { - private SafeField field; - private bool isWriteable; - private Type targetType; - private Type contextType; + private readonly SafeField _field; + private readonly bool _isWriteable; + private readonly Type _targetType; + private readonly Type _contextType; public FieldValueAccessor(FieldInfo fieldInfo) { - this.field = new SafeField(fieldInfo); - this.isWriteable = !(fieldInfo.IsInitOnly || fieldInfo.IsLiteral); - this.targetType = fieldInfo.FieldType; - this.contextType = fieldInfo.DeclaringType; + this._field = new SafeField(fieldInfo); + this._isWriteable = !(fieldInfo.IsInitOnly || fieldInfo.IsLiteral); + this._targetType = fieldInfo.FieldType; + this._contextType = fieldInfo.DeclaringType; } public override object Get(object context) { - return field.GetValue(context); + return _field.GetValue(context); } public override void Set(object context, object value) { - field.SetValue(context, value); + _field.SetValue(context, value); } public override bool IsWriteable { - get { return isWriteable; } + get { return _isWriteable; } } public override bool RequiresContext @@ -651,17 +651,17 @@ public override bool RequiresContext public override Type TargetType { - get { return targetType; } + get { return _targetType; } } public override MemberInfo MemberInfo { - get { return field.FieldInfo; } + get { return _field.FieldInfo; } } public override bool RequiresRefresh(Type contextType) { - return this.contextType != contextType; + return this._contextType != contextType; } } diff --git a/src/Spring/Spring.Core/Objects/Factory/Config/DependencyDescriptor.cs b/src/Spring/Spring.Core/Objects/Factory/Config/DependencyDescriptor.cs index ca62d5035..b8b0264f3 100644 --- a/src/Spring/Spring.Core/Objects/Factory/Config/DependencyDescriptor.cs +++ b/src/Spring/Spring.Core/Objects/Factory/Config/DependencyDescriptor.cs @@ -28,15 +28,11 @@ namespace Spring.Objects.Factory.Config; /// Mark Pollack public class DependencyDescriptor { - private MethodParameter methodParameter; - - private PropertyInfo property; - - private FieldInfo field; - - private readonly bool required; - - private readonly bool eager; + private readonly MethodParameter _methodParameter; + private readonly PropertyInfo _property; + private FieldInfo _field; + private readonly bool _required; + private readonly bool _eager; /// /// Initializes a new instance of the class for a method or constructor parameter. @@ -58,9 +54,9 @@ public DependencyDescriptor(MethodParameter methodParameter, bool required) /// eagerly resolving potential target objects for type matching. public DependencyDescriptor(MethodParameter methodParameter, bool required, bool eager) { - this.methodParameter = methodParameter; - this.required = required; - this.eager = eager; + this._methodParameter = methodParameter; + this._required = required; + this._eager = eager; } /// @@ -83,9 +79,9 @@ public DependencyDescriptor(PropertyInfo property, bool required) /// public DependencyDescriptor(PropertyInfo property, bool required, bool eager) { - this.property = property; - this.required = required; - this.eager = eager; + this._property = property; + this._required = required; + this._eager = eager; } /// @@ -108,9 +104,9 @@ public DependencyDescriptor(FieldInfo field, bool required) /// public DependencyDescriptor(FieldInfo field, bool required, bool eager) { - this.field = field; - this.required = required; - this.eager = eager; + this._field = field; + this._required = required; + this._eager = eager; } /// @@ -119,7 +115,7 @@ public DependencyDescriptor(FieldInfo field, bool required, bool eager) /// true if required; otherwise, false. public bool Required { - get { return required; } + get { return _required; } } /// @@ -130,12 +126,12 @@ public Type DependencyType { get { - if (methodParameter != null) - return methodParameter.ParameterType; - if (property != null) - return property.PropertyType; - if (field != null) - return field.FieldType; + if (_methodParameter != null) + return _methodParameter.ParameterType; + if (_property != null) + return _property.PropertyType; + if (_field != null) + return _field.FieldType; return null; } @@ -148,7 +144,7 @@ public Type DependencyType /// true if eager; otherwise, false. public bool Eager { - get { return this.eager; } + get { return this._eager; } } /// @@ -157,7 +153,7 @@ public bool Eager /// The method parameter. public MethodParameter MethodParameter { - get { return methodParameter; } + get { return _methodParameter; } } /// @@ -167,12 +163,12 @@ public Attribute[] Attributes { get { - if (methodParameter != null) - return methodParameter.ParameterAttributes; - if (property != null) - return Attribute.GetCustomAttributes(property); - if (field != null) - return Attribute.GetCustomAttributes(field); + if (_methodParameter != null) + return _methodParameter.ParameterAttributes; + if (_property != null) + return Attribute.GetCustomAttributes(_property); + if (_field != null) + return Attribute.GetCustomAttributes(_field); return new Attribute[0]; } @@ -185,12 +181,12 @@ public string DependencyName { get { - if (methodParameter != null) - return methodParameter.ParameterName(); - if (property != null) - return property.Name; - if (field != null) - return field.Name; + if (_methodParameter != null) + return _methodParameter.ParameterName(); + if (_property != null) + return _property.Name; + if (_field != null) + return _field.Name; return ""; } diff --git a/src/Spring/Spring.Core/Spring.Core.csproj b/src/Spring/Spring.Core/Spring.Core.csproj index 8193cd444..d7522c00e 100644 --- a/src/Spring/Spring.Core/Spring.Core.csproj +++ b/src/Spring/Spring.Core/Spring.Core.csproj @@ -11,11 +11,6 @@ - - - - -