Skip to content

Commit

Permalink
Improve get SDK version values on Android (#77)
Browse files Browse the repository at this point in the history
* Improve get SDK version values on Android

* Target to compile should match
  • Loading branch information
maicki authored Sep 22, 2018
1 parent 7076269 commit e08c03c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions templates/android.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,22 @@ module.exports = platform => [{
apply plugin: 'com.android.library'
apply plugin: 'maven'
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
def DEFAULT_COMPILE_SDK_VERSION = 27
def DEFAULT_BUILD_TOOLS_VERSION = "27.0.3"
def DEFAULT_MIN_SDK_VERSION = 16
def DEFAULT_TARGET_SDK_VERSION = 26
def DEFAULT_TARGET_SDK_VERSION = 27
android {
compileSdkVersion rootProject.ext.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
buildToolsVersion rootProject.ext.hasProperty('buildToolsVersion') ? rootProject.ext.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
defaultConfig {
minSdkVersion rootProject.ext.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : DEFAULT_MIN_SDK_VERSION
targetSdkVersion rootProject.ext.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
versionCode 1
versionName "1.0"
}
Expand Down

0 comments on commit e08c03c

Please sign in to comment.