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
This commit is contained in:
Nicola Corti
2022-01-11 07:23:54 -08:00
committed by Facebook GitHub Bot
parent 36037fa81b
commit 0fccbd53af
4 changed files with 6 additions and 6 deletions
@@ -27,6 +27,8 @@ gradlePlugin {
}
}
group = "com.facebook.react"
dependencies {
implementation(gradleApi())
implementation("com.android.tools.build:gradle:7.0.4")
@@ -11,3 +11,5 @@ pluginManagement {
google()
}
}
rootProject.name = "react-native-gradle-plugin"
+1 -1
View File
@@ -14,7 +14,7 @@ buildscript {
}
dependencies {
classpath("com.android.tools.build:gradle:7.0.4")
classpath("com.facebook.react:react")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:4.1.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
+1 -5
View File
@@ -1,11 +1,7 @@
rootProject.name = 'HelloWorld'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/react-native-gradle-plugin') {
dependencySubstitution {
substitute(module("com.facebook.react:react")).using(project(":"))
}
}
includeBuild('../node_modules/react-native-gradle-plugin')
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
include(":ReactAndroid")