XuqmGroup-AndroidSDK/sample-app/build.gradle.kts

116 行
3.9 KiB
Plaintext

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.compose)
id("com.xuqm.common")
}
val releaseSigningProperties = mapOf(
"storeFile" to providers.gradleProperty("YIWANGXIN_STORE_FILE"),
"storePassword" to providers.gradleProperty("YIWANGXIN_STORE_PASSWORD"),
"keyAlias" to providers.gradleProperty("YIWANGXIN_ALIAS"),
"keyPassword" to providers.gradleProperty("YIWANGXIN_KEY_PASSWORD"),
)
val hasReleaseSigning = releaseSigningProperties.values.all {
it.orNull?.isNotBlank() == true
}
android {
namespace = "com.xuqm.sdk.sample"
compileSdk = libs.versions.compileSdk.get().toInt()
defaultConfig {
applicationId = "cn.org.bjca.wcert.ywq"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
versionCode = 1
versionName = "1.0.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
if (hasReleaseSigning) {
create("releaseFromProperties") {
storeFile = file(releaseSigningProperties.getValue("storeFile").get())
storePassword = releaseSigningProperties.getValue("storePassword").get()
keyAlias = releaseSigningProperties.getValue("keyAlias").get()
keyPassword = releaseSigningProperties.getValue("keyPassword").get()
}
}
}
buildTypes {
release {
isMinifyEnabled = false
signingConfig = signingConfigs.findByName("releaseFromProperties")
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
buildFeatures {
compose = true
buildConfig = true
}
}
val validateSampleReleaseSigning by tasks.registering {
group = "verification"
description = "校验 Sample Release 签名属性存在且密钥库文件可读。"
doLast {
val missing = releaseSigningProperties
.filterValues { it.orNull.isNullOrBlank() }
.keys
check(missing.isEmpty()) {
"Sample Release signing properties are missing: " +
missing.joinToString { key ->
when (key) {
"storeFile" -> "YIWANGXIN_STORE_FILE"
"storePassword" -> "YIWANGXIN_STORE_PASSWORD"
"keyAlias" -> "YIWANGXIN_ALIAS"
else -> "YIWANGXIN_KEY_PASSWORD"
}
}
}
check(file(releaseSigningProperties.getValue("storeFile").get()).isFile) {
"YIWANGXIN_STORE_FILE does not reference a readable file"
}
}
}
tasks.matching { it.name == "preReleaseBuild" }.configureEach {
dependsOn(validateSampleReleaseSigning)
}
dependencies {
coreLibraryDesugaring(libs.desugar.jdk.libs)
implementation(project(":sdk-core"))
implementation(project(":sdk-file"))
implementation(project(":sdk-bugcollect"))
implementation(project(":sdk-im"))
implementation(project(":sdk-push"))
implementation(project(":sdk-update"))
implementation(project(":sdk-webview"))
implementation(platform(libs.androidx.compose.bom))
implementation(libs.bundles.compose)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.google.material)
implementation(libs.androidx.navigation.compose)
implementation(libs.coil.compose)
implementation(libs.coil.network.okhttp)
debugImplementation(libs.bundles.compose.debug)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}