Skip to content
This repository was archived by the owner on Apr 26, 2026. It is now read-only.
Merged
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
17 changes: 17 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,20 @@ dependencies {
configurations.all {
exclude group: 'com.facebook.react', module: 'react-native-safe-area-context'
}

// Ensure our CMake tasks run after react-native-nitro-modules' CMake tasks
// to prevent race condition where libNitroModules.so is not yet built.
// See: https://github.com/hyochan/react-native-iap/issues/3163
afterEvaluate {
def nitroProject = rootProject.findProject(':react-native-nitro-modules')
if (nitroProject) {
tasks.configureEach { task ->
if (task.name.startsWith('buildCMake')) {
def nitroTask = nitroProject.tasks.findByName(task.name)
if (nitroTask) {
task.dependsOn(nitroTask)
}
}
}
}
}
Comment on lines +211 to +223

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.

medium

For better build performance, it's more efficient to find the :react-native-nitro-modules project only once, outside the tasks.configureEach loop. The current implementation looks for the project for every task being configured, which is unnecessary and can slightly slow down Gradle's configuration phase, especially in larger projects.

afterEvaluate {
  def nitroProject = rootProject.findProject(':react-native-nitro-modules')
  if (nitroProject) {
    tasks.configureEach { task ->
      if (task.name.startsWith('buildCMake')) {
        def nitroTask = nitroProject.tasks.findByName(task.name)
        if (nitroTask) {
          task.dependsOn(nitroTask)
        }
      }
    }
  }
}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Good point — hoisted findProject outside the configureEach loop in aa8e254.