Repository navigation
[Xamarin.Android.Build.Tasks] Move simple task logic to targets - #13287
jonathanpeppers merged 1 commit into
Conversation
MSBuild -mt runs tasks without thread support in external task hosts. Express simple checks and item filtering in targets instead of keeping custom tasks for this work. Use AndroidError and AndroidWarning with file associations for XA0100 and XA0101. Report all invalid libraries, then stop downstream targets on the final error. Filter runtime library stubs with MSBuild items and remove the legacy Mono package check. Add focused project-build tests beside the related existing tests. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
Customer-facing target batching and runtime-packaging changes warrant human confirmation of the reported validation before approval.
No open issues 🎉
1 file not reviewed
src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs: Generated file
What changed in this PR
Moves simple .NET for Android build checks and runtime-library filtering from custom tasks into MSBuild targets, reducing task overhead in multithreaded builds without claiming a measured build-time improvement.
Changes:
- Reuses
AndroidErrorandAndroidWarningfor file-associated diagnostics and makes XA0101 localizable. - Replaces runtime-pack filtering with target-local items and removes three obsolete tasks.
- Adds regression coverage for diagnostics, downstream build stopping, and runtime-library filtering.
| File | Description |
|---|---|
src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets |
Replaces project-check and content-warning tasks with target logic. |
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/InvalidConfigTests.cs |
Tests embedded-library errors and downstream build stopping. |
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildWithLibraryTests.cs |
Tests content-warning suppression and warning-as-error behavior. |
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest2.cs |
Tests runtime stub filtering and retained libraries. |
src/Xamarin.Android.Build.Tasks/Tasks/ProcessRuntimePackLibraryDirectories.cs |
Removes the replaced runtime-filtering task. |
src/Xamarin.Android.Build.Tasks/Tasks/LogWarningsForFiles.cs |
Removes the replaced warning-wrapper task. |
src/Xamarin.Android.Build.Tasks/Tasks/CheckProjectItems.cs |
Removes the replaced project-validation task. |
src/Xamarin.Android.Build.Tasks/Tasks/AndroidWarning.cs |
Adds diagnostic file association. |
src/Xamarin.Android.Build.Tasks/Tasks/AndroidError.cs |
Adds diagnostic file association. |
src/Xamarin.Android.Build.Tasks/Properties/Resources.resx |
Adds the localizable XA0101 message. |
src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs |
Adds the XA0101 resource accessor. |
src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.AssemblyResolution.targets |
Filters system library stubs using target-local items. |
Documentation/docs-mobile/messages/index.md |
Removes obsolete task-prefix entries. |
Review effort: Balanced
|
/review |
|
@dalexsoto review |
|
🚀 Android PR Reviewer has started processing this issue comment |
|
The automated reviewer run did not produce a usable review: https://github.com/dotnet/android/actions/runs/40700757014/job/122862037169 The saved agent transcript shows that it loaded the code-review skill and searched for the GitHub PR-reading tool, then ended without reading the diff or recording findings. The review-output file is empty. The conclusion job failed with This was a reviewer-run failure, not a completed review with no findings. |
|
@jonathanpeppers Not reviewing this request in this iteration: The read-only review worker stopped with an authorization error: "401 You do not have access to the organization tied to the API key." It did not produce a complete review. GitHub access is working, and the request and partial source evidence are preserved; I am withholding a formal decision rather than treating the failed attempt as a clean review. |
Replace three custom tasks with MSBuild item operations and file-aware XA0100 and XA0101 diagnostics. Preserve the release branch's Mono AOT and runtime-pack library directory discovery for native linking. (cherry picked from commit d48225b) Co-authored-by: Copilot App <[email protected]>
MSBuild
-mtis the motivation for this change. Tasks without multithreaded execution support run in external task hosts, even when their work is only a condition or an item check. Express that work in targets instead of maintaining custom tasks for it.Replace
CheckProjectItemsandLogWarningsForFileswith the existingAndroidErrorandAndroidWarningtasks, adding file association support to both. XA0100 still reports each offending file and stops downstream build work on the final error. XA0101 keeps its text, file association, exclusions, suppression, and warning-as-error behavior, and now uses a localizable resource.Replace
ProcessRuntimePackLibraryDirectorieswith target-local item filtering for the five system library stubs. Keep case-insensitive filename/package matching and require RID metadata. Remove the obsolete Mono package check; CoreCLR and NativeAOT remain. Keep the existing target hooks and remove the three unused task classes and registrations.This is not a measured wall-time speedup claim. In representative .NET 11 C# incremental captures with two Content files, total scheduled tasks changed from 254 to 253 and task messages from 1662 to 1657. External task-host calls stayed at 31: two batched
AndroidWarningcalls replace one warning-wrapper call and the empty project-check call. The removed runtime filter already ran in-process.Validation
Used a locally built Release Android SDK with .NET SDK
11.0.100-rc.2.26504.105, framework/reference/runtime11.0.0-rc.2.26504.105, ILLink 11, and MonoTargets 11. Verified managed/native APK runtime hashes. Temporary version overrides were removed from the diff. Tests use JDK 21 and the local Android SDK/NDK.call .\dotnet-local.cmd build Microsoft.Android.slnx -t:BuildDotNet -c Release -nr:false -v:minimal -bl:remove-mono-sdk.binlogafter VS 18 InsidersVsDevCmd.bat: passed, 207 existing warnings, 0 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:quiet: passed after the final test cleanup, 0 errors..\dotnet-local.cmd test bin\TestRelease\net10.0\Xamarin.Android.Build.Tests.dll --filter "Name~EmbeddedLibraries|Name~ContentWarnings|Name~RuntimeLibraryFiltering|Name~CheckContentBuildAction|Name~ContentBuildActionForRazor|Name~NonAndroidNativeLibrariesDoNotProduceWarnings": passed, 12 cases before removing the duplicate valid-library case..\dotnet-local.cmd test bin\TestRelease\net10.0\Xamarin.Android.Build.Tests.dll --filter "Name~EmbeddedLibraries": passed, both remaining cases after that removal..\dotnet-local.cmd build <probe>\TargetLogicProbe.csproj -c Debug --no-restore -m -nr:false -v:minimal -bl:modified-ordinary.binlog: passed with two expected XA0101 warnings..\dotnet-local.cmd build <probe>\TargetLogicProbe.csproj -c Debug --no-restore -m -mt -nr:false -warnaserror:MSB4286,MSB4287,MSB4288 -v:minimal -bl:modified-mt.binlog: passed with two expected XA0101 warnings. Inspected saved binlogs withbinlogtool.Source issue: N/A.
Pull Request
title and
description
should follow the
commit-messages.mdworkflow documentation, and in particular should include: