Magisk/build.gradle.kts

106 lines
3.2 KiB
Plaintext
Raw Normal View History

2020-07-04 06:53:31 -07:00
import com.android.build.gradle.BaseExtension
plugins {
id("MagiskPlugin")
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
2020-07-04 06:53:31 -07:00
}
2021-07-18 13:11:20 +08:00
val vNav = "2.4.0-alpha06"
2020-08-15 05:43:28 -07:00
extra["vNav"] = vNav
2020-07-04 06:53:31 -07:00
dependencies {
2021-09-02 02:27:05 -07:00
classpath("com.android.tools.build:gradle:7.0.2")
2021-07-18 13:11:20 +08:00
classpath(kotlin("gradle-plugin", version = "1.5.30"))
2020-08-15 05:43:28 -07:00
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:${vNav}")
2020-07-04 06:53:31 -07:00
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
2020-12-06 06:30:45 +08:00
tasks.register("clean", Delete::class) {
2020-07-04 06:53:31 -07:00
delete(rootProject.buildDir)
}
2021-05-11 18:40:30 -07:00
fun Project.android(configuration: BaseExtension.() -> Unit) =
extensions.getByName<BaseExtension>("android").configuration()
2020-07-04 06:53:31 -07:00
subprojects {
repositories {
google()
mavenCentral()
2020-07-04 06:53:31 -07:00
maven { url = uri("https://jitpack.io") }
}
afterEvaluate {
if (plugins.hasPlugin("com.android.library") ||
2021-07-18 13:11:20 +08:00
plugins.hasPlugin("com.android.application")
) {
2021-05-11 18:40:30 -07:00
android {
2021-07-18 13:11:20 +08:00
compileSdkVersion(31)
buildToolsVersion = "31.0.0"
2020-10-17 06:42:34 -07:00
ndkPath = "${System.getenv("ANDROID_SDK_ROOT")}/ndk/magisk"
2020-07-04 06:53:31 -07:00
defaultConfig {
2021-05-12 13:40:53 +08:00
if (minSdk == null)
minSdk = 21
2021-07-18 13:11:20 +08:00
targetSdk = 31
2020-07-04 06:53:31 -07:00
}
compileOptions {
2021-07-24 03:51:00 -07:00
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
2020-07-04 06:53:31 -07:00
}
}
}
if (plugins.hasPlugin("java")) {
tasks.withType<JavaCompile> {
// If building with JDK 9+, we need additional flags to generate compatible bytecode
if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
options.compilerArgs.addAll(listOf("--release", "8"))
}
}
}
if (name == "app" || name == "stub") {
2021-05-11 18:40:30 -07:00
android {
2020-07-04 06:53:31 -07:00
signingConfigs {
create("config") {
Config["keyStore"]?.also {
2020-08-14 00:40:24 +08:00
storeFile = rootProject.file(it)
2020-07-04 06:53:31 -07:00
storePassword = Config["keyStorePass"]
keyAlias = Config["keyAlias"]
keyPassword = Config["keyPass"]
}
}
}
buildTypes {
signingConfigs.getByName("config").also {
getByName("debug") {
2020-12-06 06:30:45 +08:00
signingConfig = if (it.storeFile?.exists() == true) it
else signingConfigs.getByName("debug")
2020-07-04 06:53:31 -07:00
}
getByName("release") {
2020-12-06 06:30:45 +08:00
signingConfig = if (it.storeFile?.exists() == true) it
else signingConfigs.getByName("debug")
2020-07-04 06:53:31 -07:00
}
}
}
lintOptions {
2021-07-18 13:11:20 +08:00
disable += "MissingTranslation"
2020-07-04 06:53:31 -07:00
}
}
}
}
}