@@ -10,18 +10,22 @@ plugins {
1010 id(" org.jetbrains.kotlin.kapt" ) version " ${ kotlinVersion} "
1111}
1212
13- if (isNewArchitectureEnabled(project)) {
14- apply(plugin : " com.facebook.react" )
15- }
16-
1713// `react-native run-android` is hard-coded to look for the output APK at a very
1814// specific location. See
1915// https://github.com/react-native-community/cli/blob/6cf12b00c02aca6d4bc843446394331d71a9749e/packages/platform-android/src/commands/runAndroid/index.ts#L180
2016buildDir = " ${ rootDir} /${ name} /build"
2117
22- def reactNativeDir = findNodeModulesPath(" react-native" , rootDir)
18+ def reactNativeDir = file( findNodeModulesPath(" react-native" , rootDir) )
2319def reactNativeVersion = getPackageVersionNumber(" react-native" , rootDir)
2420
21+ if (isNewArchitectureEnabled(project)) {
22+ apply(plugin : " com.facebook.react" )
23+ react {
24+ codegenDir = file(findNodeModulesPath(" react-native-codegen" , reactNativeDir))
25+ reactNativeDir = reactNativeDir
26+ }
27+ }
28+
2529repositories {
2630 maven {
2731 url = uri(" ${ reactNativeDir} /android" )
@@ -63,8 +67,6 @@ project.ext.react = [
6367 enableFlipper : getFlipperVersion(rootDir),
6468 enableHermes : true ,
6569 enableNewArchitecture : isNewArchitectureEnabled(project),
66- codegenDir : findNodeModulesPath(" react-native-codegen" , file(reactNativeDir)),
67- reactNativeDir : reactNativeDir,
6870]
6971
7072project. ext. signingConfigs = getSigningConfigs()
@@ -262,8 +264,8 @@ dependencies {
262264 // TODO: Remove this block when we drop support for 0.68.
263265 if (reactNativeVersion < 6900 ) {
264266 def hermesEngineDir =
265- findNodeModulesPath(" hermes-engine" , file( reactNativeDir) )
266- ?: findNodeModulesPath(" hermesvm" , file( reactNativeDir) )
267+ findNodeModulesPath(" hermes-engine" , reactNativeDir)
268+ ?: findNodeModulesPath(" hermesvm" , reactNativeDir)
267269 if (hermesEngineDir == null ) {
268270 throw new GradleException (" Could not find 'hermes-engine'. Please make sure you've added it to 'package.json'." )
269271 }
0 commit comments