Repository navigation
[Xamarin.Android.Build.Tasks] Enable multithreaded cache reads - #13284
Conversation
Allow ReadImportedLibrariesCache to run in the MSBuild process with -mt instead of a separate task host. Use MultithreadedAndroidTask and resolve CacheFile through TaskEnvironment while preserving output paths, metadata, ordering and diagnostics. Add focused missing-cache, empty-cache and ordinary/strict multithreaded project tests. Register test folders for cleanup and failure log attachments. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The narrow migration uses existing multithreading infrastructure, includes focused regression coverage, and has no unresolved review findings.
No open issues 🎉
What changed in this PR
Enables ReadImportedLibrariesCache to run in-process with MSBuild multithreading while preserving existing cache behavior and output semantics.
Changes:
- Uses
MultithreadedAndroidTaskand declares[MSBuildMultiThreadableTask]. - Resolves the cache filename through
TaskEnvironmentbefore file access. - Adds regression coverage for missing and empty caches, concurrent project builds, output paths and metadata, and malformed XML.
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/ReadImportedLibrariesCacheTests.cs | Adds cache behavior and ordinary/strict multithreaded build tests. |
| src/Xamarin.Android.Build.Tasks/Tasks/ReadImportedLibrariesCache.cs | Enables multithreaded execution and project-relative cache resolution. |
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. ReadImportedLibrariesCache roots cache I/O in TaskEnvironment while preserving item order, metadata and error contracts. No high-confidence blockers remain in the bounded static review.
Allow
<ReadImportedLibrariesCache/>to run in the MSBuild process with-mt, instead of using a separate task host. Use the existingMultithreadedAndroidTaskbase, declare[MSBuildMultiThreadableTask]directly, and resolveCacheFilethroughTaskEnvironmentbefore file access.Keep the existing missing-cache behavior, output item paths, metadata, duplicate order, and XML errors. Add four focused test cases: missing cache, empty cache, and ordinary/strict multithreaded builds of two projects with the same relative cache filename. The build tests also check project-relative
FullPathvalues and malformed XML. Register test folders for automatic cleanup and failure log attachments.Validation uses an isolated .NET SDK
11.0.100-rc.2.26504.105, MSBuild18.12, and .NET 11 runtime/reference/ILLink/MonoTargets pins. Temporary build settings are not included in this PR.dotnet-local.cmd build Microsoft.Android.slnx -t:BuildDotNet -c Release --no-restore -nr:false -v:minimal— passed; zero errors.dotnet-local.cmd build src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Xamarin.Android.Build.Tests.csproj -c Release --no-restore -nr:false -v:minimal— passed after the cleanup fix; zero errors.dotnet-local.cmd test bin\TestRelease\net10.0\Xamarin.Android.Build.Tests.dll --filter "FullyQualifiedName~ReadImportedLibrariesCacheTests|FullyQualifiedName~MultiThreadedMigrationTests"— five passed, zero failures or skips.The project tests use
-m:2 -mt -nr:false -warnaserror:MSB4286,MSB4287,MSB4288for strict multithreaded execution.binlogtoolinspection confirmed actual reader execution without task-host routing, correct output paths, and no strict-mode path errors. No wall-time performance claim is made.No linked issue.
Pull Request
title and
description
should follow the
commit-messages.mdworkflow documentation, and in particular should include: