Skip to content

Commit 3b07660

Browse files
committed
fix: node cmd issues with new AS version
1 parent 9c3a648 commit 3b07660

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

examples/SampleApp/android/app/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ apply plugin: 'com.google.gms.google-services'
44
apply plugin: 'com.google.firebase.crashlytics'
55
apply plugin: "com.facebook.react"
66

7+
// Some libraries look up the React Native location on the application project
8+
// instead of the root project. Mirror the root setting here so they never need
9+
// to shell out to a bare `node` binary just to resolve react-native.
10+
ext.REACT_NATIVE_NODE_MODULES_DIR =
11+
rootProject.ext.has("REACT_NATIVE_NODE_MODULES_DIR")
12+
? rootProject.ext.get("REACT_NATIVE_NODE_MODULES_DIR")
13+
: file("$rootDir/../node_modules/react-native").absolutePath
14+
ext.REACT_NATIVE_WORKLETS_NODE_MODULES_DIR =
15+
rootProject.ext.has("REACT_NATIVE_WORKLETS_NODE_MODULES_DIR")
16+
? rootProject.ext.get("REACT_NATIVE_WORKLETS_NODE_MODULES_DIR")
17+
: file("$rootDir/../node_modules/react-native-worklets").absolutePath
18+
719
/**
820
* This is the configuration block to customize your React Native Android app.
921
* By default you don't need to apply any configuration, just uncomment the lines you need.

examples/SampleApp/android/build.gradle

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ buildscript {
2626
}
2727
}
2828

29+
ext.REACT_NATIVE_NODE_MODULES_DIR = file("$rootDir/../node_modules/react-native").absolutePath
30+
ext.REACT_NATIVE_WORKLETS_NODE_MODULES_DIR =
31+
file("$rootDir/../node_modules/react-native-worklets").absolutePath
32+
33+
subprojects { subproject ->
34+
if (subproject.path != ":app") {
35+
evaluationDependsOn(":app")
36+
}
37+
}
38+
2939
allprojects {
3040
repositories {
3141
maven {
@@ -39,15 +49,8 @@ allprojects {
3949
}
4050

4151
project(':app') {
42-
afterEvaluate {
43-
if (tasks.findByName("preBuild")) {
44-
tasks.preBuild.doFirst {
45-
exec {
46-
workingDir rootDir
47-
commandLine './gradlew', 'generateCodegenArtifactsFromSchema'
48-
}
49-
}
50-
}
52+
tasks.matching { it.name == "preBuild" }.configureEach {
53+
dependsOn("generateCodegenArtifactsFromSchema")
5154
}
5255
}
5356

0 commit comments

Comments
 (0)