Repository navigation
[Build.Tasks] Remove legacy Android tooling resolution - #13161
Merged
simonrozsival merged 2 commits intoOct 19, 2026
Merged
simonrozsival merged 2 commits into
simonrozsival merged 2 commits into
Conversation
Product targets already use Xamarin.Android.Tasks.ResolveAndroidTooling. Only the old SDK fixture still exercises the Xamarin-era wrapper. Migrate its platform and timing coverage to the shipping task, retain SDK and Java validation, and cover current platform fallback and tooling errors. Remove unused subclass hooks and inputs together with six wrapper-only resource entries. Preserve historical diagnostic links and mark their legacy behavior explicitly. Leave SupportedVersions and SDK discovery behavior unchanged. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 10692d52-13c3-4c9b-b46d-96de1b3f92b5
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Two new tests depend on prior global initialization and fail when run independently.
1 open finding
What changed in this PR
Removes the unused Xamarin-era tooling resolver and moves its coverage to the shipping .NET for Android task.
Changes:
- Deletes the legacy wrapper, unused hooks, and task inputs.
- Migrates API-resolution tests and adds caching and missing-tool coverage.
- Removes six obsolete resources and marks historical diagnostics as legacy.
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/ResolveSdksTaskTests.cs | Migrates and expands modern resolver tests. |
| src/Xamarin.Android.Build.Tasks/Tasks/ResolveAndroidTooling.cs | Removes unused inputs and subclass hooks. |
| src/Xamarin.Android.Build.Tasks/Tasks/Legacy/ResolveAndroidTooling.cs | Deletes the legacy resolver. |
| src/Xamarin.Android.Build.Tasks/Properties/Resources.resx | Removes six wrapper-only resources. |
| src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs | Removes corresponding resource accessors. |
| src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.Tooling.targets | Removes obsolete task arguments. |
| Documentation/docs-mobile/TOC.yml | Labels retired diagnostics as legacy. |
| Documentation/docs-mobile/messages/xa0117.md | Clarifies historical applicability. |
| Documentation/docs-mobile/messages/xa0113.md | Distinguishes historical Google Play requirements. |
| Documentation/docs-mobile/messages/xa0001.md | Marks framework validation as legacy. |
| Documentation/docs-mobile/messages/xa0000.md | Marks framework mapping as legacy. |
| Documentation/docs-mobile/messages/index.md | Updates diagnostic summaries. |
Files not reviewed (1)
- src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs: Generated file
🧠 Review effort: Balanced
Initialize SupportedVersions explicitly in both new tooling tests. Without this setup they depend on an earlier ResolveSdks test and fail when selected independently in a fresh test process. Both individual filters now pass, and the focused SDK, Java and platform validation suite passes all 53 cases. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 10692d52-13c3-4c9b-b46d-96de1b3f92b5
simonrozsival
approved these changes
Oct 19, 2026
simonrozsival
enabled auto-merge (squash)
October 19, 2026 10:33
2 of 3 tasks
simonrozsival
pushed a commit
that referenced
this pull request
Oct 20, 2026
…te (#13201) `Xamarin.Android.Tasks.MonoAndroidHelper.SupportedVersions` is a mutable process-wide value. One project can replace the API data that another task uses. Remove that value and `RefreshSupportedVersions`, and pass `ReferenceAssemblyPaths` to each consumer. SDK discovery, Java validation, and legacy-tool cleanup are already merged in #13145, #13133, and #13161. This PR does not repeat those changes. It is the lower prerequisite for a separate nested-build optimization. **SDK and Java resolution call counts are unchanged**, including inner builds. Cache read-only `AndroidVersions` data through `IBuildEngine4` with `RegisteredTaskObjectLifetime.Build`. The key includes the task assembly identity and the absolute, original input directory list. The cache holds no task logger or mutable current-context pointer. Concurrent creation for an equal key is harmless; correctness does not depend on a cache shared across worker processes or assembly load contexts. All API-data consumers use explicit inputs: platform JAR and tooling resolution, manifests, aapt2, D8/R8, signing, jar2xml, launch activity/instrumentation, library resources, and dependency calculation. `ManifestDocument` keeps its own version resolver, with a known-version default for standalone use. Aapt2Link and library-resource generation resolve API metadata on the calling thread before yielding. The concurrency test runs 64 tasks against two different SDK/API datasets that map the same preview ID `Z` to API levels 127 and 128. It checks both JAR paths and API outputs. The aapt2 tests link two ABIs and require exactly one API lookup before `Yield`, with relative reference paths resolved from the task's captured working directory. Tests also check cache reuse, separate build engines, manifest resolver isolation, and library-resource metadata access before `Yield`.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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:Product targets already use
Xamarin.Android.Tasks.ResolveAndroidTooling. Only the old SDK test fixture referencesXamarin.Android.Tasks.Legacy.ResolveAndroidTooling, so keeping the wrapper maintains unused Xamarin-era framework mapping and obsolete diagnostics without exercising the shipping task in those tests.Delete the wrapper and migrate its parameterized and timing coverage to the modern task's
TargetPlatformVersion,AndroidApiLevel, andAndroidApiLevelName. Cover stable, preview, minor-version, missing/invalid-version fallback, AAPT2 caching, and missing-tool errors. Preserve SDK/tool path assertions, discovery-state isolation, absolute paths, Java validation, and redundant-output-logging assertions.Remove the now-unused subclass hooks and inputs (
Validate,LogOutputs,ProjectFilePath, andAndroidApplication) and their target arguments. Remove exactly six wrapper-only resources from the English resource file and designer: XA0001, XA0113, XA0117, and the three framework-mapping XA0000 variants. Retain the general XA0000 exception diagnostic, all non-English localization files, and historical documentation URLs; mark the retired diagnostics as legacy.MonoAndroidHelper.SupportedVersions, SDK discovery, Java validation, caching implementation, and nested-build forwarding are unchanged. This is an independent cleanup from main at bcdef48, not a stacked PR. No issue is closed, and no wall-time or task-wide thread-safety improvement is claimed.Local validation
Windows; prepared and built this isolated worktree's SDK (
12.0.100-alpha.1.26509.101, targeting .NET 11), not an installed workload or another worktree's binaries. Build/test processes setDOTNET_CLI_USE_MSBUILD_SERVER=0,MSBUILDDISABLENODEREUSE=1,DOTNET_CLI_TELEMETRY_OPTOUT=1, andTEST_ANDROID_JDK_PATH=C:\Program Files\Android\openjdk\jdk-21.0.8. SDK builds run afterC:\Program Files\Microsoft Visual Studio\18\Insiders\Common7\Tools\VsDevCmd.batin the same cmd process..\build.cmd Prepare— passed..\dotnet-local.cmd build Microsoft.Android.slnx -t:BuildDotNet -nr:false -v:minimal -bl:C:\Users\jopepper\.copilot\session-state\10692d52-13c3-4c9b-b46d-96de1b3f92b5\files\final-build.binlog— passed, 0 errors, 92 existing warnings (the comparison build with original tooling also has 92 warnings)..\dotnet-local.cmd test bin\TestDebug\net10.0\Xamarin.Android.Build.Tests.dll --filter "FullyQualifiedName~ResolveSdksTaskTests|FullyQualifiedName~ValidateJavaVersionTests|FullyQualifiedName~InvalidTargetPlatformVersion" --logger "trx;LogFileName=final-tooling.trx" --results-directory "C:\Users\jopepper\.copilot\session-state\10692d52-13c3-4c9b-b46d-96de1b3f92b5\files\test-results"— passed, 53/53, no skips. Invoked throughcmd /cto preserve the filter's pipe characters..\dotnet-local.cmd build bin\TestDebug\temp\BuildBasicApplicationCheckPdbRepeatBuildCoreCLR\UnnamedProject.csproj -t:Rebuild,SignAndroidPackage @bin\TestDebug\temp\BuildBasicApplicationCheckPdbRepeatBuildCoreCLR\project.rsp -nr:false -v:minimal -bl:C:\Users\jopepper\.copilot\session-state\10692d52-13c3-4c9b-b46d-96de1b3f92b5\files\app-rebuild-confirm.binlog— passed, 0 warnings/errors; signed APK produced..\dotnet-local.cmd build bin\TestDebug\temp\BuildBasicApplicationCheckPdbRepeatBuildCoreCLR\UnnamedProject.csproj -t:Build,SignAndroidPackage @bin\TestDebug\temp\BuildBasicApplicationCheckPdbRepeatBuildCoreCLR\project.rsp -nr:false -v:minimal -bl:C:\Users\jopepper\.copilot\session-state\10692d52-13c3-4c9b-b46d-96de1b3f92b5\files\app-incremental-confirm.binlog— passed, 0 warnings/errors. The generated response file selects this host's Android SDK/NDK and JDK 21.git diff --check, resource/target XML parsing, exact resource-removal comparison, and remaining-consumer/localization checks — passed. Inspected build/application binlogs usingbinlogtool.Existing additional-test failure
The initial combined run additionally selected
BuildBasicApplicationCheckPdbRepeatBuild(CoreCLR): 51 passed, 1 failed. Its app build succeeds, but the test then expectsobj\Debug\android\assets\x86_64\UnnamedProject.pdb; that file is absent (the arm64-v8a PDB is present).Reproduced the identical assertion after restoring
ResolveAndroidTooling.csandMicrosoft.Android.Sdk.Tooling.targetsto their original main versions, rebuilding the local SDK, and running:.\dotnet-local.cmd test bin\TestDebug\net10.0\Xamarin.Android.Build.Tests.dll --filter "FullyQualifiedName~BuildBasicApplicationCheckPdbRepeatBuild" --logger "trx;LogFileName=baseline-pdb.trx" --results-directory "C:\Users\jopepper\.copilot\session-state\10692d52-13c3-4c9b-b46d-96de1b3f92b5\files\test-results"— same 1/1 failure.The cleanup was restored and the full local SDK rebuilt before the final 53-case passing run and direct app build checks above. The unrelated PDB-location test is not modified by this PR. Device tests are not applicable to this host-only task cleanup.