Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AndroidResource Incremental build issue #9592

Merged
merged 3 commits into from
Dec 7, 2024

Conversation

dellis1972
Copy link
Contributor

@dellis1972 dellis1972 commented Dec 5, 2024

Fixes #9588

Adding a new Android resource to a project causes the incremental build to error with:

Resources\layout\activity_two.xml error APT2126: file not found.

This error comes from the Aapt2Compile task. It is looking for \obj\Debug\net9.0-android\res\layout\activity_two.xml but that file doesn't exist.

What was happening is the new file had the same modified date as the flag/stamp file that was used to generate it.
The user was using copy Resources\layout\activity_main.xml Resources\layout\activity_two.xml. So the modified date was not "new". This caused the _GenerateAndroidResourceDir target to get skipped.

What we should do is copy what we do in other places, and hash all the input files (and their destinations) into one hash.
We can then use that hash file as an input to the target. This allows us to detect when a new file is added, even if it has an old timestamp.

A unit test was added as well.

@dellis1972 dellis1972 changed the title Fix AndroidResouce Incremental build issue Fix AndroidResource Incremental build issue Dec 5, 2024
@dellis1972
Copy link
Contributor Author

Need to add a unit test somehow

@dellis1972
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dellis1972 dellis1972 marked this pull request as ready for review December 6, 2024 13:06
Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

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

This looks good if CI ends up green. 👍

@dellis1972 dellis1972 merged commit 0434024 into dotnet:main Dec 7, 2024
57 checks passed
@dellis1972 dellis1972 deleted the Issue9588 branch December 7, 2024 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incremental build issue when adding Android resource
2 participants