fix(android): prepare Nitro prefab headers before native clean#1327
Open
Phecda wants to merge 1 commit into
Open
fix(android): prepare Nitro prefab headers before native clean#1327Phecda wants to merge 1 commit into
Phecda wants to merge 1 commit into
Conversation
Scope this change to react-native-nitro-modules Android prefab cleanup. Ensure prepareHeaders runs after clean and before dependent externalNativeBuildClean tasks so NitroModules prefab headers exist when native clean reads the target metadata.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
mrousavy
reviewed
May 19, 2026
mrousavy
left a comment
Owner
There was a problem hiding this comment.
Thanks for the PR! I really appreciate some help on this end, as the Gradle/CMake build setup is still a bit weird for cleaning/detecting changes.
| def prepareHeadersTask = tasks.named("prepareHeaders") | ||
|
|
||
| prepareHeadersTask.configure { | ||
| mustRunAfter(tasks.named("clean")) |
Owner
There was a problem hiding this comment.
Does this cause prepareHeaders to always do a clean* before too?
Author
There was a problem hiding this comment.
No, this only keeps prepareHeaders run after clean if they are both planned to run. prepareHeaders wont trigger a clean itself.
Ref: mustRunAfter
Author
|
FYI: I use this patch with RN#56886 , but they dont depend on each other. |
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
Draft PR to discuss a narrow Android clean-ordering fix for
react-native-nitro-modules.react-native-nitro-modulespublishes its Android prefab target with headers under:Those headers are produced by the Gradle
prepareHeaderstask. During native clean flows,cleancan removeandroid/build/headers, then dependent Android projects may still runexternalNativeBuildClean*and read thereact-native-nitro-modules::NitroModulesprefab target. At that point CMake can fail because the target's include directory no longer exists:This patch keeps the scope limited to
packages/react-native-nitro-modules:prepareHeadersmust run after this project'scleantask when both are in the graph;externalNativeBuildClean*tasks depend onprepareHeaders, so Nitro prefab headers exist before native clean reads the prefab metadata.This intentionally targets native clean. It does not claim to be a complete fresh Gradle Sync fix.
Test plan
Result: passed.
Notes for review
The contribution guide requires bug fixes to include a test. This PR is opened as a draft because this behavior depends on a consumer Gradle task graph (
externalNativeBuildClean*reading another project's prefab metadata aftercleanremoves generated headers). I would like maintainer guidance on the preferred regression coverage for that scenario before requesting review.