Repository navigation
[Xamarin.Android.Build.Tasks] Keep AAR rules on cache hits - #13061
simonrozsival wants to merge 1 commit into
Conversation
When the _ResolveLibraryProjectImports target reruns after an app project timestamp change, an unchanged AAR skips extraction. The hash-hit path did not include its existing proguard.txt in ProguardConfigFiles, so the imports cache lost AAR consumer rules and later R8 invocations omitted their --pg-conf arguments. Collect proguard.txt on the hash-hit path and verify that it survives the timestamp-only build and reaches R8 on a subsequent incremental run. Fixes: #12965 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix matches the extraction path and includes end-to-end regression coverage.
1 open finding
What changed in this PR
Restores AAR consumer ProGuard rules when library extraction is skipped on cache hits.
Changes:
- Re-adds extracted
proguard.txtfiles to the imports cache. - Adds regression coverage verifying cache preservation and R8 input.
| File | Description |
|---|---|
IncrementalBuildTest.cs |
Tests timestamp-triggered cache regeneration and R8 configuration. |
ResolveLibraryProjectImports.cs |
Restores AAR rules during cache hits. |
🧠 Review effort: Balanced
|
@dalexsoto review |
dalexsoto
left a comment
There was a problem hiding this comment.
The cache-hit path now restores the same extracted AAR consumer-rule item and source metadata as cold extraction, preserving the imports cache and downstream R8 --pg-conf input. The regression exercises the timestamp-triggered rerun with an unchanged AAR and checks the subsequent R8 argument. The complete two-file review, independent integration/completeness pass and final blocker search found no source blocker.
CI is not green: both failed package shards contain the same 12 runtime/reference-test assertions also present in existing build 1630732, on the same newer-main baseline without this AAR fix. Those failures are not being represented as infrastructure flakes or introduced by this change. This approval is based on static source inspection and existing CI evidence; no builds or tests were independently executed.

Pull Request
title and
description
should follow the
commit-messages.mdworkflow documentation, and in particular should include:When the
_ResolveLibraryProjectImportstarget reruns after an app project timestamp change, an unchanged AAR skips extraction. The cache-hit path previously omitted the already-extractedproguard.txtfrom the imports cache, so the build could succeed while a later R8 invocation lost the AAR consumer rules from--pg-conf. The cache-hit path now restores that rule, and the regression test checks cache preservation and the subsequent R8 input.Fixes: #12965
Validation:
make leeroy— passed (78 warnings, 0 errors)../dotnet-local.sh build src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj -c Debug --no-restore -v:quiet— passed (0 warnings, 0 errors)../dotnet-local.sh test bin/TestDebug/net10.0/Xamarin.Android.Build.Tests.dll --filter 'FullyQualifiedName~IncrementalBuildTest.AarConsumerRulesRemainInR8ConfigurationAfterAppProjectTimestampChange'— passed (1/1).