2023-04-21 16:19:49 +08:00
|
|
|
import com.android.build.api.dsl.ApplicationDefaultConfig
|
|
|
|
import com.android.build.api.dsl.CommonExtension
|
|
|
|
import com.android.build.gradle.api.AndroidBasePlugin
|
2023-01-06 14:09:50 +08:00
|
|
|
import java.io.ByteArrayOutputStream
|
2022-12-26 08:59:37 +08:00
|
|
|
|
|
|
|
plugins {
|
2023-04-21 16:19:49 +08:00
|
|
|
alias(libs.plugins.agp.app) apply false
|
|
|
|
alias(libs.plugins.agp.lib) apply false
|
|
|
|
alias(libs.plugins.kotlin) apply false
|
2024-05-25 06:07:27 +03:00
|
|
|
alias(libs.plugins.compose.compiler) apply false
|
2023-04-21 16:19:49 +08:00
|
|
|
alias(libs.plugins.lsplugin.cmaker)
|
2022-12-26 08:59:37 +08:00
|
|
|
}
|
|
|
|
|
2023-04-21 16:19:49 +08:00
|
|
|
cmaker {
|
|
|
|
default {
|
|
|
|
arguments.addAll(
|
|
|
|
arrayOf(
|
2024-07-08 22:49:18 +08:00
|
|
|
"-DANDROID_STL=none",
|
2023-04-21 16:19:49 +08:00
|
|
|
)
|
|
|
|
)
|
2024-07-08 22:49:18 +08:00
|
|
|
abiFilters("arm64-v8a", "x86_64", "riscv64")
|
2022-12-26 08:59:37 +08:00
|
|
|
}
|
2023-04-21 16:19:49 +08:00
|
|
|
buildTypes {
|
|
|
|
if (it.name == "release") {
|
2024-07-08 22:49:18 +08:00
|
|
|
arguments += "-DDEBUG_SYMBOLS_PATH=${layout.buildDirectory.asFile.get().absolutePath}/symbols"
|
2023-04-21 16:19:49 +08:00
|
|
|
}
|
2022-12-26 08:59:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-21 16:19:49 +08:00
|
|
|
val androidMinSdkVersion = 26
|
2024-07-08 22:49:18 +08:00
|
|
|
val androidTargetSdkVersion = 35
|
|
|
|
val androidCompileSdkVersion = 35
|
|
|
|
val androidBuildToolsVersion = "35.0.0"
|
2024-07-17 23:32:10 +08:00
|
|
|
val androidCompileNdkVersion = "27.0.12077973"
|
2024-04-13 11:43:45 +03:00
|
|
|
val androidSourceCompatibility = JavaVersion.VERSION_21
|
|
|
|
val androidTargetCompatibility = JavaVersion.VERSION_21
|
2023-04-21 16:19:49 +08:00
|
|
|
val managerVersionCode by extra(getVersionCode())
|
|
|
|
val managerVersionName by extra(getVersionName())
|
2022-12-26 08:59:37 +08:00
|
|
|
|
2023-01-06 14:09:50 +08:00
|
|
|
fun getGitCommitCount(): Int {
|
|
|
|
val out = ByteArrayOutputStream()
|
|
|
|
exec {
|
|
|
|
commandLine("git", "rev-list", "--count", "HEAD")
|
|
|
|
standardOutput = out
|
|
|
|
}
|
|
|
|
return out.toString().trim().toInt()
|
|
|
|
}
|
|
|
|
|
|
|
|
fun getGitDescribe(): String {
|
|
|
|
val out = ByteArrayOutputStream()
|
|
|
|
exec {
|
|
|
|
commandLine("git", "describe", "--tags", "--always")
|
|
|
|
standardOutput = out
|
|
|
|
}
|
|
|
|
return out.toString().trim()
|
|
|
|
}
|
|
|
|
|
|
|
|
fun getVersionCode(): Int {
|
|
|
|
val commitCount = getGitCommitCount()
|
|
|
|
val major = 1
|
2023-01-06 14:16:57 +08:00
|
|
|
return major * 10000 + commitCount + 200
|
2023-01-06 14:09:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
fun getVersionName(): String {
|
|
|
|
return getGitDescribe()
|
|
|
|
}
|
|
|
|
|
2023-04-21 16:19:49 +08:00
|
|
|
subprojects {
|
|
|
|
plugins.withType(AndroidBasePlugin::class.java) {
|
|
|
|
extensions.configure(CommonExtension::class.java) {
|
|
|
|
compileSdk = androidCompileSdkVersion
|
|
|
|
ndkVersion = androidCompileNdkVersion
|
|
|
|
buildToolsVersion = androidBuildToolsVersion
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
minSdk = androidMinSdkVersion
|
|
|
|
if (this is ApplicationDefaultConfig) {
|
|
|
|
targetSdk = androidTargetSdkVersion
|
|
|
|
versionCode = managerVersionCode
|
|
|
|
versionName = managerVersionName
|
|
|
|
}
|
2024-10-01 20:40:16 +08:00
|
|
|
ndk {
|
|
|
|
abiFilters += listOf("arm64-v8a", "x86_64", "riscv64")
|
|
|
|
}
|
2022-12-26 08:59:37 +08:00
|
|
|
}
|
|
|
|
|
2023-04-21 16:19:49 +08:00
|
|
|
lint {
|
|
|
|
abortOnError = true
|
|
|
|
checkReleaseBuilds = false
|
2022-12-26 08:59:37 +08:00
|
|
|
}
|
|
|
|
|
2023-04-21 16:19:49 +08:00
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility = androidSourceCompatibility
|
|
|
|
targetCompatibility = androidTargetCompatibility
|
2022-12-26 08:59:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-04-13 11:43:45 +03:00
|
|
|
}
|