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

feat: improve native_module.gradle for certain custom project setups #2341

Closed
Closed
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
16 changes: 6 additions & 10 deletions packages/cli-platform-android/native_modules.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -496,15 +496,6 @@ class ReactNativeModules {
}
}


/*
* Sometimes Gradle can be called outside of JavaScript hierarchy. Detect the directory
* where build files of an active project are located.
*/
def projectRoot = rootProject.projectDir

def autoModules = new ReactNativeModules(logger, providers, projectRoot)

def reactNativeVersionRequireNewArchEnabled(autoModules) {
def rnVersion = autoModules.reactNativeVersion
def regexPattern = /^(\d+)\.(\d+)\.(\d+)(?:-(\w+(?:[-.]\d+)?))?$/
Expand All @@ -524,11 +515,16 @@ def reactNativeVersionRequireNewArchEnabled(autoModules) {
* Exported Extensions
* ------------------------ */

ext.applyNativeModulesSettingsGradle = { DefaultSettings defaultSettings ->
ext.applyNativeModulesSettingsGradle = { DefaultSettings defaultSettings, File reactRoot = null ->
def projectRoot = reactRoot != null ? reactRoot : rootProject.projectDir
def autoModules = new ReactNativeModules(logger, providers, projectRoot)
autoModules.addReactNativeModuleProjects(defaultSettings)
}

ext.applyNativeModulesAppBuildGradle = { Project project ->
def reactExtension = rootProject.extensions.getByName("privateReact")
def projectRoot = reactExtension.root.getAsFile().getOrNull() ?: rootProject.projectDir
def autoModules = new ReactNativeModules(logger, providers, projectRoot)
autoModules.addReactNativeModuleDependencies(project)

def generatedSrcDir = new File(buildDir, "generated/rncli/src/main/java")
Expand Down
Loading