Skip to content

[Xamarin.Android.Build.Tasks] Enable MT library imports cache reads - #13285

Merged
jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-library-imports-cache-mt
Oct 27, 2026
Merged

jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-library-imports-cache-mt

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Allow <ReadLibraryProjectImportsCache/> to run in process during multithreaded MSBuild builds instead of requiring a separate task host. Resolve the cache file through TaskEnvironment, while preserving empty/missing cache behavior, output items, metadata, and logging.

Add small relative-path and missing-cache tests to the existing MultiThreadedMigrationTests fixture. Leave existing build tests and shared XML helpers unchanged.

Validation

  • .\dotnet-local.cmd build Microsoft.Android.slnx -t:BuildDotNet -c Release -nr:false -v:minimal -bl:sdk-build-final.binlog - passed, 92 warnings and zero errors. Used private .NET 11 RC2 SDK/runtime pins and a compatible workload manifest; temporary source settings were restored.
  • .\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:quiet -bl:migration-tests-build.binlog - passed, zero warnings and errors.
  • .\dotnet-local.cmd test bin\TestRelease\net10.0\Xamarin.Android.Build.Tests.dll --filter FullyQualifiedName~MultiThreadedMigrationTests --logger "trx;LogFileName=cache-reader-migration.trx" --results-directory TestResults -v:minimal - all four tests passed.
  • Ordinary and strict -m:2 -mt -nr:false -warnaserror:MSB4286,MSB4287,MSB4288 task checks passed. Two overlapping calls ran in one process without task hosts. All seven output groups, including relative identities, metadata, and project-relative FullPath, matched across two project directories. Error cases retained their expected failures. Binlogs were inspected with binlogtool.

Related issue: N/A.


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

Allow <ReadLibraryProjectImportsCache/> to run in process during
multithreaded MSBuild builds.  Use the task environment to resolve the
cache file instead of the shared process working directory.

Preserve empty and missing cache behavior, output items, metadata and
logging.  Add relative-path and missing-cache tests to the existing
migration test fixture.

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:46

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

The focused migration has no identified blocking issues, and reported validation covers regression tests and strict multithreaded execution.

No open issues 🎉

What changed in this PR

Enables ReadLibraryProjectImportsCache to run in-process during multithreaded MSBuild builds while preserving existing cache outputs and missing-cache behavior.

Changes:

  • Migrates the task to MultithreadedAndroidTask and adds the direct multithreading attribute.
  • Resolves cache paths through TaskEnvironment.
  • Adds tests for project-relative cache paths and empty or missing cache files.
File Description
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Tasks/​MultiThreadedMigrationTests.cs Adds relative-path and missing-cache regression tests.
src/​Xamarin.Android.Build.Tasks/​Tasks/​ReadLibraryProjectImportsCache.cs Enables multithreaded execution and project-relative cache access.

Review effort: Balanced

@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Oct 27, 2026
@jonathanpeppers

Copy link
Copy Markdown
Member Author

@dalexsoto review

@jonathanpeppers
jonathanpeppers enabled auto-merge (squash) October 27, 2026 21:51

@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. ReadLibraryProjectImportsCache uses the project environment while preserving all seven outputs and existing consumer contracts. No high-confidence blockers remain in the bounded static review.

@jonathanpeppers
jonathanpeppers merged commit d26fa45 into main Oct 27, 2026
42 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-library-imports-cache-mt branch October 27, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants