Description
React Native version:
0.58.8
Steps To Reproduce
This is an enhancement (or feature request)
Describe what you expected to happen:
having an extra property in ext
that specify android gradle plugin version, so libraries developer can read and set the main project android gradle plugin version to their library and so whole project build with the same gradle plugin. this is an important and useful property when users using CI server with code repository for building their product. for example, I use a docker with previous installed all necessary resources for building an android app in my CI server, but some of libraries I used have different gradle plugin version, so my docker has to download the different version of gradle plugins to build a final product.
I mean something like this:
I wanted to submit a pull request but I'm not expert in gradle build system and not familiar with this repository and I couldn't find android gradle template file, So I suggest my changes in here
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
gradlePluginVersion = "3.4.1" <----- add this property to react native android template
}
dependencies {
classpath 'com.android.tools.build:gradle:$ext.gradlePluginVersion'
}
}
By adding the property other library developers can do something like this in their library's gradle file:
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
buildscript {
repositories {
...
}
dependencies {
classpath 'com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion', '3.4.0')}'
}
}
I don't familiar with gradle syntax, so it might be wrong in the syntax of what I wrote, I just want to suggest my idea.
Also, it would be great if make a standard mechanism that libraries could read version of gradle wrapper version of main project from gradle-wrapper.properties
, because I have seen some libraries that have gradle-wrapper.properties
file in their directory. for example, you can take a look at react-native-keychain library. I have no idea right now how can we add this feature, but I think it's worth discussing about it