Repository navigation
[Xamarin.Android.Build.Tasks] Run define constants in-process - #13283
Merged
jonathanpeppers merged 1 commit intoOct 27, 2026
Merged
jonathanpeppers merged 1 commit into
jonathanpeppers merged 1 commit into
Conversation
Allow <GetAndroidDefineConstants/> to run in the MSBuild process when multithreaded builds use -mt. The task builds an in-memory list of constants, so it does not need a separate task host. Use the existing multithreaded base and declare the task attribute directly. Keep constant generation unchanged and add focused tests for API levels, version sanitizing, and invalid input. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The narrow migration preserves generation logic, has focused test coverage and reported strict multithreaded validation, and has no unresolved review findings.
No open issues 🎉
What changed in this PR
This PR enables GetAndroidDefineConstants to run in-process during multithreaded MSBuild builds without changing constant generation.
Changes:
- Switches the task to
MultithreadedAndroidTaskand declares[MSBuildMultiThreadableTask]directly. - Adds five test cases covering major/minor API levels, prior QPR constants, product-version sanitizing, and invalid input.
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/GetAndroidDefineConstantsTests.cs | Adds focused constant-generation and invalid-input tests. |
| src/Xamarin.Android.Build.Tasks/Tasks/GetAndroidDefineConstants.cs | Enables in-process execution through the existing multithreaded task infrastructure. |
Review effort: Balanced
Member
Author
|
@dalexsoto review |
jonathanpeppers
enabled auto-merge (squash)
October 27, 2026 19:42
dalexsoto
approved these changes
Oct 27, 2026
dalexsoto
left a comment
Member
There was a problem hiding this comment.
Reviewed the complete 2-file task/test change and the relevant task base, MSBuild environment/routing, production consumers and source tests. GetAndroidDefineConstants retains stateless execution, ordered constants, parsing and MSBuild integration. No high-confidence blockers remain in the bounded static 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.
<GetAndroidDefineConstants/>only constructs an in-memory list, but its legacy base prevents in-process execution during MSBuild-mtbuilds. Use the existing multithreaded base and declare[MSBuildMultiThreadableTask]directly on the task. Constant generation is unchanged.Add five focused cases for major/minor API levels, prior QPR constants, product-version sanitizing, and invalid input. The existing migration guard checks the attribute and base class. No linked issue.
Validation
Validation used an isolated .NET 11 SDK (
11.0.100-rc.2.26504.105) and temporary .NET 11 package overrides, including an explicit runtime-pack version. These overrides are not part of this PR..\dotnet-local.cmd build Microsoft.Android.slnx -t:BuildDotNet -c Release -nr:false -v:minimal- passed; 92 warnings, no errors..\dotnet-local.cmd build src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Xamarin.Android.Build.Tests.csproj -c Release --no-restore -p:BuildProjectReferences=false -nr:false -v:minimal- passed; no warnings or errors..\dotnet-local.cmd test bin\TestRelease\net10.0\Xamarin.Android.Build.Tests.dll --filter "FullyQualifiedName~GetAndroidDefineConstantsTests|FullyQualifiedName~MultiThreadedMigrationTests"- passed, 6/6 tests, none skipped.Separate two-project probes passed in ordinary and strict
-m:2 -mt -nr:false -warnaserror:MSB4286,MSB4287,MSB4288builds.binlogtoolconfirmed two task calls without task-host routing; ordered output items and metadata matched across modes. A Release APK build also confirmed .NET 11 SDK, reference, ILLink, MonoTargets, CoreCLR, and CoreLib selections.Pull Request
title and
description
should follow the
commit-messages.mdworkflow documentation, and in particular should include: