Update build-logic

- Prevent gradle from crashing when flags.prop does not exist
- Fix ndk version

[skip ci]
This commit is contained in:
topjohnwu
2026-08-11 01:09:03 +00:00
parent ede844bdaa
commit a65e492e3d
2 changed files with 10 additions and 6 deletions
+8 -4
View File
@@ -10,6 +10,7 @@ import java.util.Random
// CI builds are always reproducible
val RAND_SEED = if (System.getenv("CI") != null) 42 else 0
lateinit var RANDOM: Random
val ABI_SUPPORT_LIST = listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64", "riscv64")
private val props = Properties()
@@ -21,10 +22,13 @@ object Config {
fun contains(key: String) = get(key) != null
val version: String get() = get("version")!!
// Properties from config.prop and flags.prop, may be null
val version: String get() = get("version") ?: "null"
val abiList: List<String> get() = get("abiList")?.split(",") ?: ABI_SUPPORT_LIST
// Properties from gradle.properties, should always exist
val versionCode: Int get() = get("magisk.versionCode")!!.toInt()
val stubVersion: String get() = get("magisk.stubVersion")!!
val abiList: List<String> get() = get("abiList")!!.split(",")
}
fun Project.rootFile(path: String): File {
@@ -41,10 +45,10 @@ class MagiskPlugin : Plugin<Project> {
props.clear()
// Get gradle properties relevant to Magisk
props.putAll(properties.filter { (key, _) -> key.startsWith("magisk.") })
props.putAll(providers.gradlePropertiesPrefixedBy("magisk.").get())
// Load config.prop
val configPath: String? by this
val configPath = findProperty("configPath") as String?
val configFile = rootFile(configPath ?: "config.prop")
if (configFile.exists()) {
configFile.inputStream().use {
+2 -2
View File
@@ -47,7 +47,7 @@ fun Project.setupCommon() {
}
buildToolsVersion = "37.0.0"
ndkPath = "${androidComponents.sdkComponents.sdkDirectory.get().asFile}/ndk/magisk"
ndkVersion = "30.0.14904198"
ndkVersion = "30.0.15729638"
defaultConfig.apply {
minSdk = 23
@@ -282,7 +282,7 @@ fun Project.setupMainApk() {
versionName = Config.version
versionCode = Config.versionCode
ndk {
abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64", "riscv64")
abiFilters += ABI_SUPPORT_LIST
debugSymbolLevel = "FULL"
}
}