@react-native/gradle-plugin 0.84.0-nightly-20251208-8347cc4b5 → 0.84.0-nightly-20251211-80e384a80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/gradle-plugin",
3
- "version": "0.84.0-nightly-20251208-8347cc4b5",
3
+ "version": "0.84.0-nightly-20251211-80e384a80",
4
4
  "description": "Gradle Plugin for React Native",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -42,6 +42,7 @@ internal fun detectedEntryFile(config: ReactExtension, envVariableOverride: Stri
42
42
  */
43
43
  internal fun detectedCliFile(config: ReactExtension): File =
44
44
  detectCliFile(
45
+ project = config.project,
45
46
  reactNativeRoot = config.root.get().asFile,
46
47
  preconfiguredCliFile = config.cliFile.asFile.orNull,
47
48
  )
@@ -71,7 +72,11 @@ private fun detectEntryFile(
71
72
  else -> File(reactRoot, "index.js")
72
73
  }
73
74
 
74
- private fun detectCliFile(reactNativeRoot: File, preconfiguredCliFile: File?): File {
75
+ private fun detectCliFile(
76
+ project: Project,
77
+ reactNativeRoot: File,
78
+ preconfiguredCliFile: File?,
79
+ ): File {
75
80
  // 1. preconfigured path
76
81
  if (preconfiguredCliFile != null) {
77
82
  if (preconfiguredCliFile.exists()) {
@@ -81,14 +86,12 @@ private fun detectCliFile(reactNativeRoot: File, preconfiguredCliFile: File?): F
81
86
 
82
87
  // 2. node module path
83
88
  val nodeProcess =
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() }
89
+ project.providers.exec { exec ->
90
+ exec.commandLine("node", "--print", "require.resolve('react-native/cli');")
91
+ exec.workingDir(reactNativeRoot)
92
+ }
93
+
94
+ val nodeProcessOutput = nodeProcess.standardOutput.asText.get().trim()
92
95
 
93
96
  if (nodeProcessOutput.isNotEmpty()) {
94
97
  val nodeModuleCliJs = File(nodeProcessOutput)
@@ -14,6 +14,7 @@ import com.facebook.react.tests.OsRule
14
14
  import com.facebook.react.tests.WithOs
15
15
  import java.io.File
16
16
  import org.assertj.core.api.Assertions.assertThat
17
+ import org.gradle.process.ProcessExecutionException
17
18
  import org.gradle.testfixtures.ProjectBuilder
18
19
  import org.junit.Assume.assumeTrue
19
20
  import org.junit.Rule
@@ -99,7 +100,7 @@ class PathUtilsTest {
99
100
  assertThat(actual.readText()).isEqualTo("<!-- nothing to see here -->")
100
101
  }
101
102
 
102
- @Test(expected = IllegalStateException::class)
103
+ @Test(expected = ProcessExecutionException::class)
103
104
  fun detectedCliPath_failsIfNotFound() {
104
105
  val project = ProjectBuilder.builder().build()
105
106
  val extension = TestReactExtension(project)