Skip to content

Commit e5253c9

Browse files
use dynamic paths for android builds
1 parent b2cf075 commit e5253c9

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

tools/powersynctests/android/app/build.gradle

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ apply plugin: "com.facebook.react"
88
*/
99
react {
1010
/* Folders */
11-
codegenDir = file("../../../../node_modules/@react-native/codegen")
1211

1312
// The root of your project, i.e. where "package.json" lives. Default is '../..'
1413
// root = file("../../")
15-
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
16-
// reactNativeDir = file("../../node_modules/react-native")
17-
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
18-
// codegenDir = file("../../node_modules/@react-native/codegen")
14+
// Resolve react-native and codegen from the monorepo root using node's resolution
15+
reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
16+
codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
1917
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
2018
// cliFile = file("../../node_modules/react-native/cli.js")
2119

@@ -47,7 +45,7 @@ react {
4745

4846
/* Hermes Commands */
4947
// The hermes compiler command to run. By default it is 'hermesc'
50-
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
48+
hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc"
5149
//
5250
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
5351
// hermesFlags = ["-O", "-output-source-map"]

0 commit comments

Comments
 (0)