2026-04-21 22:07:29 +08:00
|
|
|
|
plugins {
|
|
|
|
|
|
alias(libs.plugins.android.library)
|
2026-04-27 19:00:54 +08:00
|
|
|
|
alias(libs.plugins.kotlin.compose)
|
2026-04-21 22:07:29 +08:00
|
|
|
|
alias(libs.plugins.kotlin.serialization)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-29 15:23:51 +08:00
|
|
|
|
apply(from = rootProject.file("gradle/publish.gradle"))
|
2026-04-29 15:09:12 +08:00
|
|
|
|
|
2026-05-21 16:48:10 +08:00
|
|
|
|
version = providers.gradleProperty("SDK_CORE_VERSION")
|
|
|
|
|
|
.orElse(providers.gradleProperty("PUBLISH_VERSION"))
|
|
|
|
|
|
.getOrElse("0.1.0-SNAPSHOT")
|
|
|
|
|
|
|
2026-04-21 22:07:29 +08:00
|
|
|
|
android {
|
|
|
|
|
|
namespace = "com.xuqm.sdk.core"
|
|
|
|
|
|
compileSdk = libs.versions.compileSdk.get().toInt()
|
|
|
|
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
|
|
minSdk = libs.versions.minSdk.get().toInt()
|
|
|
|
|
|
consumerProguardFiles("consumer-rules.pro")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-23 13:35:07 +08:00
|
|
|
|
|
2026-04-21 22:07:29 +08:00
|
|
|
|
compileOptions {
|
2026-07-17 13:35:27 +08:00
|
|
|
|
isCoreLibraryDesugaringEnabled = true
|
2026-04-21 22:07:29 +08:00
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
|
|
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
|
|
|
|
}
|
2026-04-27 19:00:54 +08:00
|
|
|
|
|
|
|
|
|
|
buildFeatures {
|
|
|
|
|
|
compose = true
|
|
|
|
|
|
}
|
2026-04-29 15:32:23 +08:00
|
|
|
|
|
|
|
|
|
|
publishing {
|
2026-05-11 15:21:54 +08:00
|
|
|
|
singleVariant("release") {
|
|
|
|
|
|
withSourcesJar()
|
|
|
|
|
|
}
|
2026-04-29 15:32:23 +08:00
|
|
|
|
}
|
2026-04-21 22:07:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dependencies {
|
2026-04-27 19:00:54 +08:00
|
|
|
|
api(platform(libs.androidx.compose.bom))
|
2026-07-18 08:28:33 +08:00
|
|
|
|
// sdk-core 会进入原生、RN 与 Flutter 等不同宿主。通过 BOM 统一所有
|
|
|
|
|
|
// okhttp 组件(含宿主已有的 okhttp-urlconnection),避免同一 APK
|
|
|
|
|
|
// 混装 4.x 扩展与 5.x 主包造成运行时链接崩溃。
|
|
|
|
|
|
api(platform(libs.okhttp.bom))
|
2026-04-21 22:07:29 +08:00
|
|
|
|
api(libs.bundles.network)
|
|
|
|
|
|
api(libs.kotlinx.coroutines.android)
|
|
|
|
|
|
api(libs.kotlinx.serialization.json)
|
|
|
|
|
|
api(libs.androidx.core.ktx)
|
2026-04-27 17:18:55 +08:00
|
|
|
|
api(libs.androidx.security.crypto)
|
2026-04-27 19:00:54 +08:00
|
|
|
|
api(libs.androidx.ui)
|
|
|
|
|
|
api(libs.androidx.material3)
|
2026-07-17 13:35:27 +08:00
|
|
|
|
testImplementation(libs.junit4)
|
|
|
|
|
|
coreLibraryDesugaring(libs.desugar.jdk.libs)
|
2026-04-21 22:07:29 +08:00
|
|
|
|
}
|
2026-07-18 08:28:33 +08:00
|
|
|
|
|
|
|
|
|
|
val verifyNetworkDependencyAlignment by tasks.registering {
|
|
|
|
|
|
group = "verification"
|
|
|
|
|
|
description = "校验 sdk-core 的 OkHttp 组件均处于同一条二进制兼容线。"
|
|
|
|
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
|
|
val expected = libs.versions.okhttp.get()
|
|
|
|
|
|
val resolved = configurations.getByName("releaseRuntimeClasspath")
|
|
|
|
|
|
.resolvedConfiguration
|
|
|
|
|
|
.resolvedArtifacts
|
|
|
|
|
|
.mapNotNull { artifact ->
|
|
|
|
|
|
val id = artifact.moduleVersion.id
|
|
|
|
|
|
if (id.group == "com.squareup.okhttp3") id else null
|
|
|
|
|
|
}
|
|
|
|
|
|
.distinctBy { "${it.group}:${it.name}" }
|
|
|
|
|
|
val incompatible = resolved.filter { it.version != expected }
|
|
|
|
|
|
check(incompatible.isEmpty()) {
|
|
|
|
|
|
"OkHttp 组件未对齐到 $expected:" +
|
|
|
|
|
|
incompatible.joinToString { "${it.group}:${it.name}:${it.version}" }
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tasks.named("check").configure {
|
|
|
|
|
|
dependsOn(verifyNetworkDependencyAlignment)
|
|
|
|
|
|
}
|