[release/11.0.1xx-rc1] Fix incremental APK archives and NuGet cache writes - #12463
Open
jonathanpeppers wants to merge 2 commits into
Open
[release/11.0.1xx-rc1] Fix incremental APK archives and NuGet cache writes#12463jonathanpeppers wants to merge 2 commits into
jonathanpeppers wants to merge 2 commits into
Conversation
* Initial plan * Fix BuildArchive jar entry retention Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Update stale BuildArchive jar entries Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Cover up-to-date BuildArchive jar entries Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Address BuildArchive review feedback Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Address BuildArchive validation feedback Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Address review: null-check jar.ReadEntry result; create secondJar on disk in duplicate test Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Address review: consistent log path format, re-add stale entry to cleanup on missing jar entry, add null-jar-entry test Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Address review: [] collection expressions in tests, CRC comment, ContainsEntry before ReadEntry Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Test consecutive BuildArchive updates Exercise three unchanged archive builds so the regression test detects the original alternating JAR-entry removal while continuing to verify stale-entry cleanup. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3f5c44bc-27d8-41e9-b3ae-8585e08c00de --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com> Co-authored-by: Šimon Rozsíval <simon@rozsival.com> Copilot-Session: 3f5c44bc-27d8-41e9-b3ae-8585e08c00de Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5834c55d-890a-4cd1-9451-8fa37964e0a9
## Description Android builds must treat the NuGet global package cache as read-only. However, satellite `*.resources.dll` files from NuGet packages were included in `ResolvedAssemblies` and passed to `AssemblyModifierPipeline` using their original package-cache paths. When marshal methods were enabled, `_RunAfterILLinkAdditionalSteps` ran this pipeline in place. Even unchanged assemblies had their timestamps updated, and concurrent builds could fail when they attempted to write the same cached file. Exclude satellite resource assemblies from the post-link modifier input only when the pipeline operates in place. The assemblies remain in the normal resolved-assembly flow, so they are still packaged, and non-in-place post-link processing is unchanged. Add a regression test using `Humanizer.Core.es` from the public `dotnet-public` feed. It locks the package's resource assemblies and verifies that the build neither writes to them nor changes their timestamps. ## Tests - `BuildDoesNotModifyNuGetPackageCache` - `CheckIncludedAssemblies(True, CoreCLR)` Fixes #11022 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5834c55d-890a-4cd1-9451-8fa37964e0a9
Contributor
There was a problem hiding this comment.
Pull request overview
Backport of two customer-facing build correctness fixes into the release/11.0.1xx-rc1 branch: (1) make incremental BuildArchive updates correctly retain/replace/remove JAR-sourced APK entries, and (2) prevent in-place post-link processing from mutating satellite assemblies located in the NuGet global packages cache (avoiding cache corruption and concurrent-build write failures).
Changes:
- Update
BuildArchiveto distinguish existing output entries vs. current-build duplicates, skip up-to-date JAR entries, replace stale entries, and remove entries when the source JAR entry is missing. - Filter
AssemblyModifierPipelinein-place inputs to exclude*.resources.dllassemblies to avoid writes into the NuGet package cache. - Add regression tests covering both the incremental APK archive behavior and the NuGet cache immutability scenario.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets | Filters post-link in-place SourceFiles to exclude satellite resource assemblies so NuGet cache files aren’t touched. |
| src/Xamarin.Android.Build.Tasks/Tasks/BuildArchive.cs | Improves incremental archive update logic for existing JAR-sourced entries (skip/replace/remove correctly). |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/BuildArchiveTests.cs | Adds focused unit tests validating incremental behavior for existing JAR entries. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs | Adds integration regression test ensuring builds don’t write to/retimestamp NuGet cached satellite assemblies. |
jonathanpeppers
enabled auto-merge (squash)
August 20, 2026 20:19
Member
Author
|
@dalexsoto review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
286b38c3109cd39b5512fcfd23530e7cbba7db6f) so incrementalBuildArchiveupdates retain unchanged JAR resources, replace updated entries, and remove stale entries correctly.66d3f745f5b231e5c82b78ee9fcf105f883dd9bd) so in-place post-link processing excludes satellite assemblies from the NuGet package cache, while preserving normal packaging and non-in-place behavior.RC1 justification
These are narrowly scoped customer-facing correctness and reliability fixes. They prevent stale or incorrect APK contents during incremental builds, prevent mutation of NuGet package-cache assemblies, and avoid concurrent-build XAAMP7024 failures caused by writes to shared cached satellite assemblies.
There are no public API changes and no dependency changes.
Validation
BuildArchiveTests— 4 passed, 0 failed.Xamarin.Android.Build.Testsand its product dependencies compiled successfully with the host .NET 11 SDK after building the existing bootstrap task prerequisites.Xamarin.Android.Common.targetsXML validation.BuildDoesNotModifyNuGetPackageCacheintegration test compiled and started, but could not execute its nested app build because this checkout does not contain the repo-local SDK atbin\Debug\dotnet\dotnet; CI should provide full-build coverage.Upstream references: #11552 and #12450.