Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ 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: |
./artifacts/bin/**/*
./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: |
Expand All @@ -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: |
Expand All @@ -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: |
Expand All @@ -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: |
Expand All @@ -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:
Expand All @@ -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: |
Expand All @@ -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: |
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/regenerate-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 }}/*
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 }}/*
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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: |
Expand Down
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<ItemGroup>
<PackageVersion Include="libLLVM" Version="23.1.5" />
<PackageVersion Include="libLLVMSharp" Version="23.1.5.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="NUnit" Version="4.4.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="6.1.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.12.0" />
<PackageVersion Include="NUnit" Version="5.0.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="6.3.1" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "10.0.100-preview",
"allowPrerelease": true,
"version": "11.0.100",
"allowPrerelease": false,
"rollForward": "latestFeature"
}
}
2 changes: 1 addition & 1 deletion samples/KaleidoscopeTutorial/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-->

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFrameworks>net11.0;net10.0</TargetFrameworks>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down
3 changes: 2 additions & 1 deletion samples/KaleidoscopeTutorial/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
5 changes: 3 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sources/LLVMSharp.Interop/LLVMSharp.Interop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks>
<TargetFrameworks>net11.0;net10.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion sources/LLVMSharp/LLVMSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks>
<TargetFrameworks>net11.0;net10.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
17 changes: 16 additions & 1 deletion tests/LLVMSharp.KaleidoscopeTests/ChapterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down Expand Up @@ -250,4 +251,18 @@ private static string GetBuildConfiguration()

return "Release";
}

private static string GetTargetFramework()
{
foreach (var metadata in typeof(ChapterTests).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>())
{
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.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks>
<TargetFrameworks>net11.0;net10.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -16,8 +16,9 @@

<ItemGroup>
<!-- The tests launch the sample chapters as subprocesses and locate their build output at run
time, so they only need to know which configuration was built. -->
time, so they need to know which configuration and target framework were built. -->
<AssemblyMetadata Include="BuildConfiguration" Value="$(Configuration)" />
<AssemblyMetadata Include="TargetFramework" Value="$(TargetFramework)" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion tests/LLVMSharp.UnitTests/LLVMSharp.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks>
<TargetFrameworks>net11.0;net10.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
Loading