Skip to content

[Microsoft.Android.Build.Tasks] Enable MT for package names - #13282

Merged
jonathanpeppers merged 1 commit into
dotnet:mainfrom
jonathanpeppers:jonathanpeppers-package-name-mt
Oct 27, 2026
Merged

jonathanpeppers merged 1 commit into
dotnet:mainfrom
jonathanpeppers:jonathanpeppers-package-name-mt

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Allow <GetAndroidPackageName/> to run in the MSBuild process during -mt builds instead of using a separate task process.

Use Microsoft.Android.Build.Tasks.MultithreadedAndroidTask and declare [MSBuildMultiThreadableTask] directly. Resolve manifest paths through TaskEnvironment before file access, without changing the public input or package selection. Add four path cases and one two-project isolation test; retain the existing Java identifier tests.

Local validation

Validation used SDK 11.0.100-rc.2.26504.105, MSBuild 18.12, and the matching .NET 11 runtime, reference pack, ILLink, and MonoTargets. Local-only version overrides and a workload-manifest compatibility change were needed for current main; neither is included in this PR.

  • dotnet-local.cmd build Microsoft.Android.slnx -t:BuildDotNet -c Release -nr:false -v:minimal after VS environment setup: passed, 92 existing warnings and zero errors.
  • dotnet-local.cmd test src\Microsoft.Android.Build.Tasks\Tests\Microsoft.Android.Build.Tasks.Tests\Microsoft.Android.Build.Tasks.Tests.csproj -c Release --filter FullyQualifiedName~GetAndroidPackageNameTests -p:MicrosoftNETCoreAppRefPackageVersion=11.0.0-rc.2.26504.105 -p:MicrosoftNETILLinkPackageVersion=11.0.0-rc.2.26504.105 -nr:false -v:minimal: passed 9/9.
  • Ordinary and strict -m -mt -nr:false -warnaserror:MSB4286,MSB4287,MSB4288 fixtures and real Android app builds: passed with matching outputs. Binlogs confirm two successful package-task calls in the app, zero TaskHost calls, and zero task messages. The APK CoreCLR and app CoreLib hashes match the .NET 11 runtime pack.

No linked issue.


Pull Request
title and
description
should follow the
commit-messages.md workflow documentation, and in particular should include:

  • Useful description of why the change is necessary.
  • Links to issues fixed
  • Unit tests

Run <GetAndroidPackageName/> in the MSBuild process during -mt builds
instead of sending its calls to a separate task process.

Use the multithreaded base and declare the task attribute directly.
Resolve manifest reads through TaskEnvironment without changing public
inputs or package selection.  Add focused path and project-isolation
tests while keeping the existing Java identifier checks.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 27, 2026 14:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the change enabling in-process, multithreaded package-name resolution.

No open issues 🎉

What changed in this PR

Enables GetAndroidPackageName to run in-process during multithreaded MSBuild builds while preserving its public inputs and package-selection behavior.

Changes:

  • Uses MultithreadedAndroidTask and declares [MSBuildMultiThreadableTask].
  • Resolves manifest paths through TaskEnvironment before file access.
  • Adds four manifest-path cases and a two-project isolation test, retaining existing Java identifier tests.
File Description
src/​Microsoft.Android.Build.Tasks/​Tests/​Microsoft.Android.Build.Tasks.Tests/​GetAndroidPackageNameTests.cs Adds path-resolution, input-preservation, and concurrent project-isolation coverage.
src/​Microsoft.Android.Build.Tasks/​Tasks/​GetAndroidPackageName.cs Enables multithreaded execution and project-relative manifest resolution.

Review effort: Balanced

@jonathanpeppers

Copy link
Copy Markdown
Member Author

@dalexsoto review

@jonathanpeppers
jonathanpeppers enabled auto-merge (squash) October 27, 2026 19:42

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the complete 2-file task/test change and the relevant task base, MSBuild environment/routing, production consumers and source tests. GetAndroidPackageName uses the per-project TaskEnvironment while preserving package-selection and diagnostic contracts. No high-confidence blockers remain in the bounded static review.

@jonathanpeppers
jonathanpeppers merged commit 6872e6a into dotnet:main Oct 27, 2026
41 checks passed
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.

3 participants