Skip to content

Commit 04da286

Browse files
committed
android: patch RN settings.gradle.kts /tmp projectDir for Windows
The Windows unit-test lane failed configuring the React Native build-from- source composite build: Configuring project ':packages:react-native' without an existing directory is not allowed. The configured projectDirectory '...\react-native\tmp' does not exist React Native's own settings.gradle.kts declares the intermediate container projects :packages and :packages:react-native with projectDir = file("/tmp"), purely to satisfy Gradle 9's rule that every project in a path have an existing folder. "/tmp" exists on the posix CI hosts but on Windows it is not an absolute path, so Gradle resolves it to a non-existent <react-native>\tmp and the build fails before any task runs. This is why only windows-latest was red while ubuntu and macOS passed. Add a pnpm patch replacing file("/tmp") with file(System.getProperty("java.io.tmpdir", "/tmp")): the JVM temp dir is "/tmp" on posix and %TEMP% on Windows, both of which always exist. Remove the patch once React Native stops hardcoding "/tmp" upstream. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TVfanKvtyfSsoMgZv3DJtY
1 parent 3745614 commit 04da286

3 files changed

Lines changed: 45 additions & 19 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
diff --git a/settings.gradle.kts b/settings.gradle.kts
2+
index 2036e0f16450b837223aad4b73cd1d556089d16d..a769520babe1423bb08399e5a932db50de7bad51 100644
3+
--- a/settings.gradle.kts
4+
+++ b/settings.gradle.kts
5+
@@ -35,6 +35,11 @@ project(":packages:react-native:ReactAndroid:hermes-engine").projectDir =
6+
// for :packages and :packages:react-native as well as otherwise the build from
7+
// source will fail with a missing folder exception.
8+
9+
-project(":packages").projectDir = file("/tmp")
10+
-
11+
-project(":packages:react-native").projectDir = file("/tmp")
12+
+// Patched by react-native-node-api: upstream hardcodes file("/tmp"), which does
13+
+// not exist on Windows (there `/tmp` resolves to a non-existent <rootDir>/tmp),
14+
+// so the build-from-source settings fail to configure. Use the JVM temp dir,
15+
+// which exists on every platform (`/tmp` on posix, %TEMP% on Windows). Remove
16+
+// this patch once React Native stops hardcoding "/tmp" here.
17+
+project(":packages").projectDir = file(System.getProperty("java.io.tmpdir", "/tmp"))
18+
+
19+
+project(":packages:react-native").projectDir = file(System.getProperty("java.io.tmpdir", "/tmp"))

pnpm-lock.yaml

Lines changed: 24 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ packages:
77
# platform binary; allow just that one rather than disabling the safety globally.
88
onlyBuiltDependencies:
99
- esbuild
10+
patchedDependencies:
11+
react-native@0.87.0-nightly-20260529-88857d22f: patches/react-native@0.87.0-nightly-20260529-88857d22f.patch

0 commit comments

Comments
 (0)