73 lines
2.3 KiB
Kotlin
73 lines
2.3 KiB
Kotlin
plugins {
|
|
id("com.android.library")
|
|
id("org.jetbrains.kotlin.android")
|
|
id("com.google.devtools.ksp")
|
|
}
|
|
|
|
android {
|
|
val sdkVersion = rootProject.extra["sdkVersion"] as Int?
|
|
val minSdkVersion = rootProject.extra["minSdkVersion"] as Int?
|
|
compileSdk = sdkVersion
|
|
|
|
defaultConfig {
|
|
minSdk = minSdkVersion
|
|
targetSdk = sdkVersion
|
|
|
|
testInstrumentationRunner = rootProject.extra["testInstrumentationRunner"] as String?
|
|
rootProject.extra["consumerProguardFiles"]?.let { consumerProguardFiles(it) }
|
|
resourceConfigurations += listOf("en", "zh", "zh-rCN", "zh-rHK", "zh-rTW")
|
|
javaCompileOptions {
|
|
annotationProcessorOptions {
|
|
arguments += mapOf(
|
|
"room.schemaLocation" to "$projectDir/schemas",
|
|
"room.incremental" to "true"
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
// 开启混淆
|
|
isMinifyEnabled = true
|
|
proguardFiles(
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
"proguard-rules.pro"
|
|
)
|
|
}
|
|
}
|
|
val javaVersion = rootProject.extra["javaVersion"] as JavaVersion
|
|
val javaVersionName = javaVersion.toString()
|
|
|
|
kotlin {
|
|
jvmToolchain {
|
|
languageVersion.set(JavaLanguageVersion.of(javaVersionName))
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = javaVersion
|
|
targetCompatibility = javaVersion
|
|
}
|
|
namespace = "com.zj.model"
|
|
}
|
|
|
|
dependencies {
|
|
|
|
implementation("${rootProject.extra["coreKtx"] as String?}")
|
|
implementation("${rootProject.extra["appcompat"] as String?}")
|
|
implementation("androidx.test.ext:junit-ktx:1.1.5")
|
|
implementation("androidx.test:core-ktx:1.5.0")
|
|
|
|
// Room
|
|
val roomVersion = "2.6.1"
|
|
api("androidx.room:room-runtime:$roomVersion")
|
|
ksp("androidx.room:room-compiler:$roomVersion")
|
|
// 对 Room 的 Kotlin 扩展和协程支持
|
|
api("androidx.room:room-ktx:$roomVersion")
|
|
|
|
testImplementation("${rootProject.extra["junit"] as String?}")
|
|
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.0") // 用于测试的协程库
|
|
androidTestImplementation("${rootProject.extra["extJunit"] as String?}")
|
|
androidTestImplementation("${rootProject.extra["espressoCore"] as String?}")
|
|
} |