[tests] Isolate Maven resolution on CI#12199
Open
jonathanpeppers wants to merge 8 commits into
Open
Conversation
Route test Maven and Gradle resolution through dotnet-public-maven when RUNNINGONCI is set while retaining public repositories for local development. Teach generated Gradle projects to use the shared repository configuration and extend the mirror helper for tests that resolve Maven files without Gradle. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d21fe48a-552e-44ca-8c0b-739e7c2b7129
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates test infrastructure and Gradle test projects to ensure Maven/Gradle dependency resolution on CI uses the anonymous dotnet-public-maven Azure Artifacts mirror (per RUNNINGONCI=true) rather than reaching out to public repositories, while keeping existing public-repo behavior for local development.
Changes:
- Centralizes CI detection and Maven URL rewriting in
Xamarin.ProjectTools.TestEnvironment, and routesDownloadedCachedownloads through it. - Updates multiple test suites to select the Maven mirror on CI and to skip/adjust assertions for behaviors that differ on the mirror (e.g., uncached artifacts returning 401).
- Aligns generated and in-repo Gradle
settings.gradle(.kts)with sharedeng/gradle/*-repositories.gradlescripts; extendsmirror-dependencies.ps1to support direct Maven coordinate seeding.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs | Ensures AndroidMavenLibrary items use the CI mirror via TestEnvironment when running on CI. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/TestEnvironment.cs | Adds RUNNINGONCI detection and helpers to select the mirror and rewrite Maven Central/Google download URLs on CI. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DownloadedCache.cs | Rewrites download URLs through TestEnvironment.GetTestDownloadUrl() to enforce mirror usage on CI. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/AndroidGradleProject.cs | Generates settings.gradle.kts using shared eng/gradle repository scripts and avoids downloading alternate Gradle distributions on CI. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/MavenDownloadTests.cs | Switches to TestEnvironment mirror selection on CI; skips tests whose expected 404 behavior differs on the mirror; removes null-forgiving usage in touched code. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BindingBuildTest.cs | Sets Maven repository metadata via TestEnvironment to enforce mirror usage on CI. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidGradleProjectTests.cs | Skips multi-Gradle-version test cases on CI to avoid public Gradle distribution downloads. |
| external/Java.Interop/tools/java-source-utils/settings.gradle | Uses shared eng/gradle repository scripts for plugin/dependency resolution. |
| external/Java.Interop/tools/java-source-utils/build.gradle | Removes per-project repositories { mavenCentral() } to rely on shared settings-based repository policy. |
| external/Java.Interop/tests/Java.Interop.Tools.Maven-Tests/Extensions/MavenProjectResolver.cs | Selects the mirror repository on CI for Java.Interop Maven tests while keeping existing local behavior. |
| eng/gradle/mirror-dependencies.ps1 | Adds -MavenArtifact mode to seed the mirror directly for tests that fetch Maven artifacts without Gradle. |
| .github/instructions/gradle.instructions.md | Documents the new direct Maven-coordinate seeding mode for the mirror helper script. |
Redth
approved these changes
Jul 21, 2026
Put each importing test project Kotlin intermediates under its own obj directory so concurrent solution builds cannot remove another compiler classpath snapshot. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d21fe48a-552e-44ca-8c0b-739e7c2b7129
Select the Gradle executable already installed on CI agents so Java.Interop test builds do not download a distribution from services.gradle.org. Local builds continue using the repository wrapper. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d21fe48a-552e-44ca-8c0b-739e7c2b7129
Hosted Windows and macOS agents do not provide Gradle on PATH. Remove the preinstalled-Gradle override so Java.Interop jobs use their checked-in wrapper again while the isolated Gradle distribution awaits feed seeding. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d21fe48a-552e-44ca-8c0b-739e7c2b7129
Run restore out of process before BootstrapTasks and workloads builds. This ensures generated NuGet path properties are imported on clean agents instead of evaluating MonoUnixNative.targets with an empty PkgMono_Unix path. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d21fe48a-552e-44ca-8c0b-739e7c2b7129
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Authenticate Azure Artifacts Maven requests with the Azure DevOps OAuth token as a Basic credential, and disable Gradle configuration caching while the credential provider runs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d21fe48a-552e-44ca-8c0b-739e7c2b7129
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Run mirror resolution anonymously with configuration caching enabled so it discovers the same lazy Kotlin and lint classpaths as CI. Seed each 401 through the authenticated HTTP path instead of loading a Gradle credential provider. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d21fe48a-552e-44ca-8c0b-739e7c2b7129
Pin BindFacebook to the mirrored 18.3.0 release and teach the mirror helper to seed payloads that Gradle probes with HEAD as well as GET. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d21fe48a-552e-44ca-8c0b-739e7c2b7129
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
title and
description
should follow the
commit-messages.mdworkflow documentation, and in particular should include:Summary
CFSClean reports test jobs that resolve Maven dependencies and Gradle plugins directly from public services. CI must instead use the anonymous
dotnet-public-mavenAzure Artifacts feed without falling back to public repositories, while local development should retain the existing public repository behavior.This change centralizes that policy around the existing
RUNNINGONCIconvention:eng/gradlerepository scripts.java-source-utilsno longer declaresmavenCentral()independently.mirror-dependencies.ps1gains a direct Maven coordinate mode for seeding tests that do not use Gradle.No public-network fallback is present on CI. Anonymous probes identified uncached test artifacts, which must be seeded with the mirror helper before those CI cases can pass.
Testing
java-source-utilsdependencies through the CI feed.dotnet-public-maven; resolution reached the expected uncached AGP 9.1.1 marker.