mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(android): edge-to-edge
Squashed from feat/edge-to-edge and resolved conflicts
This commit is contained in:
@@ -1,122 +1,123 @@
|
||||
import groovy.json.JsonSlurper // used to parse package.json
|
||||
import groovy.json.JsonBuilder
|
||||
import groovy.json.JsonOutput
|
||||
// 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 31
|
||||
}
|
||||
def computeCompileSdkVersion() {
|
||||
if (project.hasProperty("compileSdk")) {
|
||||
return compileSdk
|
||||
} else {
|
||||
return 35
|
||||
}
|
||||
}
|
||||
|
||||
def computeBuildToolsVersion() {
|
||||
if(project.hasProperty("buildToolsVersion")) {
|
||||
return buildToolsVersion
|
||||
}
|
||||
else {
|
||||
return "32.0.0"
|
||||
}
|
||||
if (project.hasProperty("buildToolsVersion")) {
|
||||
return buildToolsVersion
|
||||
} else {
|
||||
return "35.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
def computeTargetSdkVersion() {
|
||||
if(project.hasProperty("targetSdk")) {
|
||||
return targetSdk
|
||||
}
|
||||
else {
|
||||
return 30
|
||||
}
|
||||
if (project.hasProperty("targetSdk")) {
|
||||
return targetSdk
|
||||
} else {
|
||||
return 35
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion computeCompileSdkVersion()
|
||||
buildToolsVersion computeBuildToolsVersion()
|
||||
namespace "org.nativescript.widgets"
|
||||
compileSdkVersion computeCompileSdkVersion()
|
||||
buildToolsVersion computeBuildToolsVersion()
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 17
|
||||
targetSdkVersion computeTargetSdkVersion()
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion computeTargetSdkVersion()
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
def androidXViewPagerVersion = "1.0.0"
|
||||
if (project.hasProperty("androidXViewPager")) {
|
||||
androidXViewPagerVersion = androidXViewPager
|
||||
println "\t + using android X library androidx.viewpager2:viewpager2:$androidXViewPagerVersion"
|
||||
}
|
||||
def androidXViewPagerVersion = "1.1.0"
|
||||
if (project.hasProperty("androidXViewPager")) {
|
||||
androidXViewPagerVersion = androidXViewPager
|
||||
println "\t + using android X library androidx.viewpager2:viewpager2:$androidXViewPagerVersion"
|
||||
}
|
||||
|
||||
def androidXFragmentVersion = "1.4.1"
|
||||
if (project.hasProperty("androidXFragment")) {
|
||||
androidXFragmentVersion = androidXFragment
|
||||
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.fragment:fragment:$androidXFragmentVersion"
|
||||
}
|
||||
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.4.1"
|
||||
if (project.hasProperty("androidXTransition")) {
|
||||
androidXTransitionVersion = androidXTransition
|
||||
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.transition:transition:$androidXTransitionVersion"
|
||||
}
|
||||
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.3.3"
|
||||
if (project.hasProperty("androidXExifInterface")) {
|
||||
androidXExifInterfaceVersion = androidXExifInterface
|
||||
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.exifinterface:exifinterface:$androidXExifInterfaceVersion"
|
||||
}
|
||||
|
||||
|
||||
def androidXAppCompatVersion = "1.4.1"
|
||||
if (project.hasProperty("androidXAppCompat")) {
|
||||
androidXAppCompatVersion = androidXAppCompat
|
||||
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.appcompat:appcompat:$androidXAppCompatVersion"
|
||||
}
|
||||
|
||||
def androidXDocumentFileVersion = "1.0.1"
|
||||
if (project.hasProperty("androidXDocumentFile")) {
|
||||
androidXDocumentFileVersion = androidXDocumentFile
|
||||
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.documentfile:documentfile:$androidXDocumentFileVersion"
|
||||
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"
|
||||
}
|
||||
|
||||
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
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"
|
||||
}
|
||||
|
||||
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"
|
||||
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"
|
||||
}
|
||||
|
||||
task cleanBuildDir (type: Delete) {
|
||||
delete "../build/"
|
||||
tasks.register('cleanBuildDir', Delete) {
|
||||
delete "../build/"
|
||||
}
|
||||
|
||||
task copyAar {
|
||||
doLast {
|
||||
copy {
|
||||
from "build/outputs/aar/widgets-release.aar"
|
||||
into "../build/"
|
||||
}
|
||||
}
|
||||
tasks.register('copyAar') {
|
||||
doLast {
|
||||
copy {
|
||||
from "build/outputs/aar/widgets-release.aar"
|
||||
into "../build/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.deprecation = true
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.deprecation = true
|
||||
}
|
||||
|
||||
assemble.dependsOn(cleanBuildDir)
|
||||
|
||||
Reference in New Issue
Block a user