|
1 | 1 | import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
|
2 | 2 | import io.gitlab.arturbosch.detekt.Detekt
|
3 | 3 | import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
|
| 4 | +import java.io.FileInputStream |
| 5 | +import java.util.Properties |
4 | 6 |
|
5 | 7 | plugins {
|
6 | 8 | alias(libs.plugins.android.application)
|
@@ -28,8 +30,38 @@ android {
|
28 | 30 | versionName = "2.1.0"
|
29 | 31 | }
|
30 | 32 |
|
| 33 | + signingConfigs { |
| 34 | + create("release") { |
| 35 | + val keyStorePassword = "KS_PASSWORD" |
| 36 | + val keyStoreKeyAlias = "KS_KEY_ALIAS" |
| 37 | + val properties = Properties().apply { |
| 38 | + val file = File(projectDir.parent, "keystore.properties") |
| 39 | + if (file.exists()) { |
| 40 | + load(FileInputStream(file)) |
| 41 | + } |
| 42 | + } |
| 43 | + val password = properties |
| 44 | + .getOrDefault(keyStorePassword, null) |
| 45 | + ?.toString() |
| 46 | + ?: System.getenv(keyStorePassword) |
| 47 | + val alias = properties |
| 48 | + .getOrDefault(keyStoreKeyAlias, null) |
| 49 | + ?.toString() |
| 50 | + ?: System.getenv(keyStoreKeyAlias) |
| 51 | + storeFile = File(projectDir.parent, "keystore.jks") |
| 52 | + storePassword = password |
| 53 | + keyAlias = alias |
| 54 | + keyPassword = password |
| 55 | + enableV1Signing = false |
| 56 | + enableV2Signing = false |
| 57 | + enableV3Signing = true |
| 58 | + enableV4Signing = true |
| 59 | + } |
| 60 | + } |
| 61 | + |
31 | 62 | buildTypes {
|
32 | 63 | release {
|
| 64 | + signingConfig = signingConfigs.findByName("release") |
33 | 65 | isMinifyEnabled = true
|
34 | 66 | isShrinkResources = true
|
35 | 67 | proguardFiles(
|
@@ -60,7 +92,9 @@ android {
|
60 | 92 |
|
61 | 93 | tasks.withType<DependencyUpdatesTask>().configureEach {
|
62 | 94 | fun isNonStable(version: String): Boolean {
|
63 |
| - val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) } |
| 95 | + val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { keyWord -> |
| 96 | + version.uppercase().contains(keyWord) |
| 97 | + } |
64 | 98 | val regex = "^[0-9,.v-]+(-r)?$".toRegex()
|
65 | 99 | val isStable = stableKeyword || regex.matches(version)
|
66 | 100 | return isStable.not()
|
|
0 commit comments