diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 4dcd522..a487224 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -22,10 +22,10 @@ regenerate. Add new hand-written surface under `Manual`/`Extensions` or `sources ## Build / test (do this to validate every change) -Requires the **.NET 10 SDK** (`global.json` pins `10.0.100-preview`, `allowPrerelease`). `dotnet` resolves it. +Requires the **stable .NET 11 SDK** (`global.json` pins `11.0.100`). `dotnet` resolves it. - Build: `dotnet build -c Release` (root, builds `LLVMSharp.slnx`). ~10s clean. -- Test: `dotnet test -c Release --no-build` (~3s; ~2635 tests on `net10.0`, incl. generated interop tests). +- Test: `dotnet test -c Release --no-build` (runs all tests on `net11.0` and `net10.0`, incl. generated interop tests). - `--no-build` requires a prior successful build; drop it if you changed code since the last build. `TreatWarningsAsErrors=true`, `Nullable=enable`, `AnalysisLevel=latest-all`, and `EnforceCodeStyleInBuild=true` @@ -67,7 +67,7 @@ these in the rsp; don't drop them expecting an external profile to supply them. init calls. Regenerate against a full-target LLVM build/install, or restore these six aggregator bodies to the canonical 20-target list afterward. The per-target `InitializeAMDGPUTarget()` etc. P/Invokes are hand-written in `Extensions/LLVM.Manual.cs` and already cover every target regardless. -- **`LLVMAttributeIndex` / `LLVMJITSymbolGenericFlags` need a post-regen fixup.** Generator `22.1.8.0` +- **`LLVMAttributeIndex` / `LLVMJITSymbolGenericFlags` need a post-regen fixup.** Generator `23.1.5.0` preserves the headers' `U` literal suffixes (`0U`, `1U << n`). The repo's `CA1028` policy (unsuppressed) requires `Int32`-underlying enums, and `int` enums reject `U`-suffixed values (CS0266) — while switching them to `uint` re-triggers `CA1028`. These two enums' values are version-stable, so after regen restore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5e7ce0..8fac03f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,10 +16,10 @@ jobs: configuration: [ debug, release ] os: [ windows ] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - run: ./scripts/cibuild.cmd -configuration ${{ matrix.configuration }} -architecture ${{ matrix.architecture }} shell: cmd - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }} path: | @@ -27,7 +27,7 @@ jobs: ./artifacts/log/**/* ./artifacts/tst/**/* if-no-files-found: error - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }}_pkg path: | @@ -41,10 +41,10 @@ jobs: configuration: [ debug, release ] os: [ windows ] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - run: ./scripts/cibuild.cmd -configuration ${{ matrix.configuration }} -architecture ${{ matrix.architecture }} shell: cmd - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }} path: | @@ -60,10 +60,10 @@ jobs: configuration: [ debug, release ] os: [ ubuntu ] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - run: ./scripts/cibuild.sh --configuration ${{ matrix.configuration }} --architecture ${{ matrix.architecture }} shell: bash - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }} path: | @@ -79,10 +79,10 @@ jobs: configuration: [ debug, release ] os: [ ubuntu ] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - run: ./scripts/cibuild.sh --configuration ${{ matrix.configuration }} --architecture ${{ matrix.architecture }} shell: bash - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }} path: | @@ -98,7 +98,7 @@ jobs: configuration: [ debug, release ] os: [ macos ] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 # libLLVM 23.1.5 was linked against this Homebrew Z3 ABI. - name: Install libLLVM Z3 dependency env: @@ -111,7 +111,7 @@ jobs: brew install llvmsharp/ci/z3 - run: ./scripts/cibuild.sh --configuration ${{ matrix.configuration }} --architecture ${{ matrix.architecture }} shell: bash - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }} path: | @@ -126,24 +126,24 @@ jobs: permissions: id-token: write steps: - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - uses: actions/checkout@v7 + - uses: actions/download-artifact@v8 with: merge-multiple: true path: ./artifacts/pkg pattern: "*_release_*_pkg" - - uses: actions/setup-dotnet@v4 + - uses: actions/setup-dotnet@v6 with: global-json-file: ./global.json - run: dotnet tool install --tool-path ./artifacts/tools --prerelease sign - - uses: azure/login@v2 + - uses: azure/login@v3 with: allow-no-subscriptions: true client-id: "${{ secrets.AZURE_CLIENT_ID }}" tenant-id: "${{ secrets.AZURE_TENANT_ID }}" - run: ./artifacts/tools/sign code azure-key-vault "**/*.nupkg" --base-directory "${{ github.workspace }}/artifacts/pkg" --file-list "${{ github.workspace }}/scripts/SignClientFileList.txt" --publisher-name ".NET Foundation" --description "LLVMSharp" --description-url "https://github.com/dotnet/llvmsharp" --azure-credential-type "azure-cli" --azure-key-vault-url "${{ secrets.KEY_VAULT_URL }}" --azure-key-vault-certificate "${{ secrets.KEY_VAULT_CERTIFICATE_ID }}" shell: pwsh - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: sign_nuget path: | diff --git a/.github/workflows/regenerate-native.yml b/.github/workflows/regenerate-native.yml index 4059993..1ce4aa9 100644 --- a/.github/workflows/regenerate-native.yml +++ b/.github/workflows/regenerate-native.yml @@ -46,7 +46,7 @@ jobs: libllvm: ${{ steps.detect.outputs.libllvm }} libllvmsharp: ${{ steps.detect.outputs.libllvmsharp }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: fetch-depth: 0 - id: detect @@ -86,7 +86,7 @@ jobs: - { rid: linux-arm64, os: ubuntu-24.04-arm } - { rid: osx-arm64, os: macos-15 } steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Lift libLLVM (Windows) if: runner.os == 'Windows' shell: pwsh @@ -95,7 +95,7 @@ jobs: if: runner.os != 'Windows' shell: bash run: ./scripts/build.sh --regeneratenative --target libLLVM --rid ${{ matrix.rid }} - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: libllvm-native-${{ matrix.rid }} path: artifacts/native/${{ matrix.rid }}/* @@ -106,9 +106,9 @@ jobs: if: ${{ needs.detect.outputs.libllvm == 'true' }} runs-on: windows-latest steps: - - uses: actions/checkout@v4 - - uses: NuGet/setup-nuget@v2 - - uses: actions/download-artifact@v4 + - uses: actions/checkout@v7 + - uses: NuGet/setup-nuget@v4 + - uses: actions/download-artifact@v8 with: pattern: libllvm-native-* path: staging @@ -122,7 +122,7 @@ jobs: nuget pack "packages/libLLVM/libLLVM.runtime.${rid}/libLLVM.runtime.${rid}.nuspec" -OutputDirectory out done nuget pack "packages/libLLVM/libLLVM/libLLVM.nuspec" -OutputDirectory out - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: libLLVM-packages path: out/*.nupkg @@ -144,7 +144,7 @@ jobs: - { rid: linux-arm64, os: ubuntu-22.04-arm } - { rid: osx-arm64, os: macos-15 } steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Install LLVM dependencies (Windows) if: runner.os == 'Windows' shell: pwsh @@ -160,7 +160,7 @@ jobs: if: runner.os != 'Windows' shell: bash run: ./scripts/build.sh --regeneratenative --target libLLVMSharp --rid ${{ matrix.rid }} - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: libllvmsharp-native-${{ matrix.rid }} path: artifacts/native/${{ matrix.rid }}/* @@ -171,9 +171,9 @@ jobs: if: ${{ needs.detect.outputs.libllvmsharp == 'true' }} runs-on: windows-latest steps: - - uses: actions/checkout@v4 - - uses: NuGet/setup-nuget@v2 - - uses: actions/download-artifact@v4 + - uses: actions/checkout@v7 + - uses: NuGet/setup-nuget@v4 + - uses: actions/download-artifact@v8 with: pattern: libllvmsharp-native-* path: staging @@ -187,7 +187,7 @@ jobs: nuget pack "packages/libLLVMSharp/libLLVMSharp.runtime.${rid}/libLLVMSharp.runtime.${rid}.nuspec" -OutputDirectory out done nuget pack "packages/libLLVMSharp/libLLVMSharp/libLLVMSharp.nuspec" -OutputDirectory out - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: libLLVMSharp-packages path: out/*.nupkg @@ -210,24 +210,24 @@ jobs: permissions: id-token: write steps: - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - uses: actions/checkout@v7 + - uses: actions/download-artifact@v8 with: merge-multiple: true path: ./artifacts/pkg pattern: "lib*-packages" - - uses: actions/setup-dotnet@v4 + - uses: actions/setup-dotnet@v6 with: global-json-file: ./global.json - run: dotnet tool install --tool-path ./artifacts/tools --prerelease sign - - uses: azure/login@v2 + - uses: azure/login@v3 with: allow-no-subscriptions: true client-id: "${{ secrets.AZURE_CLIENT_ID }}" tenant-id: "${{ secrets.AZURE_TENANT_ID }}" - run: ./artifacts/tools/sign code azure-key-vault "**/*.nupkg" --base-directory "${{ github.workspace }}/artifacts/pkg" --file-list "${{ github.workspace }}/scripts/SignClientFileListNative.txt" --publisher-name ".NET Foundation" --description "LLVMSharp" --description-url "https://github.com/dotnet/llvmsharp" --azure-credential-type "azure-cli" --azure-key-vault-url "${{ secrets.KEY_VAULT_URL }}" --azure-key-vault-certificate "${{ secrets.KEY_VAULT_CERTIFICATE_ID }}" shell: pwsh - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: sign_nuget_native path: | diff --git a/Directory.Packages.props b/Directory.Packages.props index 553d10c..bc6d9d8 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -14,9 +14,9 @@ - - - + + + diff --git a/global.json b/global.json index ff239fd..18f080b 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "10.0.100-preview", - "allowPrerelease": true, + "version": "11.0.100", + "allowPrerelease": false, "rollForward": "latestFeature" } } diff --git a/samples/KaleidoscopeTutorial/Directory.Build.props b/samples/KaleidoscopeTutorial/Directory.Build.props index 1fe112f..57b366f 100644 --- a/samples/KaleidoscopeTutorial/Directory.Build.props +++ b/samples/KaleidoscopeTutorial/Directory.Build.props @@ -8,7 +8,7 @@ --> - net10.0 + net11.0;net10.0 enable enable true diff --git a/samples/KaleidoscopeTutorial/README.md b/samples/KaleidoscopeTutorial/README.md index 0390fb3..b9c4e72 100644 --- a/samples/KaleidoscopeTutorial/README.md +++ b/samples/KaleidoscopeTutorial/README.md @@ -48,7 +48,8 @@ to take a language) rather than a code delta, so there is no `Chapter10` project ## Running -Requires the .NET 10 preview SDK (resolved via the repo's `global.json`). From this directory: +Requires the stable .NET 11 SDK (resolved via the repo's `global.json`). The tutorial targets both +.NET 11 and .NET 10. From this directory: ``` dotnet build KaleidoscopeTutorial.slnx -c Release diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 5c4c405..4f1c6e9 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -278,7 +278,8 @@ try { $DotNetInstallDirectory = Join-Path -Path $ArtifactsDir -ChildPath "dotnet" Create-Directory -Path $DotNetInstallDirectory - & $DotNetInstallScript -Channel 10.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture + & $DotNetInstallScript -Channel 11.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture + & $DotNetInstallScript -Channel 10.0 -Runtime dotnet -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture $env:PATH="$DotNetInstallDirectory;$env:PATH" } diff --git a/scripts/build.sh b/scripts/build.sh index 9d2bd08..f84adaf 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -319,7 +319,7 @@ function DetectChanges { detectLibllvmsharp=true else # libLLVM regenerates when the tracked LLVM version changes. The libLLVM package - # version tracks the full patch (e.g. 22.1.8), so compare the full version. + # version tracks the full patch (e.g. 23.1.5), so compare the full version. prevVersion="$(git -C "$RepoRoot" show "$base:CMakeLists.txt" 2>/dev/null | sed -n 's/^project(LLVMSharp VERSION \([0-9.]*\)).*/\1/p')" if [ "$llvm" != "$prevVersion" ]; then @@ -642,7 +642,8 @@ if [[ ! -z "$architecture" ]]; then DotNetInstallDirectory="$ArtifactsDir/dotnet" CreateDirectory "$DotNetInstallDirectory" - . "$DotNetInstallScript" --channel 10.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture" + . "$DotNetInstallScript" --channel 11.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture" + . "$DotNetInstallScript" --channel 10.0 --runtime dotnet --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture" PATH="$DotNetInstallDirectory:$PATH:" fi diff --git a/sources/LLVMSharp.Interop/LLVMSharp.Interop.csproj b/sources/LLVMSharp.Interop/LLVMSharp.Interop.csproj index 2c1f792..8bbe2b1 100644 --- a/sources/LLVMSharp.Interop/LLVMSharp.Interop.csproj +++ b/sources/LLVMSharp.Interop/LLVMSharp.Interop.csproj @@ -2,7 +2,7 @@ - net10.0 + net11.0;net10.0 diff --git a/sources/LLVMSharp/LLVMSharp.csproj b/sources/LLVMSharp/LLVMSharp.csproj index 7f36cbd..52b55f2 100644 --- a/sources/LLVMSharp/LLVMSharp.csproj +++ b/sources/LLVMSharp/LLVMSharp.csproj @@ -2,7 +2,7 @@ - net10.0 + net11.0;net10.0 diff --git a/tests/LLVMSharp.KaleidoscopeTests/ChapterTests.cs b/tests/LLVMSharp.KaleidoscopeTests/ChapterTests.cs index 0d9f316..b4109e2 100644 --- a/tests/LLVMSharp.KaleidoscopeTests/ChapterTests.cs +++ b/tests/LLVMSharp.KaleidoscopeTests/ChapterTests.cs @@ -206,7 +206,8 @@ private static string LocateChapterAssembly(string chapter) { var repositoryRoot = FindRepositoryRoot(); var configuration = GetBuildConfiguration(); - var chapterBin = Path.Combine(repositoryRoot, "samples", "KaleidoscopeTutorial", chapter, "bin", configuration, "net10.0"); + var targetFramework = GetTargetFramework(); + var chapterBin = Path.Combine(repositoryRoot, "samples", "KaleidoscopeTutorial", chapter, "bin", configuration, targetFramework); if (Directory.Exists(chapterBin)) { @@ -250,4 +251,18 @@ private static string GetBuildConfiguration() return "Release"; } + + private static string GetTargetFramework() + { + foreach (var metadata in typeof(ChapterTests).Assembly.GetCustomAttributes()) + { + if ((metadata.Key == "TargetFramework") && !string.IsNullOrEmpty(metadata.Value)) + { + return metadata.Value; + } + } + + Assert.Fail("Could not determine the target framework from assembly metadata."); + return string.Empty; // unreachable; Assert.Fail throws. + } } diff --git a/tests/LLVMSharp.KaleidoscopeTests/LLVMSharp.KaleidoscopeTests.csproj b/tests/LLVMSharp.KaleidoscopeTests/LLVMSharp.KaleidoscopeTests.csproj index 4bb50c5..8f9c082 100644 --- a/tests/LLVMSharp.KaleidoscopeTests/LLVMSharp.KaleidoscopeTests.csproj +++ b/tests/LLVMSharp.KaleidoscopeTests/LLVMSharp.KaleidoscopeTests.csproj @@ -2,7 +2,7 @@ - net10.0 + net11.0;net10.0 @@ -16,8 +16,9 @@ + time, so they need to know which configuration and target framework were built. --> + diff --git a/tests/LLVMSharp.UnitTests/LLVMSharp.UnitTests.csproj b/tests/LLVMSharp.UnitTests/LLVMSharp.UnitTests.csproj index f3f20c0..b8d8e25 100644 --- a/tests/LLVMSharp.UnitTests/LLVMSharp.UnitTests.csproj +++ b/tests/LLVMSharp.UnitTests/LLVMSharp.UnitTests.csproj @@ -2,7 +2,7 @@ - net10.0 + net11.0;net10.0