Skip to content

[Xamarin.Android.Build.Tasks] Keep AAR rules on cache hits - #13061

Open
simonrozsival wants to merge 1 commit into
mainfrom
simonrozsival-r8-consumer-rule-regression
Open

simonrozsival wants to merge 1 commit into
mainfrom
simonrozsival-r8-consumer-rule-regression

Conversation

@simonrozsival

Copy link
Copy Markdown
Member

Pull Request
title and
description
should follow the
commit-messages.md workflow documentation, and in particular should include:

When the _ResolveLibraryProjectImports target reruns after an app project timestamp change, an unchanged AAR skips extraction. The cache-hit path previously omitted the already-extracted proguard.txt from 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).
  • Useful description of why the change is necessary.
  • Links to issues fixed
  • Unit tests

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 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 10, 2026 09:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.txt files 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

@simonrozsival

Copy link
Copy Markdown
Member Author

@dalexsoto review

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants