Repository navigation
[xabt] Enable MT execution for ResolveAndroidTooling - #13323
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The expanded test would still pass with process-wide environment and working-directory values, leaving project-specific child-process execution without regression coverage.
What changed in this PR
Enables ResolveAndroidTooling to run in-process during multithreaded MSBuild execution by using project-specific paths and environment settings instead of process-wide state.
Changes:
- Migrates the task to
MultithreadedAndroidTaskwith a direct execution attribute. - Uses
TaskEnvironmentfor tool discovery and aapt2 launches, and runtime platform detection for bundled tool paths. - Extends cache tests to cover separate project directories, relative paths, and project-specific
PATHEXT.
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Utilities/MonoAndroidHelper.Nullable.cs | Adds executable lookup using the project environment. |
| src/Xamarin.Android.Build.Tasks/Utilities/MonoAndroidHelper.cs | Uses runtime platform detection for OS-specific tool paths. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/ResolveSdksTaskTests.cs | Expands project-isolation and cache-reuse coverage. |
| src/Xamarin.Android.Build.Tasks/Tasks/ResolveAndroidTooling.cs | Enables multithreaded execution and project-scoped path and process handling. |
Review effort: Balanced
jonathanpeppers
commented
Oct 29, 2026
jonathanpeppers
force-pushed
the
jonathanpeppers-mt-android-tooling
branch
from
October 29, 2026 22:01
4edfa33 to
cf6b539
Compare
jonathanpeppers
changed the base branch from
main
to
jonathanpeppers-mt-java-version-validation
October 29, 2026 22:02
simonrozsival
approved these changes
Oct 30, 2026
Base automatically changed from
jonathanpeppers-mt-java-version-validation
to
main
October 30, 2026 14:51
Resolve tooling paths and PATHEXT against the project environment, and run aapt2 with that environment. Keep version caches isolated by absolute paths and extend the existing cache test to cover distinct projects and relative paths. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use a faux aapt2 whose version combines a project environment variable with a file read from the project directory. Keep the existing cache reuse and project isolation checks. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the TaskEnvironment overload supplied by the ValidateJavaVersion change instead of keeping a second process-launch implementation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
jonathanpeppers
force-pushed
the
jonathanpeppers-mt-android-tooling
branch
from
October 30, 2026 14:51
cf6b539 to
ec61c11
Compare
Member
Author
|
@dalexsoto review |
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.

Stacked on #13322. Reuse its
MonoAndroidHelper.RunProcess(TaskEnvironment, …)overload for the aapt2 version probe.ResolveAndroidToolingstill requires process-wide working-directory and environment handling under-mt. UseMultithreadedAndroidTaskand declare[MSBuildMultiThreadableTask]so it can run in-process with other tasks.Resolve SDK and tool paths through
TaskEnvironment, use project-specificPATHEXT, and start aapt2 with the project environment. Keep the existing tool search order and diagnostics. Extend the existing cache test to cover distinct project directories, relative paths, child-process environment and working directory, and cache reuse.Validated on Windows with a locally built .NET 11 RC2 SDK after rebasing:
bin\Debug\dotnet\dotnet.exe build Microsoft.Android.slnx -m:4 -nr:false -v:minimal: passed, including the task-authoring analyzer; 0 errors.dotnet-local.cmd test bin\TestDebug\net10.0\Xamarin.Android.Build.Tests.dll --filter "(FullyQualifiedName~ResolveSdksTaskTests|FullyQualifiedName~ValidateJavaVersionTests|Name~MigratedTasksHaveDirectAttribute)&Name!~ToolingTargetRejectsOldJavaForModernAndroidApi": passed, 62 tests. The two excluded parent integration cases failed before reaching the tasks withNETSDK1147(missing Android workload). Local workload setup was attempted; it is blocked by the .NET 11 RC2 SDK lacking themicrosoft-net-runtime-mono-tooling-net11workload referenced by the current manifest.bin\Debug\dotnet\dotnet.exe msbuild <validation>\parallel-tooling.proj -m -nr:false -v:minimal: passed. The local harness runs two actual task instances and checks API level, build-tools path, and aapt2 version.-m -mt -nr:false -warnaserror:MSB4286,MSB4287,MSB4288: passed.binlogtoolfound no TaskHost fallback or MT safety diagnostics.Before rebasing, the 7
MultithreadedAndroidTaskTestspassed, including file-lock diagnostics. The expanded cache test was also confirmed to fail separately for a wrong child working directory and a missing project environment variable.Temporary .NET 11 build settings and the local test-only change that prevents teardown from killing shared adb processes were restored before commit. No device tests were needed for this tooling-only change.