Skip to content

Commit 211891f

Browse files
authored
fix(android): be more explicit about which Gradle plugin to include (#1934)
The previous approach could fail in a monorepo where both modules could exist in a hoisted node_modules
1 parent de07231 commit 211891f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test-app.gradle

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,12 @@ ext.applyTestAppSettings = { DefaultSettings settings ->
6767
settings.project(":support")
6868
.projectDir = file("${testAppDir}/android/support")
6969

70+
def reactNativeVersion = getPackageVersionNumber("react-native", rootDir)
71+
7072
def reactNativeGradlePlugin =
71-
findNodeModulesPath("@react-native/gradle-plugin", reactNativeDir) // >= 0.72
72-
?: findNodeModulesPath("react-native-gradle-plugin", reactNativeDir) // < 0.72
73+
reactNativeVersion >= v(0, 72, 0)
74+
? findNodeModulesPath("@react-native/gradle-plugin", reactNativeDir)
75+
: findNodeModulesPath("react-native-gradle-plugin", reactNativeDir)
7376
if (reactNativeGradlePlugin != null) {
7477
settings.includeBuild(reactNativeGradlePlugin)
7578
}

0 commit comments

Comments
 (0)