-
Notifications
You must be signed in to change notification settings - Fork 356
/
build.gradle.kts
88 lines (75 loc) · 2.33 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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.kotlin.compose.compiler) apply false
alias(libs.plugins.lsplugin.cmaker)
}
cmaker {
default {
arguments += "-DANDROID_STL=none"
arguments += "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
abiFilters("arm64-v8a")
}
}
project.ext.set("kernelPatchVersion", "0.11.1-dev")
val androidMinSdkVersion = 26
val androidTargetSdkVersion = 35
val androidCompileSdkVersion = 35
val androidCompileNdkVersion = "27.1.12297006"
val managerVersionCode by extra(getVersionCode())
val managerVersionName by extra(getVersionName())
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
}
fun getVersionName(): String {
return getGitDescribe()
}
tasks.register("printVersion") {
doLast {
println("Version code: $managerVersionCode")
println("Version name: $managerVersionName")
}
}
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
}
}
lint {
abortOnError = true
checkReleaseBuilds = false
}
}
}
}