Commit 35432ac0 authored by yogevbd's avatar yogevbd

Gradle resolve react-native version flavor

parent 1081242b
......@@ -23,7 +23,6 @@ android {
ndk {
abiFilters "armeabi-v7a", "x86"
}
missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60"
}
buildTypes {
release {
......
import groovy.json.JsonSlurper
apply plugin: 'com.android.library'
apply from: '../prepare-robolectric.gradle'
String resolveFlavor() {
def packageSlurper = new JsonSlurper()
def reactNativePackageJson = packageSlurper.parse file('../../node_modules/react-native/package.json')
def reactNativeVersion = reactNativePackageJson.version
List versionComponents = reactNativeVersion.tokenize('.')
if (versionComponents[1].toInteger() < 60) {
return "reactNative59"
} else {
return "reactNative60"
}
}
android {
compileSdkVersion 27
buildToolsVersion '28.0.3'
......@@ -11,6 +27,7 @@ android {
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
......@@ -20,6 +37,7 @@ android {
debuggable true
}
}
testOptions {
unitTests.all { t ->
reports {
......@@ -49,6 +67,14 @@ android {
dimension "RNNotifications.reactNativeVersion"
}
}
def flavor = resolveFlavor()
variantFilter { variant ->
def names = variant.flavors*.name
if (!names.contains(flavor)) {
setIgnore(true)
}
}
}
dependencies {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment