Repository navigation
[xabt] Keep AAPT2 rules under the captured working directory - #12975
Merged
Merged
Conversation
Clean multi-project builds with R8 and full trimming can silently omit AAPT2 keep rules, resulting in ClassNotFoundException at startup. While <Aapt2Link/> yields its MSBuild node, another project request can change the process current directory. The merged ProguardRuleOutput write uses a relative path, so subsequent Exists() guards can omit the misplaced file from @(ProguardConfiguration). Resolve the merged rules output against the task's captured directory using its existing GetFullPath() helper. Also anchor manifest loading and manifest/flag timestamp checks within the same yielding task. Leave compile and asset-pack tasks unchanged: their shipped invocations do not enable yielding. Extend Nightly Fix Finder's general-mistakes category with a bounded filesystem scan and guidance for verifying actual yielding, property wiring, and relative-path reachability before proposing a race fix. Fixes: #12942 Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The race fix lacks a permanent in-tree regression test.
Review effort: Balanced
Findings: 1
What changed in this PR
Anchors AAPT2 filesystem operations to the task’s captured working directory, preventing keep-rule loss during concurrent builds.
Changes:
- Resolves rule, manifest, and timestamp paths against
WorkingDirectory. - Adds Nightly Fix Finder guidance and scanning for similar races.
| File | Description |
|---|---|
Aapt2Link.cs |
Anchors affected paths to the captured directory. |
05-general-mistakes.sh |
Adds race-detection guidance and candidate scanning. |
simonrozsival
approved these changes
Oct 1, 2026
Member
Author
|
I think the emulator disk is full on one of the failures: Merging. |
Member
Author
|
/backport to release/11.0.1xx |
Contributor
|
Started backporting to |
jonathanpeppers
added a commit
that referenced
this pull request
Oct 5, 2026
…#12989) Clean multi-project builds with R8 and full trimming can silently omit AAPT2 keep rules, resulting in ClassNotFoundException at startup. While <Aapt2Link/> yields its MSBuild node, another project request can change the process current directory. The merged ProguardRuleOutput write uses a relative path, so subsequent Exists() guards can omit the misplaced file from @(ProguardConfiguration). Resolve the merged rules output against the task's captured directory using its existing GetFullPath() helper. Also anchor manifest loading and manifest/flag timestamp checks within the same yielding task. Leave compile and asset-pack tasks unchanged: their shipped invocations do not enable yielding. Extend Nightly Fix Finder's general-mistakes category with a bounded filesystem scan and guidance for verifying actual yielding, property wiring, and relative-path reachability before proposing a race fix. Fixes: #12942 Co-authored-by: Jonathan Peppers <[email protected]> Co-authored-by: Copilot App <[email protected]>
23 of 32 tasks
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

Fixes: #12942
Clean multi-project builds using
$(AndroidLinkTool)=r8and$(TrimMode)=fullcan silently lose AAPT2 keep rules and produce startupClassNotFoundExceptionfailures.<Aapt2Link/>yields its MSBuild node, allowing another project request to change the process current directory while the task is still running. The mergedProguardRuleOutputwrite used a relative path, unlike the per-manifest rules. A misplaced merged file is then omitted by downstreamExists()guards and never passed to R8.Resolve the merged rules output against the task's captured working directory with the existing
GetFullPath()helper. Apply the same anchoring to manifest loading and manifest/flag timestamp checks in<Aapt2Link/>. These additional paths preserve absolute inputs; standard callers already supply an absolute manifest and do not currently set the flag property. Leave<Aapt2Compile/>and<Aapt2LinkAssetPack/>unchanged because their shipped invocations do not enable yielding. This addresses the clean-build directory race separately from the incremental rules-registration fix in #12950.Update Nightly Fix Finder's General Mistakes category with a bounded filesystem-operation scan and guidance that requires checking actual shipped invocations, yielding defaults/property wiring, and relative-path reachability. Already anchored paths and hypothetical future-yielding hardening are excluded.
Validation: Bash syntax and scanner execution passed; strict workflow compilation produced no generated-content changes. Source-extracted manifest/timestamp probes reproduced failures after changing the current directory and passed with the fix, covering relative/absolute paths, timestamp ordering, and missing/empty flags. No in-tree regression test was added, and the full Android build/task suite was not run because the local repository-built SDK is unavailable.