Use Kotlin instead of Groovy for Android build configuration (#2902)
This commit is contained in:
committed by
GitHub
parent
1fa7df3331
commit
8d284cf331
@@ -1,129 +0,0 @@
|
||||
plugins {
|
||||
alias libs.plugins.kotlinter
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
alias libs.plugins.kotlinPluginSerialization
|
||||
}
|
||||
|
||||
apply from: "${rootDir}/gradle/native-build.gradle"
|
||||
|
||||
def obtainTestBuildType() {
|
||||
def result = "debug";
|
||||
|
||||
if (project.hasProperty("testBuildType")) {
|
||||
result = project.getProperties().get("testBuildType")
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
android {
|
||||
defaultConfig {
|
||||
applicationId "org.maplibre.android.testapp"
|
||||
compileSdk 34
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 33
|
||||
versionCode 14
|
||||
versionName "6.0.1"
|
||||
testInstrumentationRunner "org.maplibre.android.InstrumentationRunner"
|
||||
multiDexEnabled = true
|
||||
}
|
||||
|
||||
nativeBuild(["example-custom-layer"])
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += ['META-INF/LICENSE.txt', 'META-INF/NOTICE.txt', 'LICENSE.txt']
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
jniDebuggable true
|
||||
debuggable true
|
||||
testCoverageEnabled true
|
||||
minifyEnabled false
|
||||
shrinkResources false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
release {
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
testProguardFiles 'test-proguard-rules.pro'
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
|
||||
testBuildType obtainTestBuildType()
|
||||
|
||||
flavorDimensions += "renderer"
|
||||
productFlavors {
|
||||
create("legacy") {
|
||||
dimension = "renderer"
|
||||
}
|
||||
create("drawable") {
|
||||
dimension = "renderer"
|
||||
}
|
||||
create("vulkan") {
|
||||
dimension = "renderer"
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
buildConfig true
|
||||
}
|
||||
|
||||
namespace 'org.maplibre.android.testapp'
|
||||
|
||||
lint {
|
||||
abortOnError false
|
||||
baseline file('lint-baseline-local.xml')
|
||||
checkAllWarnings true
|
||||
disable 'MissingTranslation', 'GoogleAppIndexingWarning', 'UnpackedNativeCode', 'IconDipSize', 'TypographyQuotes'
|
||||
warningsAsErrors true
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(17)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':MapLibreAndroid')
|
||||
implementation libs.maplibreJavaTurf
|
||||
|
||||
implementation libs.supportRecyclerView
|
||||
implementation libs.supportDesign
|
||||
implementation libs.supportConstraintLayout
|
||||
implementation libs.kotlinxSerializationJson
|
||||
|
||||
implementation libs.multidex
|
||||
|
||||
implementation libs.timber
|
||||
|
||||
implementation libs.okhttp3
|
||||
|
||||
implementation libs.kotlinxCoroutinesCore
|
||||
implementation libs.kotlinxCoroutinesAndroid
|
||||
|
||||
debugImplementation libs.leakCanary
|
||||
|
||||
androidTestImplementation libs.supportAnnotations
|
||||
androidTestImplementation libs.testRunner
|
||||
androidTestImplementation libs.testRules
|
||||
androidTestImplementation libs.testEspressoCore
|
||||
androidTestImplementation libs.testEspressoIntents
|
||||
androidTestImplementation libs.testEspressoContrib
|
||||
androidTestImplementation libs.testUiAutomator
|
||||
androidTestImplementation libs.appCenter
|
||||
androidTestImplementation libs.androidxTestExtJUnit
|
||||
androidTestImplementation libs.androidxTestCoreKtx
|
||||
androidTestImplementation libs.kotlinxCoroutinesTest
|
||||
}
|
||||
|
||||
apply from: "${rootDir}/gradle/gradle-make.gradle"
|
||||
apply from: "${rootDir}/gradle/gradle-config.gradle"
|
||||
apply from: "${rootDir}/gradle/gradle-checkstyle.gradle"
|
||||
apply from: "${rootDir}/gradle/gradle-lint.gradle"
|
||||
122
platform/android/MapLibreAndroidTestApp/build.gradle.kts
Normal file
122
platform/android/MapLibreAndroidTestApp/build.gradle.kts
Normal file
@@ -0,0 +1,122 @@
|
||||
plugins {
|
||||
alias(libs.plugins.kotlinter)
|
||||
id("com.android.application")
|
||||
alias(libs.plugins.kotlinAndroid)
|
||||
alias(libs.plugins.kotlinPluginSerialization)
|
||||
id("maplibre.gradle-make")
|
||||
id("maplibre.gradle-config")
|
||||
id("maplibre.gradle-checkstyle")
|
||||
id("maplibre.gradle-lint")
|
||||
}
|
||||
|
||||
|
||||
fun obtainTestBuildType(): String {
|
||||
return if (project.hasProperty("testBuildType")) {
|
||||
project.properties["testBuildType"] as String
|
||||
} else {
|
||||
"debug"
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "org.maplibre.android.testapp"
|
||||
minSdk = 21
|
||||
targetSdk = 33
|
||||
versionCode = 14
|
||||
versionName = "6.0.1"
|
||||
testInstrumentationRunner = "org.maplibre.android.InstrumentationRunner"
|
||||
multiDexEnabled = true
|
||||
}
|
||||
|
||||
nativeBuild(listOf("example-custom-layer"))
|
||||
|
||||
packaging {
|
||||
resources.excludes += listOf("META-INF/LICENSE.txt", "META-INF/NOTICE.txt", "LICENSE.txt")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
getByName("debug") {
|
||||
isJniDebuggable = true
|
||||
isDebuggable = true
|
||||
isTestCoverageEnabled = true
|
||||
isMinifyEnabled = false
|
||||
isShrinkResources = false
|
||||
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
|
||||
}
|
||||
getByName("release") {
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
|
||||
testProguardFiles("test-proguard-rules.pro")
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
}
|
||||
}
|
||||
|
||||
testBuildType = obtainTestBuildType()
|
||||
|
||||
flavorDimensions += "renderer"
|
||||
|
||||
productFlavors {
|
||||
create("legacy") {
|
||||
dimension = "renderer"
|
||||
}
|
||||
create("drawable") {
|
||||
dimension = "renderer"
|
||||
}
|
||||
create("vulkan") {
|
||||
dimension = "renderer"
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
buildConfig = true
|
||||
}
|
||||
|
||||
namespace = "org.maplibre.android.testapp"
|
||||
|
||||
lint {
|
||||
abortOnError = false
|
||||
baseline = file("lint-baseline-local.xml")
|
||||
checkAllWarnings = true
|
||||
disable += listOf("MissingTranslation", "GoogleAppIndexingWarning", "UnpackedNativeCode", "IconDipSize", "TypographyQuotes")
|
||||
warningsAsErrors = true
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(17)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":MapLibreAndroid"))
|
||||
implementation(libs.maplibreJavaTurf)
|
||||
|
||||
implementation(libs.supportRecyclerView)
|
||||
implementation(libs.supportDesign)
|
||||
implementation(libs.supportConstraintLayout)
|
||||
implementation(libs.kotlinxSerializationJson)
|
||||
|
||||
implementation(libs.multidex)
|
||||
implementation(libs.timber)
|
||||
implementation(libs.okhttp3)
|
||||
implementation(libs.kotlinxCoroutinesCore)
|
||||
implementation(libs.kotlinxCoroutinesAndroid)
|
||||
|
||||
debugImplementation(libs.leakCanary)
|
||||
|
||||
androidTestImplementation(libs.supportAnnotations)
|
||||
androidTestImplementation(libs.testRunner)
|
||||
androidTestImplementation(libs.testRules)
|
||||
androidTestImplementation(libs.testEspressoCore)
|
||||
androidTestImplementation(libs.testEspressoIntents)
|
||||
androidTestImplementation(libs.testEspressoContrib)
|
||||
androidTestImplementation(libs.testUiAutomator)
|
||||
androidTestImplementation(libs.appCenter)
|
||||
androidTestImplementation(libs.androidxTestExtJUnit)
|
||||
androidTestImplementation(libs.androidxTestCoreKtx)
|
||||
androidTestImplementation(libs.kotlinxCoroutinesTest)
|
||||
}
|
||||
Reference in New Issue
Block a user