KernelSU/manager/build.gradle.kts

98 lines
2.8 KiB
Plaintext
Raw Permalink Normal View History

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
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(
2024-07-08 22:49:18 +08:00
"-DANDROID_STL=none",
)
)
2024-07-08 22:49:18 +08:00
abiFilters("arm64-v8a", "x86_64", "riscv64")
}
buildTypes {
if (it.name == "release") {
2024-07-08 22:49:18 +08:00
arguments += "-DDEBUG_SYMBOLS_PATH=${layout.buildDirectory.asFile.get().absolutePath}/symbols"
}
}
}
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
val managerVersionCode by extra(getVersionCode())
val managerVersionName by extra(getVersionName())
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
return major * 10000 + commitCount + 200
2023-01-06 14:09:50 +08:00
}
fun getVersionName(): String {
return getGitDescribe()
}
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
}
ndk {
abiFilters += listOf("arm64-v8a", "x86_64", "riscv64")
}
}
lint {
abortOnError = true
checkReleaseBuilds = false
}
compileOptions {
sourceCompatibility = androidSourceCompatibility
targetCompatibility = androidTargetCompatibility
}
}
}
2024-04-13 11:43:45 +03:00
}