Skip to content

Add cross-OS Gradle cache fallback for Windows bootstrap#35067

Closed
PureWeen wants to merge 1 commit into
release/10.0.1xx-sr6from
fix/gradle-cache-cross-os-fallback
Closed

Add cross-OS Gradle cache fallback for Windows bootstrap#35067
PureWeen wants to merge 1 commit into
release/10.0.1xx-sr6from
fix/gradle-cache-cross-os-fallback

Conversation

@PureWeen

Copy link
Copy Markdown
Member

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Problem

The official build on release/10.0.1xx-sr6 (build 2956987) still fails on Pack Windows with Gradle errors despite #35049. The root cause: no Windows-specific Gradle cache entry exists for the release/10.0.1xx-sr6 branch scope.

The cache log shows:

Fingerprint: "gradle"|"v1"|"Windows_NT"|...
There is a cache miss.

Meanwhile Pack macOS succeeds because a macOS cache entry exists from main branch scope. Without a Windows cache, Gradle attempts to download from repo.maven.apache.org, which is blocked by CFSClean network isolation:

error XAGRDL0000: Could not resolve net.java.dev.jna:jna-platform:5.6.0
  > Permission denied: getsockopt

Fix

Add an OS-independent fallback restore key ("gradle" | "v1") to cache-gradle.yml, allowing Windows to bootstrap from the macOS-populated cache when no Windows-specific entry exists.

Why this is safe (addressing @jonathanpeppers's earlier concern from #35049)

The concern was that restoring a macOS Gradle cache on Windows could cause aapt2 native binary crashes, since aapt2 is published with OS-specific Maven classifiers (aapt2-*-osx.jar vs aapt2-*-windows.jar).

This is not a risk because:

  • Gradle resolves aapt2 by classifier — it will never use the macOS binary on Windows. It would attempt to download the Windows variant separately.
  • If that download fails (due to CFSClean), it is no worse than the current situation (complete cache miss → same download failure).
  • All other dependencies (kotlin-stdlib, jna-platform, juniversalchardet, javax.annotation-api, AndroidX, etc.) are pure Java JARs that are byte-identical across platforms.

Net effect: Cross-OS fallback gives Windows ~95% of cached deps (all Java JARs). The only gap is aapt2-windows.jar, which still needs Maven Central access. This is strictly better than the current complete cache miss.

Cross-checked with Claude Sonnet 4.6, GPT Codex 5.3, and Goldeneye — all agree Gradle self-heals on incompatible cache entries (cache miss → regenerate, not crash).

Long-term fix

Request repo.maven.apache.org to be added to CFSClean allowlist. This cache fallback is a bridge until that happens.

The official build on release/10.0.1xx-sr6 (build 2956987) fails on
Pack Windows because no Windows-specific Gradle cache entry exists
for this branch scope. The macOS cache is populated but Windows gets
a cache miss, causing Gradle to hit repo.maven.apache.org which is
blocked by CFSClean network isolation policy.

Adding an OS-independent fallback restore key allows Windows to
bootstrap from the macOS-populated cache. Gradle dependencies are
predominantly platform-independent Java JARs. The only OS-specific
artifact (aapt2) is resolved by Maven classifier — Gradle will not
use the macOS binary on Windows, it will attempt to download the
Windows variant separately.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 21, 2026 21:20
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 35067

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 35067"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the shared Gradle caching template used by MAUI’s Azure DevOps pipelines to improve Windows “bootstrap” behavior when an OS-specific Gradle cache entry doesn’t exist in the available cache scope.

Changes:

  • Add an OS-independent Gradle cache restoreKeys fallback ("gradle" | "v1") so Windows agents can restore from any available Gradle cache entry (e.g., one produced on macOS) when Windows-specific keys miss.

@PureWeen PureWeen closed this Apr 21, 2026
@PureWeen PureWeen deleted the fix/gradle-cache-cross-os-fallback branch April 21, 2026 21:33
@github-actions github-actions Bot locked and limited conversation to collaborators May 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants