Skip to content

Commit 0fccbd5

Browse files
cortinicofacebook-github-bot
authored andcommitted
Leverage Gradle implicit dependency substitution for Gradle Plugin
Summary: Previously we asked users to specify a dependency substitution rule to properly use the React Native Gradle Plugin. Here I'm updating the Gradle Plugins setup to allow to use implicit dependency substitution. This requires to specify a Maven Group and Artifact Name (through the project name). This is backward compatible as users will still be allowed to specify a dependency substitution rule if they wish. Changelog: [Android] [Changed] - Leverage Gradle implicit dependency substitution for Gradle Plugin Reviewed By: ShikaSD Differential Revision: D33404948 fbshipit-source-id: 3323f8e0738fd579ce8ae344cbdc0e4356e7dbd8
1 parent 36037fa commit 0fccbd5

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

packages/react-native-gradle-plugin/build.gradle.kts

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ gradlePlugin {
2727
}
2828
}
2929

30+
group = "com.facebook.react"
31+
3032
dependencies {
3133
implementation(gradleApi())
3234
implementation("com.android.tools.build:gradle:7.0.4")

packages/react-native-gradle-plugin/settings.gradle.kts

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ pluginManagement {
1111
google()
1212
}
1313
}
14+
15+
rootProject.name = "react-native-gradle-plugin"

template/android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ buildscript {
1414
}
1515
dependencies {
1616
classpath("com.android.tools.build:gradle:7.0.4")
17-
classpath("com.facebook.react:react")
17+
classpath("com.facebook.react:react-native-gradle-plugin")
1818
classpath("de.undercouch:gradle-download-task:4.1.2")
1919
// NOTE: Do not place your application dependencies here; they belong
2020
// in the individual module build.gradle files

template/android/settings.gradle

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
rootProject.name = 'HelloWorld'
22
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
33
include ':app'
4-
includeBuild('../node_modules/react-native-gradle-plugin') {
5-
dependencySubstitution {
6-
substitute(module("com.facebook.react:react")).using(project(":"))
7-
}
8-
}
4+
includeBuild('../node_modules/react-native-gradle-plugin')
95

106
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
117
include(":ReactAndroid")

0 commit comments

Comments
 (0)