Skip to content

Commit

Permalink
debug native_modules.gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 committed Oct 22, 2024
1 parent c466092 commit 7761184
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
diff --git a/native_modules.gradle b/native_modules.gradle
index 218a860c3816731e20109ddc3ec6aeba27eed89f..4a74e37c6d8075c877384dcd409f735df24cd0c3 100644
--- a/native_modules.gradle
+++ b/native_modules.gradle
@@ -3,6 +3,8 @@ import groovy.transform.CompileStatic
import org.gradle.initialization.DefaultSettings
import org.apache.tools.ant.taskdefs.condition.Os

+logger.info("Executing 'native_modules.gradle'")
+
def generatedFileName = "PackageList.java"
def generatedFilePackage = "com.facebook.react"
def generatedFileContentsTemplate = """
@@ -144,6 +146,8 @@ void rncli_registerProviders(std::shared_ptr<ComponentDescriptorProviderRegistry
} // namespace facebook
"""

+logger.info("native_modules.gradle: declared templates")
+
class ReactNativeModules {
private Logger logger
private ProviderFactory providers
@@ -516,6 +520,7 @@ class ReactNativeModules {
}
}

+logger.info("native_modules.gradle: declared class")

/*
* Sometimes Gradle can be called outside of JavaScript hierarchy. Detect the directory
@@ -523,8 +528,10 @@ class ReactNativeModules {
*/
def projectRoot = rootProject.projectDir

+logger.info("native_modules.gradle: instantiate ReactNativeModules")
def autoModules = new ReactNativeModules(logger, providers, projectRoot)

+logger.info("native_modules.gradle: exports")
def reactNativeVersionRequireNewArchEnabled(autoModules) {
def rnVersion = autoModules.reactNativeVersion
def regexPattern = /^(\d+)\.(\d+)\.(\d+)(?:-(\w+(?:[-.]\d+)?))?$/
2 changes: 2 additions & 0 deletions android/autolink.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import groovy.json.JsonSlurper

logger.info("Executing 'autolink.gradle'")

ext.rnta_autolink_gradle = true

ext.autolinkModules = { File projectRoot, File output, String testAppDir ->
Expand Down
2 changes: 2 additions & 0 deletions android/config-plugins.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ext.rnta_config_plugins_gradle = true

logger.info("Executing 'config-plugins.gradle'")

if (!hasProperty("rnta_node_gradle")) {
apply(from: "${buildscript.sourceFile.getParent()}/node.gradle")
}
Expand Down
2 changes: 2 additions & 0 deletions android/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
logger.info("Executing 'dependencies.gradle'")

if (!hasProperty("rnta_node_gradle")) {
apply(from: "${buildscript.sourceFile.getParent()}/node.gradle")
}
Expand Down
2 changes: 2 additions & 0 deletions android/manifest.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import groovy.json.JsonSlurper
import java.nio.file.Paths

logger.info("Executing 'manifest.gradle'")

def _manifest = null

ext.rnta_manifest_gradle = true
Expand Down
2 changes: 2 additions & 0 deletions android/media-types.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
logger.info("Executing 'media-types.gradle'")

ext.rnta_media_types_gradle = true

ext.isFontFile = { File file ->
Expand Down
2 changes: 2 additions & 0 deletions android/node.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import groovy.json.JsonSlurper
import java.nio.file.Paths

logger.info("Executing 'node.gradle'")

ext.rnta_node_gradle = true

if (!hasProperty("rnta_utils_gradle")) {
Expand Down
2 changes: 2 additions & 0 deletions android/react-native.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ext.rnta_react_native_gradle = true

logger.info("Executing 'react-native.gradle'")

if (!hasProperty("rnta_node_gradle")) {
apply(from: "${buildscript.sourceFile.getParent()}/node.gradle")
}
Expand Down
2 changes: 2 additions & 0 deletions android/utils.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import groovy.json.JsonSlurper
import java.nio.file.Paths

logger.info("Executing 'utils.gradle'")

ext.rnta_utils_gradle = true

ext.checkEnvironment = { rootDir, testAppDir ->
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@
"bplist-parser": "~0.3.2",
"compression/bytes": "^3.0.0",
"express/qs": "^6.13.0",
"safe-buffer": "~5.2.1"
"safe-buffer": "~5.2.1",
"@react-native-community/cli-platform-android@npm:14.0.0": "patch:@react-native-community/cli-platform-android@npm%3A14.1.1#~/.yarn/patches/@react-native-community-cli-platform-android-npm-14.1.1-9c557ebb09.patch",
"@react-native-community/cli-platform-android@npm:14.1.1": "patch:@react-native-community/cli-platform-android@npm%3A14.1.1#~/.yarn/patches/@react-native-community-cli-platform-android-npm-14.1.1-9c557ebb09.patch",
"@react-native-community/cli-platform-android@npm:14.1.0": "patch:@react-native-community/cli-platform-android@npm%3A14.1.1#~/.yarn/patches/@react-native-community-cli-platform-android-npm-14.1.1-9c557ebb09.patch"
},
"workspaces": [
"example"
Expand Down
5 changes: 5 additions & 0 deletions test-app.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@ apply(from: "${testAppDir}/android/autolink.gradle")
apply(from: "${testAppDir}/android/config-plugins.gradle")
apply(from: "${testAppDir}/android/media-types.gradle")

logger.info("Check environment")
checkEnvironment(rootDir, testAppDir)
logger.info("Apply config plugins")
applyConfigPlugins(rootDir, testAppDir)

logger.info("Look for RN")
def reactNativeDir = file(findNodeModulesPath("react-native", rootDir))
def cliAndroidDir = findNodeModulesPath("@react-native-community/cli-platform-android", reactNativeDir)

logger.info("Autolinking")
apply(from: "${cliAndroidDir}/native_modules.gradle")

logger.info("Autolinking done")
ext.applyTestAppSettings = { DefaultSettings settings ->
settings.include(":app")
settings.include(":support")
Expand Down

0 comments on commit 7761184

Please sign in to comment.