Skip to content

Commit

Permalink
Merge pull request MatsuriDayo#387 from MatsuriDayo/dev
Browse files Browse the repository at this point in the history
build: replace Deprecated Gradle API
  • Loading branch information
purofle authored Oct 29, 2023
2 parents 990df9f + 24072a2 commit afbab65
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("UnstableApiUsage")

plugins {
id("com.android.application")
id("kotlin-android")
Expand Down
32 changes: 18 additions & 14 deletions buildSrc/src/main/kotlin/Helpers.kt
Original file line number Diff line number Diff line change
@@ -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.AppExtension
import com.android.build.gradle.BaseExtension
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
import org.gradle.api.JavaVersion
Expand All @@ -16,7 +20,7 @@ fun sha256Hex(bytes: ByteArray): String {
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 localProperties: Properties
Expand Down Expand Up @@ -90,8 +94,8 @@ fun Project.requireTargetAbi(): String {

fun Project.setupCommon() {
android.apply {
buildToolsVersion("30.0.3")
compileSdkVersion(33)
buildToolsVersion = "30.0.3"
compileSdk = 33
defaultConfig {
minSdk = 21
targetSdk = 33
Expand All @@ -108,16 +112,16 @@ fun Project.setupCommon() {
(android as ExtensionAware).extensions.getByName<KotlinJvmOptions>("kotlinOptions").apply {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
lintOptions {
isShowAll = true
isCheckAllWarnings = true
isCheckReleaseBuilds = false
isWarningsAsErrors = true
lint {
showAll = true
checkAllWarnings = true
checkReleaseBuilds = true
warningsAsErrors = true
textOutput = project.file("build/lint.txt")
htmlOutput = project.file("build/lint.html")
}
packagingOptions {
excludes.addAll(
resources.excludes.addAll(
listOf(
"**/*.kotlin_*",
"/META-INF/*.version",
Expand Down Expand Up @@ -175,10 +179,10 @@ fun Project.setupAppCommon() {
if (keystorePwd != null) {
signingConfigs {
create("release") {
storeFile(rootProject.file("release.keystore"))
storePassword(keystorePwd)
keyAlias(alias)
keyPassword(pwd)
storeFile = rootProject.file("release.keystore")
storePassword = keystorePwd
keyAlias = alias
keyPassword = pwd
}
}
} else if (requireFlavor().contains("(Oss|Expert|Play)Release".toRegex())) {
Expand Down Expand Up @@ -232,7 +236,7 @@ fun Project.setupApp() {
}
}

flavorDimensions("vendor")
flavorDimensions += "vendor"
productFlavors {
create("oss")
create("fdroid")
Expand Down

0 comments on commit afbab65

Please sign in to comment.