From 332ed8d921df7084a8ae952206500a2de78cd598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lozier?= Date: Mon, 24 Jun 2024 22:42:32 -0400 Subject: [PATCH] Add .NET 9 target for testing --- .github/workflows/main.yml | 8 ++++++++ Build.proj | 2 +- Build/steps.yml | 6 ++++++ Dlr.sln | 1 + Package/nuget/DynamicLanguageRuntime.nuspec | 6 +++--- .../Hosting/Shell/ConsoleHostOptionsParser.cs | 2 +- Src/Microsoft.Dynamic/StringExtensions.cs | 5 +++++ Tests/Metadata/Metadata.csproj | 2 +- .../Microsoft.Dynamic.Test/Microsoft.Dynamic.Test.csproj | 2 +- .../Microsoft.Scripting.Test.csproj | 2 +- make.ps1 | 2 +- 11 files changed, 29 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 73b4ba7f..0d133b44 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,6 +26,11 @@ jobs: uses: actions/setup-dotnet@v1 with: dotnet-version: '8.0.x' + - name: Setup .NET 9.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '9.0.x' + include-prerelease: true - name: Build run: pwsh make.ps1 - name: Package @@ -46,3 +51,6 @@ jobs: - name: Test (net8.0) run: ./make.ps1 -frameworks net8.0 test-all shell: pwsh + - name: Test (net9.0) + run: ./make.ps1 -frameworks net9.0 test-all + shell: pwsh diff --git a/Build.proj b/Build.proj index 6ba917cf..17a033e1 100644 --- a/Build.proj +++ b/Build.proj @@ -108,7 +108,7 @@ Outputs="$(PackageDir)\DynamicLanguageRuntime.$(PackageVersion).zip"> + Exclude="$(StageDir)\netcoreapp3.1\*;$(StageDir)\net7.0*\*;$(StageDir)\net9.0*\*" /> diff --git a/Build/steps.yml b/Build/steps.yml index fef07f0f..7f63edd1 100644 --- a/Build/steps.yml +++ b/Build/steps.yml @@ -38,6 +38,12 @@ steps: inputs: packageType: 'sdk' version: '8.0.x' + + - task: UseDotNet@2 + displayName: Install .NET 9.0 SDK for build + inputs: + packageType: 'sdk' + version: '9.0.x' includePreviewVersions: true # Set Mono version on macOS diff --git a/Dlr.sln b/Dlr.sln index de18fe0e..a0fdd4d8 100644 --- a/Dlr.sln +++ b/Dlr.sln @@ -38,6 +38,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{60056F49 Build\net462.props = Build\net462.props Build\net6.0.props = Build\net6.0.props Build\net8.0.props = Build\net8.0.props + Build\net9.0.props = Build\net9.0.props Build\netstandard2.0.props = Build\netstandard2.0.props Build\steps.yml = Build\steps.yml EndProjectSection diff --git a/Package/nuget/DynamicLanguageRuntime.nuspec b/Package/nuget/DynamicLanguageRuntime.nuspec index 970b0204..40fbbdd2 100644 --- a/Package/nuget/DynamicLanguageRuntime.nuspec +++ b/Package/nuget/DynamicLanguageRuntime.nuspec @@ -32,9 +32,9 @@ - - - + + + diff --git a/Src/Microsoft.Dynamic/Hosting/Shell/ConsoleHostOptionsParser.cs b/Src/Microsoft.Dynamic/Hosting/Shell/ConsoleHostOptionsParser.cs index 84892902..66c3408e 100644 --- a/Src/Microsoft.Dynamic/Hosting/Shell/ConsoleHostOptionsParser.cs +++ b/Src/Microsoft.Dynamic/Hosting/Shell/ConsoleHostOptionsParser.cs @@ -99,7 +99,7 @@ public void Parse(string[] args) { private void ParseOption(string arg, out string name, out string value) { Debug.Assert(arg != null); - int colon = arg.IndexOf(':'); + int colon = arg.IndexOf(':', StringComparison.Ordinal); if (colon >= 0) { name = arg.Substring(0, colon); diff --git a/Src/Microsoft.Dynamic/StringExtensions.cs b/Src/Microsoft.Dynamic/StringExtensions.cs index eb5373da..a1963924 100644 --- a/Src/Microsoft.Dynamic/StringExtensions.cs +++ b/Src/Microsoft.Dynamic/StringExtensions.cs @@ -14,6 +14,11 @@ public static bool StartsWith(this string str, char value) { return str.StartsWith(value.ToString(), StringComparison.Ordinal); } + + public static int IndexOf(this string str, char value, StringComparison comparisonType) { + if (comparisonType == StringComparison.Ordinal) return str.IndexOf(value); + return str.IndexOf(value.ToString(), comparisonType); + } #endif } } diff --git a/Tests/Metadata/Metadata.csproj b/Tests/Metadata/Metadata.csproj index ae90f462..009de736 100644 --- a/Tests/Metadata/Metadata.csproj +++ b/Tests/Metadata/Metadata.csproj @@ -1,7 +1,7 @@  - net462;netcoreapp3.1;net6.0;net8.0 + net462;netcoreapp3.1;net6.0;net8.0;net9.0 false Exe diff --git a/Tests/Microsoft.Dynamic.Test/Microsoft.Dynamic.Test.csproj b/Tests/Microsoft.Dynamic.Test/Microsoft.Dynamic.Test.csproj index a244b8e5..1fa19c51 100644 --- a/Tests/Microsoft.Dynamic.Test/Microsoft.Dynamic.Test.csproj +++ b/Tests/Microsoft.Dynamic.Test/Microsoft.Dynamic.Test.csproj @@ -1,7 +1,7 @@  - net462;netcoreapp3.1;net6.0;net8.0 + net462;netcoreapp3.1;net6.0;net8.0;net9.0 false diff --git a/Tests/Microsoft.Scripting.Test/Microsoft.Scripting.Test.csproj b/Tests/Microsoft.Scripting.Test/Microsoft.Scripting.Test.csproj index 3fd1c99c..616b0f04 100644 --- a/Tests/Microsoft.Scripting.Test/Microsoft.Scripting.Test.csproj +++ b/Tests/Microsoft.Scripting.Test/Microsoft.Scripting.Test.csproj @@ -1,7 +1,7 @@  - net462;netcoreapp3.1;net6.0;net8.0 + net462;netcoreapp3.1;net6.0;net8.0;net9.0 false diff --git a/make.ps1 b/make.ps1 index d41161f2..8a97f4bf 100755 --- a/make.ps1 +++ b/make.ps1 @@ -4,7 +4,7 @@ Param( [Parameter(Position=1)] [String] $target = "release", [String] $configuration = "Release", - [String[]] $frameworks=@('net462','netcoreapp3.1','net6.0','net8.0'), + [String[]] $frameworks=@('net462','netcoreapp3.1','net6.0','net8.0','net9.0'), [String] $platform = "x64", [switch] $runIgnored )