Repository navigation
[build] Avoid staging unchanged framework assemblies - #12448
Conversation
Package non-Android framework assemblies directly from runtime packs instead of opening and copying them into project intermediates. Keep project-local zero-byte scan markers for downstream typemap and JCW consumers. Co-authored-by: Copilot <[email protected]> Copilot-Session: 6469f820-c19a-4450-8bb9-de70387d899c
|
/review |
|
There was a problem hiding this comment.
Pull request overview
This PR optimizes the .NET for Android build pipeline by identifying framework/runtime-pack assemblies that cannot contain Android types and avoiding unnecessary staging/copying and Cecil-based processing for those assemblies in Debug/no-shrink scenarios, while preserving the scan “sidecar” contract via zero-byte markers.
Changes:
- Introduces
%(AndroidSkipAssemblyModification)=Truemetadata for non-Android framework/runtime-pack assemblies duringProcessAssemblies. - Updates
_LinkAssembliesNoShrinkincrementalism and processing to emit a single zero-byte scan marker (.scan.empty) instead of staging the DLL for those assemblies. - Updates JCW and typemap consumers to resolve sidecar paths from item metadata when provided (falling back to the historical “next to assembly” convention otherwise), enabling the marker-based flow.
Show a summary per file
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets | Splits resolved assemblies/symbols into “link-no-shrink” vs “package without modification” groups and updates _LinkAssembliesNoShrink Outputs to include marker files for skipped assemblies. |
| src/Xamarin.Android.Build.Tasks/Utilities/TypeMapObjectsXmlFile.cs | Adds ITaskItem overload to resolve typemap XML path from item metadata (supporting marker files). |
| src/Xamarin.Android.Build.Tasks/Utilities/TypeMapGenerator.cs | Switches typemap lookup to the new ITaskItem-aware path resolver. |
| src/Xamarin.Android.Build.Tasks/Utilities/JavaObjectsXmlFile.cs | Adds ITaskItem overload to resolve JLO XML path from item metadata (supporting marker files). |
| src/Xamarin.Android.Build.Tasks/Tasks/ProcessAssemblies.cs | Sets FrameworkAssembly, HasMonoAndroidReference, and new AndroidSkipAssemblyModification metadata (including for symbol items). |
| src/Xamarin.Android.Build.Tasks/Tasks/LinkAssembliesNoShrink.cs | Skips the pipeline for marked assemblies and writes a zero-byte .scan.empty marker file. |
| src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaCallableWrappers.cs | Uses the ITaskItem-aware JLO path resolver so marker files work. |
| src/Xamarin.Android.Build.Tasks/Tasks/GenerateACWMap.cs | Uses the ITaskItem-aware JLO path resolver so marker files work. |
| src/Xamarin.Android.Build.Tasks/Tasks/AssemblyModifierPipeline.cs | Adds an overridable fast-path hook (TryProcessWithoutPipeline) used by LinkAssembliesNoShrink. |
| src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.AssemblyResolution.targets | Updates _PrepareAssemblies to stage only modified assemblies while keeping non-Android framework assemblies sourced from runtime-pack locations. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 0
- Review effort level: Lite
Keep conditional output metadata on the original ResolvedAssemblies items so MSBuild can correlate inputs and outputs during partial builds. Co-authored-by: Copilot <[email protected]> Copilot-Session: 986b59ba-93bf-46dc-a6c0-4f01dd7e2b3f
|
/review |
|
✅ Android PR Reviewer completed successfully!
|
There was a problem hiding this comment.
The runtime-pack optimization is coherently wired through assembly classification, marker creation, MSBuild item transforms, and both scanner consumers. CI build 1560590 and all reported checks are green. The remaining concern is automated regression coverage for the new packaging/marker/no-op path; the existing test cited in the PR does not exercise that branch.
Generated by Android PR Reviewer for #12448 · gpt56 · 254.2 AIC · ⌖ 8.93 AIC · ⊞ 25.7K
Comment /review to run again
Verify runtime-pack packaging, shared scan markers, Android framework staging, and no-op incremental behavior. Co-authored-by: Copilot <[email protected]>
|
/review |
|
✅ Android PR Reviewer completed successfully!
|
There was a problem hiding this comment.
⚠️ Needs Changes
Findings: 0 errors · 1 warning · 0 suggestions
The item-group split and zero-byte sidecar marker are coherent, and the new test verifies direct runtime-pack packaging plus no-op incremental behavior for CoreCLR. The remaining gap is coverage of MonoVM's distinct discrete-assembly/PDB packaging path.
CI build 1561960 is still in progress; CLA and the completed Android Tools Tests Mac check are green, with no failures reported so far.
Generated by Android PR Reviewer for #12448 · gpt56 · 229.3 AIC · ⌖ 8.86 AIC · ⊞ 25.7K
Comment /review to run again
| EmbedAssembliesIntoApk = true, | ||
| Imports = { captureFrameworkAssemblies }, | ||
| }; | ||
| proj.SetRuntime (AndroidRuntime.CoreCLR); |
There was a problem hiding this comment.
🤖 WrapAssembliesAsSharedLibraries packages each DLL/PDB directly. Please parameterize this coverage for MonoVM (including the discrete assembly and symbol archive entries) so the new runtime-pack source paths are verified on both packaging paths.
Rule: Test changed behavior across configurations
There was a problem hiding this comment.
MonoVM Android builds are no longer supported on .NET 11. Attempting to parameterize this test for AndroidRuntime.MonoVM fails with NETSDK1242 before reaching _LinkAssembliesNoShrink or the discrete packaging path. MonoVM build-test variants were intentionally removed in d115ab9cd and 72788a388 for this reason. Also, the runtime pack does not ship Microsoft.CSharp.pdb, so there is no skipped-framework symbol entry to assert. The existing CoreCLR case covers the supported Debug/no-shrink path affected by this PR.
|
I think this change breaks the debugger in VS Code: It looks in the
Should we revert this for now? |
yeah, I'll open a PR. |
## Summary - revert #12448 - restore project-local staging for unchanged framework assemblies - preserve the satellite assembly scan-marker fix from #12496 ## Validation - `dotnet build src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj --no-restore --nologo` Co-authored-by: Copilot App <[email protected]>
Summary
ProcessAssembliesMono.AndroidandJava.InteropI/O impact
For a clean MAUI Debug LLVM-IR build on arm64, the assembly staging directory changed from approximately 327 DLLs / 160.6 MiB to 145 DLLs / 93.3 MiB. This avoids 182 DLL copies and about 67 MiB of project-local staging writes.
Validation
Xamarin.Android.Build.Tasks.csprojMicrosoft.CSharp.dllis packaged from the runtime pack and represented locally by a scan markerMono.Android.dllis still staged, scanned, and present in the generated native typemapLinkAssembliesNoShrinkis skipped on a no-op buildMultiTfmTransitiveReferenceCoreCLR regression coverageRelated: #10958