Files
NativeScript/packages/ui-mobile-base/android/widgets/build.gradle
2025-07-28 15:33:24 -04:00

126 lines
3.8 KiB
Groovy

// used to parse package.json
def isWinOs = System.properties['os.name'].toLowerCase().contains('windows')
apply plugin: 'com.android.library'
def computeCompileSdkVersion() {
if (project.hasProperty("compileSdk")) {
return compileSdk
} else {
return 35
}
}
def computeBuildToolsVersion() {
if (project.hasProperty("buildToolsVersion")) {
return buildToolsVersion
} else {
return "35.0.0"
}
}
def computeTargetSdkVersion() {
if (project.hasProperty("targetSdk")) {
return targetSdk
} else {
return 35
}
}
android {
namespace "org.nativescript.widgets"
compileSdkVersion computeCompileSdkVersion()
buildToolsVersion computeBuildToolsVersion()
defaultConfig {
minSdkVersion 21
targetSdkVersion computeTargetSdkVersion()
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
def androidXViewPagerVersion = "1.1.0"
if (project.hasProperty("androidXViewPager")) {
androidXViewPagerVersion = androidXViewPager
println "\t + using android X library androidx.viewpager2:viewpager2:$androidXViewPagerVersion"
}
def androidXFragmentVersion = "1.8.8"
if (project.hasProperty("androidXFragment")) {
androidXFragmentVersion = androidXFragment
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.fragment:fragment:$androidXFragmentVersion"
}
def androidXTransitionVersion = "1.6.0"
if (project.hasProperty("androidXTransition")) {
androidXTransitionVersion = androidXTransition
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.transition:transition:$androidXTransitionVersion"
}
def androidXExifInterfaceVersion = "1.4.1"
if (project.hasProperty("androidXExifInterface")) {
androidXExifInterfaceVersion = androidXExifInterface
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.exifinterface:exifinterface:$androidXExifInterfaceVersion"
}
def androidXAppCompatVersion = "1.7.1"
if (project.hasProperty("androidXAppCompat")) {
androidXAppCompatVersion = androidXAppCompat
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.appcompat:appcompat:$androidXAppCompatVersion"
}
def androidXDocumentFileVersion = "1.1.0"
if (project.hasProperty("androidXDocumentFile")) {
androidXDocumentFileVersion = androidXDocumentFile
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.documentfile:documentfile:$androidXDocumentFileVersion"
}
def androidXActivityVersion = "1.10.1"
if (project.hasProperty("androidXActivity")) {
androidXActivityVersion = androidXActivity
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.activity:activity:$androidXActivityVersion"
}
implementation fileTree(include: ['*.jar'], dir: 'libs')
println 'Using android X'
// implementation 'androidx.viewpager:viewpager:' + androidxVersion
implementation "androidx.viewpager2:viewpager2:$androidXViewPagerVersion"
implementation "androidx.fragment:fragment:$androidXFragmentVersion"
implementation "androidx.transition:transition:$androidXTransitionVersion"
implementation "androidx.exifinterface:exifinterface:$androidXExifInterfaceVersion"
implementation "androidx.appcompat:appcompat:$androidXAppCompatVersion"
implementation "androidx.documentfile:documentfile:$androidXDocumentFileVersion"
implementation "androidx.activity:activity:$androidXActivityVersion"
}
tasks.register('cleanBuildDir', Delete) {
delete "../build/"
}
tasks.register('copyAar') {
doLast {
copy {
from "build/outputs/aar/widgets-release.aar"
into "../build/"
}
}
}
tasks.withType(JavaCompile).configureEach {
options.deprecation = true
}
assemble.dependsOn(cleanBuildDir)
copyAar.dependsOn(assemble)
build.dependsOn(copyAar)