mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
Update build-logic
- Prevent gradle from crashing when flags.prop does not exist - Fix ndk version [skip ci]
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user