Repository navigation
[Xamarin.Android.Build.Tasks] Enable MT library imports cache reads - #13285
Conversation
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>
There was a problem hiding this comment.
🟢 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
MultithreadedAndroidTaskand 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
|
@dalexsoto review |
dalexsoto
left a comment
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. ReadLibraryProjectImportsCache uses the project environment while preserving all seven outputs and existing consumer contracts. No high-confidence blockers remain in the bounded static review.
Allow
<ReadLibraryProjectImportsCache/>to run in process during multithreaded MSBuild builds instead of requiring a separate task host. Resolve the cache file throughTaskEnvironment, while preserving empty/missing cache behavior, output items, metadata, and logging.Add small relative-path and missing-cache tests to the existing
MultiThreadedMigrationTestsfixture. 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.-m:2 -mt -nr:false -warnaserror:MSB4286,MSB4287,MSB4288task checks passed. Two overlapping calls ran in one process without task hosts. All seven output groups, including relative identities, metadata, and project-relativeFullPath, matched across two project directories. Error cases retained their expected failures. Binlogs were inspected withbinlogtool.Related issue: N/A.
Pull Request
title and
description
should follow the
commit-messages.mdworkflow documentation, and in particular should include: