Files
Alexander Djenkov c5db112b8d feat(android): androidX support (#7039)
* feat: migrate support library namespaces to androidX

* feat(tns-platform-declarations): update to androidX typings

* chore(tests): migrate test apps to AndroidX

* chore(tns-platform-declarations): update tsconfig to include androidx dts files

* update package.json to androidx

* chore(androidx): migrate forgotten support library namspaces

* feat(tns-core-modules-widgets): migrate to AndroidX namespaces

* chore(utils): update androidx namspace for getPaletteColor method

* chore(apps): update tns-platform-declarations package

* Update package.json
2019-06-10 09:21:41 +03:00

99 lines
2.2 KiB
Groovy

import groovy.json.JsonSlurper //used to parse package.json
import groovy.json.JsonBuilder
import groovy.json.JsonOutput
def isWinOs = System.properties['os.name'].toLowerCase().contains('windows')
apply plugin: 'com.android.library'
def computeCompileSdkVersion () {
if(project.hasProperty("compileSdk")) {
return compileSdk
}
else {
return 28
}
}
def computeBuildToolsVersion() {
if(project.hasProperty("buildToolsVersion")) {
return buildToolsVersion
}
else {
return "28.0.2"
}
}
def computeAndroidXVersion() {
if(project.hasProperty("androidxVersion")) {
return androidxVersion
}
else {
return "1.0.0"
}
}
def computeSupportVersion() {
if(project.hasProperty("supportVersion")) {
return supportVersion
}
else {
return "28.0.0"
}
}
def computeTargetSdkVersion() {
if(project.hasProperty("targetSdk")) {
return targetSdk
}
else {
return 28
}
}
android {
compileSdkVersion computeCompileSdkVersion()
buildToolsVersion computeBuildToolsVersion()
defaultConfig {
minSdkVersion 16
targetSdkVersion computeTargetSdkVersion()
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
if(project.hasProperty("useAndroidX")) {
println 'Using androix'
def androidxVersion = computeAndroidXVersion()
implementation 'androidx.viewpager:viewpager:' + androidxVersion
implementation 'androidx.fragment:fragment:' + androidxVersion
} else {
println 'Using support library'
implementation 'com.android.support:support-v4:' + computeSupportVersion()
}
}
task cleanBuildDir (type: Delete) {
delete "../build/"
}
task copyAar << {
copy {
from "build/outputs/aar/widgets-release.aar"
into "../build/"
}
}
assemble.dependsOn(cleanBuildDir)
copyAar.dependsOn(assemble)
build.dependsOn(copyAar)