Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/react-native-nitro-modules/android/fix-prefab.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ tasks.configureEach { task ->

afterEvaluate {
def abis = reactNativeArchitectures()
def prepareHeadersTask = tasks.named("prepareHeaders")

prepareHeadersTask.configure {
mustRunAfter(tasks.named("clean"))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Does this cause prepareHeaders to always do a clean* before too?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No, this only keeps prepareHeaders run after clean if they are both planned to run. prepareHeaders wont trigger a clean itself.
Ref: mustRunAfter

}

rootProject.allprojects.each { proj ->
if (proj === rootProject) return

Expand All @@ -28,6 +34,12 @@ afterEvaluate {
return
}

if (proj != project) {
proj.tasks.matching { it.name.startsWith("externalNativeBuildClean") }.configureEach { cleanTask ->
cleanTask.dependsOn(prepareHeadersTask)
}
}

def variants = proj.android.hasProperty('applicationVariants') ? proj.android.applicationVariants : proj.android.libraryVariants
// Touch the prefab_config.json files to ensure that in ExternalNativeJsonGenerator.kt we will re-trigger the prefab CLI to
// generate a libnameConfig.cmake file that will contain our native library (.so).
Expand Down