Skip to content

[build] Cache Gradle downloads between CI runs#10986

Draft
jonathanpeppers wants to merge 3 commits intomainfrom
dev/peppers/gradle-cache
Draft

[build] Cache Gradle downloads between CI runs#10986
jonathanpeppers wants to merge 3 commits intomainfrom
dev/peppers/gradle-cache

Conversation

@jonathanpeppers
Copy link
Member

Add a shared cache-gradle.yaml template using the Cache@2 task to persist ~/.gradle/caches between pipeline runs. This prevents transient DNS/network failures from breaking builds when resolving Maven Central dependencies (e.g. javaparser for java-source-utils).

The cache key includes Agent.OS, gradle-wrapper.properties, and all build.gradle files, so it auto-invalidates on Gradle version or dependency changes.

Used by all three build step templates (macOS, Linux, Windows) which covers Xamarin.Android, Xamarin.Android-PR, and dnceng-public pipelines.

Context: https://learn.microsoft.com/azure/devops/pipelines/release/caching

jonathanpeppers and others added 3 commits March 20, 2026 15:55
Add a shared `cache-gradle.yaml` template using the Cache@2 task to
persist `~/.gradle/caches` between pipeline runs. This prevents transient
DNS/network failures from breaking builds when resolving Maven Central
dependencies (e.g. javaparser for java-source-utils).

The cache key includes `Agent.OS`, `gradle-wrapper.properties`, and all
`build.gradle` files, so it auto-invalidates on Gradle version or
dependency changes.

Used by all three build step templates (macOS, Linux, Windows) which
covers Xamarin.Android, Xamarin.Android-PR, and dnceng-public pipelines.

Context: https://learn.microsoft.com/azure/devops/pipelines/release/caching

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The external/Java.Interop submodule is not checked out when the cache
step runs (submodules are initialized later during make jenkins). Use
only the main repo gradle-wrapper.properties and build.gradle files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Write the submodule commit hash to a temp file before the cache step
so the cache invalidates when Java.Interop is bumped (which may change
its build.gradle dependencies).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant