diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f20da928..79e30bb7 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,5 +1,6 @@ import com.android.build.gradle.internal.api.BaseVariantOutputImpl import java.io.ByteArrayOutputStream +import java.util.Properties plugins { id("com.android.application") @@ -17,13 +18,33 @@ android { versionCode = getVersionCode() versionName = "1.0" + "-" + getVersionName() } - + val properties = Properties() + runCatching { properties.load(project.rootProject.file("local.properties").inputStream()) } + val keystorePath = properties.getProperty("KEYSTORE_PATH") ?: System.getenv("KEYSTORE_PATH") + val keystorePwd = properties.getProperty("KEYSTORE_PASS") ?: System.getenv("KEYSTORE_PASS") + val alias = properties.getProperty("KEY_ALIAS") ?: System.getenv("KEY_ALIAS") + val pwd = properties.getProperty("KEY_PASSWORD") ?: System.getenv("KEY_PASSWORD") + if (keystorePath != null) { + signingConfigs { + create("release") { + storeFile = file(keystorePath) + storePassword = keystorePwd + keyAlias = alias + keyPassword = pwd + enableV2Signing = true + enableV3Signing = true + enableV4Signing = true + } + } + } buildTypes { release { isMinifyEnabled = true - proguardFiles( - getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" - ) + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + if (keystorePath != null) signingConfig = signingConfigs.getByName("release") + } + debug { + if (keystorePath != null) signingConfig = signingConfigs.getByName("release") } } compileOptions {