- Updated AGP version to 8.9.2. - Added support for Android 16 (36). - Replaced the new API and fixed some minor bugs. Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
92 lines
2.6 KiB
Plaintext
92 lines
2.6 KiB
Plaintext
import com.android.build.api.dsl.ApplicationDefaultConfig
|
|
import com.android.build.api.dsl.CommonExtension
|
|
import com.android.build.gradle.api.AndroidBasePlugin
|
|
import java.io.ByteArrayOutputStream
|
|
|
|
plugins {
|
|
alias(libs.plugins.agp.app) apply false
|
|
alias(libs.plugins.agp.lib) apply false
|
|
alias(libs.plugins.kotlin) apply false
|
|
alias(libs.plugins.compose.compiler) apply false
|
|
alias(libs.plugins.lsplugin.cmaker)
|
|
}
|
|
|
|
cmaker {
|
|
default {
|
|
arguments.addAll(
|
|
arrayOf(
|
|
"-DANDROID_STL=none",
|
|
)
|
|
)
|
|
abiFilters("arm64-v8a", "x86_64", "riscv64")
|
|
}
|
|
buildTypes {
|
|
if (it.name == "release") {
|
|
arguments += "-DDEBUG_SYMBOLS_PATH=${layout.buildDirectory.asFile.get().absolutePath}/symbols"
|
|
}
|
|
}
|
|
}
|
|
|
|
val androidMinSdkVersion = 26
|
|
val androidTargetSdkVersion = 36
|
|
val androidCompileSdkVersion = 36
|
|
val androidCompileNdkVersion = "28.0.13004108"
|
|
val androidSourceCompatibility = JavaVersion.VERSION_21
|
|
val androidTargetCompatibility = JavaVersion.VERSION_21
|
|
val managerVersionCode by extra(1 * 10000 + getGitCommitCount() + 606)
|
|
val managerVersionName by extra(getGitDescribe())
|
|
|
|
fun getGitCommitCount(): Int {
|
|
return providers.exec {
|
|
commandLine("git", "rev-list", "--count", "HEAD")
|
|
}.standardOutput.asText.get().trim().toInt()
|
|
}
|
|
|
|
fun getGitDescribe(): String {
|
|
return providers.exec {
|
|
commandLine("git", "describe", "--tags", "--always", "--abbrev=0")
|
|
}.standardOutput.asText.get().trim()
|
|
}
|
|
|
|
|
|
|
|
fun getVersionCode(): Int {
|
|
val commitCount = getGitCommitCount()
|
|
val major = 1
|
|
return major * 10000 + commitCount + 606
|
|
}
|
|
|
|
fun getVersionName(): String {
|
|
return getGitDescribe()
|
|
}
|
|
|
|
subprojects {
|
|
plugins.withType(AndroidBasePlugin::class.java) {
|
|
extensions.configure(CommonExtension::class.java) {
|
|
compileSdk = androidCompileSdkVersion
|
|
ndkVersion = androidCompileNdkVersion
|
|
|
|
defaultConfig {
|
|
minSdk = androidMinSdkVersion
|
|
if (this is ApplicationDefaultConfig) {
|
|
targetSdk = androidTargetSdkVersion
|
|
versionCode = managerVersionCode
|
|
versionName = managerVersionName
|
|
}
|
|
ndk {
|
|
abiFilters += listOf("arm64-v8a", "x86_64", "riscv64")
|
|
}
|
|
}
|
|
|
|
lint {
|
|
abortOnError = true
|
|
checkReleaseBuilds = false
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = androidSourceCompatibility
|
|
targetCompatibility = androidTargetCompatibility
|
|
}
|
|
}
|
|
}
|
|
} |