From 959d1ed870b033c89049729b85d1fe4690ea002c Mon Sep 17 00:00:00 2001 From: Christian Brevik Date: Mon, 27 Aug 2018 14:20:29 +0200 Subject: [PATCH] Update build.gradle to allow rootProject overrides of versions --- android/build.gradle | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 4e7ebaf..4678b6c 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,18 +1,22 @@ apply plugin: 'com.android.library' +def safeExtGet(prop, fallback) { + rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback +} + android { - compileSdkVersion 23 - buildToolsVersion "23.0.1" + compileSdkVersion safeExtGet('compileSdkVersion', 23) + buildToolsVersion safeExtGet('buildToolsVersion', "23.0.1") defaultConfig { - minSdkVersion 16 - targetSdkVersion 22 + minSdkVersion safeExtGet('minSdkVersion', 16) + targetSdkVersion safeExtGet('targetSdkVersion', 22) versionCode 1 versionName "0.0.1" } } dependencies { - compile 'com.facebook.react:react-native:+' - compile 'com.anjlab.android.iab.v3:library:1.0.44' + compile "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" + compile "com.anjlab.android.iab.v3:library:${safeExtGet('anjlabIABVersion', '1.0.44')}" }