Skip to content

Commit b1b2cab

Browse files
cortinicometa-codesync[bot]
authored andcommitted
Back out "fix: RNGP using node invocation non-compatible with Gradle Compilation Cache"
Summary: Original commit changeset: a91e47b90937 Original Phabricator Diff: D88492310 bypass-github-export-checks Reviewed By: javache Differential Revision: D88727116 fbshipit-source-id: 847c78776d9628448811158673ac8530e09a8238
1 parent 64bb0d5 commit b1b2cab

File tree

1 file changed

+9
-11
lines changed
  • packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils

1 file changed

+9
-11
lines changed

packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ internal fun detectedEntryFile(config: ReactExtension, envVariableOverride: Stri
4242
*/
4343
internal fun detectedCliFile(config: ReactExtension): File =
4444
detectCliFile(
45-
project = config.project,
4645
reactNativeRoot = config.root.get().asFile,
4746
preconfiguredCliFile = config.cliFile.asFile.orNull,
4847
)
@@ -72,11 +71,7 @@ private fun detectEntryFile(
7271
else -> File(reactRoot, "index.js")
7372
}
7473

75-
private fun detectCliFile(
76-
project: Project,
77-
reactNativeRoot: File,
78-
preconfiguredCliFile: File?,
79-
): File {
74+
private fun detectCliFile(reactNativeRoot: File, preconfiguredCliFile: File?): File {
8075
// 1. preconfigured path
8176
if (preconfiguredCliFile != null) {
8277
if (preconfiguredCliFile.exists()) {
@@ -86,11 +81,14 @@ private fun detectCliFile(
8681

8782
// 2. node module path
8883
val nodeProcess =
89-
project.providers.exec {
90-
it.commandLine("node", "--print", "require.resolve('react-native/package.json')")
91-
}
92-
93-
val nodeProcessOutput = nodeProcess.standardOutput.asText.get().trim()
84+
Runtime.getRuntime()
85+
.exec(
86+
arrayOf("node", "--print", "require.resolve('react-native/cli');"),
87+
emptyArray(),
88+
reactNativeRoot,
89+
)
90+
91+
val nodeProcessOutput = nodeProcess.inputStream.use { it.bufferedReader().readText().trim() }
9492

9593
if (nodeProcessOutput.isNotEmpty()) {
9694
val nodeModuleCliJs = File(nodeProcessOutput)

0 commit comments

Comments
 (0)