Commit 35432ac0 authored by yogevbd's avatar yogevbd

Gradle resolve react-native version flavor

parent 1081242b
...@@ -23,7 +23,6 @@ android { ...@@ -23,7 +23,6 @@ android {
ndk { ndk {
abiFilters "armeabi-v7a", "x86" abiFilters "armeabi-v7a", "x86"
} }
missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60"
} }
buildTypes { buildTypes {
release { release {
......
import groovy.json.JsonSlurper
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply from: '../prepare-robolectric.gradle' 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 { android {
compileSdkVersion 27 compileSdkVersion 27
buildToolsVersion '28.0.3' buildToolsVersion '28.0.3'
...@@ -11,6 +27,7 @@ android { ...@@ -11,6 +27,7 @@ android {
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
} }
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled false
...@@ -20,6 +37,7 @@ android { ...@@ -20,6 +37,7 @@ android {
debuggable true debuggable true
} }
} }
testOptions { testOptions {
unitTests.all { t -> unitTests.all { t ->
reports { reports {
...@@ -49,6 +67,14 @@ android { ...@@ -49,6 +67,14 @@ android {
dimension "RNNotifications.reactNativeVersion" dimension "RNNotifications.reactNativeVersion"
} }
} }
def flavor = resolveFlavor()
variantFilter { variant ->
def names = variant.flavors*.name
if (!names.contains(flavor)) {
setIgnore(true)
}
}
} }
dependencies { 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