diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 29bdc4d..4db7723 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,3 +24,33 @@ jobs: - name: Test run: dotnet test LoadingIndicators.Avalonia.Tests/LoadingIndicators.Avalonia.Tests.csproj -c Release + + aot: + name: AOT compatibility + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: actions/setup-dotnet@v5 + with: + dotnet-version: | + 8.0.x + 9.0.x + 10.0.x + + # Native AOT links with clang against zlib on Linux. + - name: Install Native AOT prerequisites + run: sudo apt-get update && sudo apt-get install -y clang zlib1g-dev + + # A library's trim/AOT warnings only surface when a consuming app is AOT-published. + # The demo Desktop project roots the whole library, so this is the authoritative gate. + - name: AOT publish demo (fail on any IL trim/AOT warning) + run: | + set -o pipefail + dotnet publish LoadingIndicators.Avalonia.Demo/LoadingIndicators.Avalonia.Demo.Desktop/LoadingIndicators.Avalonia.Demo.Desktop.csproj \ + -c Release -r linux-x64 -p:PublishAot=true 2>&1 | tee aot-publish.log + if grep -nE "warning IL[0-9]{4}" aot-publish.log; then + echo "::error::Native AOT/trim warnings detected — the library is no longer AOT-clean (see IL#### lines above)." + exit 1 + fi + echo "No IL2xxx/IL3xxx trim/AOT warnings — library is AOT-clean." diff --git a/LoadingIndicators.Avalonia/LoadingIndicators.Avalonia.csproj b/LoadingIndicators.Avalonia/LoadingIndicators.Avalonia.csproj index d5ba063..b275faa 100644 --- a/LoadingIndicators.Avalonia/LoadingIndicators.Avalonia.csproj +++ b/LoadingIndicators.Avalonia/LoadingIndicators.Avalonia.csproj @@ -10,7 +10,7 @@ 0.0.0-local Optris GmbH, original by moviegear Optris GmbH - Optris-maintained fork of LoadingIndicators.Avalonia, ported to Avalonia 12. An adaptation for Avalonia of the LoadingIndicators.WPF collection of 9 animated loading indicators. + Optris-maintained fork of LoadingIndicators.Avalonia, ported to Avalonia 12. An adaptation for Avalonia of the LoadingIndicators.WPF collection of 9 animated loading indicators. Trim- and Native-AOT-compatible. Optris GmbH, moviegear © $([System.DateTime]::Now.Year) README.md LICENSE.md @@ -18,7 +18,7 @@ https://github.com/Optris/Optris.LoadingIndicators.Avalonia.git git icon.png - Avalonia, loading, progress, activity + Avalonia, loading, progress, activity, AOT, trimming Optris.LoadingIndicators.Avalonia true portable diff --git a/README.md b/README.md index 165b457..6a065f5 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,17 @@ LoadingIndicators.Avalonia is an adaptation for Avalonia of the [LoadingIndicato ``` +## Trimming & Native AOT + +The package is **trim- and Native-AOT-compatible**. The assembly is marked `IsTrimmable`, all +bindings in the control themes are compiled (no reflection bindings), and the control uses no +runtime reflection — so it adds no trim/AOT warnings to a consuming app. This is enforced in CI by +publishing the demo with `PublishAot=true` and failing on any `IL2xxx`/`IL3xxx` warning. + +Nothing extra is required to consume it from an AOT app — just keep Avalonia's default compiled +bindings (`true`) in +your own project, as the Avalonia templates already do. + ## Releasing a new version The major version tracks Avalonia (e.g. `12.x.y` for Avalonia 12). Minor and patch versions are for library changes.