mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-06-12 05:07:45 +02:00
Welcome Gradle Kotlin DSL
This commit is contained in:
29
buildSrc/src/main/java/BuildSource.kt
Normal file
29
buildSrc/src/main/java/BuildSource.kt
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
object Deps {
|
||||
const val vKotlin = "1.3.72"
|
||||
const val vNav = "2.3.0"
|
||||
}
|
||||
|
||||
private val props = Properties()
|
||||
|
||||
object Config {
|
||||
operator fun get(key: String) = props[key] as? String
|
||||
fun contains(key: String) = props.containsKey(key)
|
||||
}
|
||||
|
||||
class MagiskPlugin : Plugin<Project> {
|
||||
override fun apply(project: Project) {
|
||||
val file = project.findProperty("configPath")?.let { File(it as String) }
|
||||
?: project.file("config.prop")
|
||||
if (!file.exists())
|
||||
throw GradleException("Please setup config.prop")
|
||||
|
||||
file.inputStream().use { props.load(it) }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user