Merge pull request #1007 from mlc/gradle_conf_in_root_project

android: allow root project to specify dependency versions
This commit is contained in:
Michael Diarmid 2018-04-21 19:34:50 +01:00 committed by GitHub
commit 6dac0e4b47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 5 deletions

View File

@ -1,5 +1,4 @@
buildscript { buildscript {
ext.firebaseVersion = '12.0.0'
repositories { repositories {
jcenter() jcenter()
google() google()
@ -15,12 +14,18 @@ buildscript {
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
def DEFAULT_COMPILE_SDK_VERSION = 27
def DEFAULT_BUILD_TOOLS_VERSION = "27.0.3"
def DEFAULT_TARGET_SDK_VERSION = 26
def DEFAULT_FIREBASE_VERSION = "12.0.0"
def DEFAULT_SUPPORT_LIB_VERSION = "27.0.2"
android { android {
compileSdkVersion 27 compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
buildToolsVersion "27.0.3" buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 26 targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
multiDexEnabled true multiDexEnabled true
@ -77,11 +82,13 @@ rootProject.gradle.buildFinished { buildResult ->
} }
} }
def firebaseVersion = rootProject.hasProperty('googlePlayServicesVersion') ? rootProject.googlePlayServicesVersion : DEFAULT_FIREBASE_VERSION
def supportVersion = rootProject.hasProperty('supportLibVersion') ? rootProject.supportLibVersion : DEFAULT_SUPPORT_LIB_VERSION
dependencies { dependencies {
// compile fileTree(include: ['*.jar'], dir: 'libs') // compile fileTree(include: ['*.jar'], dir: 'libs')
api "com.facebook.react:react-native:+" // From node_modules api "com.facebook.react:react-native:+" // From node_modules
api "com.android.support:support-v4:27.0.2" api "com.android.support:support-v4:$supportVersion"
compileOnly 'me.leolin:ShortcutBadger:1.1.21@aar' compileOnly 'me.leolin:ShortcutBadger:1.1.21@aar'
compileOnly "com.google.android.gms:play-services-base:$firebaseVersion" compileOnly "com.google.android.gms:play-services-base:$firebaseVersion"
compileOnly "com.google.firebase:firebase-core:$firebaseVersion" compileOnly "com.google.firebase:firebase-core:$firebaseVersion"