Skip to content

Commit

Permalink
Leverage Gradle implicit dependency substitution for Gradle Plugin
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cortinico authored and facebook-github-bot committed Jan 11, 2022
1 parent 36037fa commit 0fccbd5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions packages/react-native-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ gradlePlugin {
}
}

group = "com.facebook.react"

dependencies {
implementation(gradleApi())
implementation("com.android.tools.build:gradle:7.0.4")
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native-gradle-plugin/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ pluginManagement {
google()
}
}

rootProject.name = "react-native-gradle-plugin"
2 changes: 1 addition & 1 deletion template/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions template/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -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")
Expand Down

0 comments on commit 0fccbd5

Please sign in to comment.