mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-20 07:00:05 +08:00
build: replace Deprecated Gradle API
This commit is contained in:
parent
990df9f93e
commit
24072a22f7
@ -1,3 +1,5 @@
|
|||||||
|
@file:Suppress("UnstableApiUsage")
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("kotlin-android")
|
id("kotlin-android")
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
|
import com.android.build.api.dsl.ApplicationExtension
|
||||||
|
import com.android.build.api.dsl.LibraryExtension
|
||||||
|
import com.android.build.api.dsl.Lint
|
||||||
import com.android.build.gradle.AbstractAppExtension
|
import com.android.build.gradle.AbstractAppExtension
|
||||||
|
import com.android.build.gradle.AppExtension
|
||||||
import com.android.build.gradle.BaseExtension
|
import com.android.build.gradle.BaseExtension
|
||||||
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
|
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
|
||||||
import org.gradle.api.JavaVersion
|
import org.gradle.api.JavaVersion
|
||||||
@ -16,7 +20,7 @@ fun sha256Hex(bytes: ByteArray): String {
|
|||||||
return digest.fold("") { str, it -> str + "%02x".format(it) }
|
return digest.fold("") { str, it -> str + "%02x".format(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private val Project.android get() = extensions.getByName<BaseExtension>("android")
|
private val Project.android get() = extensions.getByName<ApplicationExtension>("android")
|
||||||
|
|
||||||
private lateinit var metadata: Properties
|
private lateinit var metadata: Properties
|
||||||
private lateinit var localProperties: Properties
|
private lateinit var localProperties: Properties
|
||||||
@ -90,8 +94,8 @@ fun Project.requireTargetAbi(): String {
|
|||||||
|
|
||||||
fun Project.setupCommon() {
|
fun Project.setupCommon() {
|
||||||
android.apply {
|
android.apply {
|
||||||
buildToolsVersion("30.0.3")
|
buildToolsVersion = "30.0.3"
|
||||||
compileSdkVersion(33)
|
compileSdk = 33
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdk = 21
|
minSdk = 21
|
||||||
targetSdk = 33
|
targetSdk = 33
|
||||||
@ -108,16 +112,16 @@ fun Project.setupCommon() {
|
|||||||
(android as ExtensionAware).extensions.getByName<KotlinJvmOptions>("kotlinOptions").apply {
|
(android as ExtensionAware).extensions.getByName<KotlinJvmOptions>("kotlinOptions").apply {
|
||||||
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
||||||
}
|
}
|
||||||
lintOptions {
|
lint {
|
||||||
isShowAll = true
|
showAll = true
|
||||||
isCheckAllWarnings = true
|
checkAllWarnings = true
|
||||||
isCheckReleaseBuilds = false
|
checkReleaseBuilds = true
|
||||||
isWarningsAsErrors = true
|
warningsAsErrors = true
|
||||||
textOutput = project.file("build/lint.txt")
|
textOutput = project.file("build/lint.txt")
|
||||||
htmlOutput = project.file("build/lint.html")
|
htmlOutput = project.file("build/lint.html")
|
||||||
}
|
}
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
excludes.addAll(
|
resources.excludes.addAll(
|
||||||
listOf(
|
listOf(
|
||||||
"**/*.kotlin_*",
|
"**/*.kotlin_*",
|
||||||
"/META-INF/*.version",
|
"/META-INF/*.version",
|
||||||
@ -175,10 +179,10 @@ fun Project.setupAppCommon() {
|
|||||||
if (keystorePwd != null) {
|
if (keystorePwd != null) {
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
create("release") {
|
create("release") {
|
||||||
storeFile(rootProject.file("release.keystore"))
|
storeFile = rootProject.file("release.keystore")
|
||||||
storePassword(keystorePwd)
|
storePassword = keystorePwd
|
||||||
keyAlias(alias)
|
keyAlias = alias
|
||||||
keyPassword(pwd)
|
keyPassword = pwd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (requireFlavor().contains("(Oss|Expert|Play)Release".toRegex())) {
|
} else if (requireFlavor().contains("(Oss|Expert|Play)Release".toRegex())) {
|
||||||
@ -232,7 +236,7 @@ fun Project.setupApp() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
flavorDimensions("vendor")
|
flavorDimensions += "vendor"
|
||||||
productFlavors {
|
productFlavors {
|
||||||
create("oss")
|
create("oss")
|
||||||
create("fdroid")
|
create("fdroid")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user