Files
jinzhi/android/build.gradle.kts
T
2026-09-18 11:04:29 +08:00

63 lines
2.0 KiB
Kotlin

import com.android.build.api.dsl.LibraryExtension
allprojects {
repositories {
google()
mavenCentral()
maven("https://maven.aliyun.com/repository/public")
maven("https://maven.aliyun.com/repository/gradle-plugin")
maven("https://maven.aliyun.com/repository/google")
maven("https://developer.huawei.com/repo/")
}
}
val newBuildDir: Directory =
rootProject.layout.buildDirectory
.dir("../../build")
.get()
rootProject.layout.buildDirectory.value(newBuildDir)
subprojects {
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
project.layout.buildDirectory.value(newSubprojectBuildDir)
}
subprojects {
project.evaluationDependsOn(":app")
}
// Partial shrinking is needed for the obfuscated one-key-login SDK. UMeng Push
// also runs an intermediate library shrinker with minSdk 14, which is not
// supported by partial shrinking. Let the app module remain the sole release
// shrinker (its minSdk is 24) and skip the redundant library minification.
subprojects {
if (name == "umeng_push_sdk") {
afterEvaluate {
extensions.configure<LibraryExtension> {
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
}
}
}
}
// The Gitea U-Verify plugin still targets an older Android Gradle Plugin and
// declares only the manifest package. AGP 8 requires an explicit namespace;
// keep the dependency as a Git package and supply its published namespace here.
subprojects {
plugins.withId("com.android.library") {
if (project.name == "umeng_verify_sdk") {
val androidExtension = extensions.getByName("android")
androidExtension.javaClass
.getMethod("setNamespace", String::class.java)
.invoke(androidExtension, "com.umeng.umeng_verify_sdk")
}
}
}
tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}