From 5578d59e1fba7537761c6a8a64cacd7134b0a6c2 Mon Sep 17 00:00:00 2001 From: klaus Date: Mon, 29 Jun 2026 16:40:58 +0900 Subject: [PATCH] =?UTF-8?q?feat(release):=20release=20=EC=84=9C=EB=AA=85?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 8 +++--- app/build.gradle | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 567fae84..ad255a4a 100644 --- a/.gitignore +++ b/.gitignore @@ -64,9 +64,11 @@ captures/ .idea/deploymentTargetSelector.xml # Keystore files -# Uncomment the following lines if you do not want to check your keystore files in. -#*.jks -#*.keystore +*.jks +*.keystore +*.p12 +*.pem +*.key # External native build folder generated in Android Studio 2.2 and later .externalNativeBuild diff --git a/app/build.gradle b/app/build.gradle index 1fcc1224..69bc2b50 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,4 +1,6 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import java.util.Locale +import java.util.Properties plugins { id 'com.android.application' @@ -13,6 +15,27 @@ plugins { id 'com.google.firebase.crashlytics' } +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withInputStream { stream -> + localProperties.load(stream) + } +} + +def releaseSigningPropertyKeys = [ + 'RELEASE_STORE_FILE', + 'RELEASE_STORE_PASSWORD', + 'RELEASE_KEY_ALIAS', + 'RELEASE_KEY_PASSWORD' +] +def releaseSigningProperty = { key -> + localProperties.getProperty(key)?.trim() +} +def missingReleaseSigningProperties = { + releaseSigningPropertyKeys.findAll { key -> !releaseSigningProperty(key) } +} + android { namespace 'kr.co.vividnext.sodalive' compileSdk = 35 @@ -68,8 +91,25 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } + signingConfigs { + release { + def releaseStoreFile = releaseSigningProperty('RELEASE_STORE_FILE') + def releaseStorePassword = releaseSigningProperty('RELEASE_STORE_PASSWORD') + def releaseKeyAlias = releaseSigningProperty('RELEASE_KEY_ALIAS') + def releaseKeyPassword = releaseSigningProperty('RELEASE_KEY_PASSWORD') + + if (missingReleaseSigningProperties().isEmpty()) { + storeFile rootProject.file(releaseStoreFile) + storePassword releaseStorePassword + keyAlias releaseKeyAlias + keyPassword releaseKeyPassword + } + } + } + buildTypes { release { + signingConfig signingConfigs.release minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' @@ -172,6 +212,36 @@ android { } } +gradle.taskGraph.whenReady { taskGraph -> + def requiresReleaseSigning = taskGraph.allTasks.any { task -> + def taskName = task.name.toLowerCase(Locale.US) + taskName.contains('release') && ( + taskName.startsWith('assemble') || + taskName.startsWith('bundle') || + taskName.startsWith('install') || + taskName.startsWith('package') + ) + } + + if (!requiresReleaseSigning) { + return + } + + def missingProperties = missingReleaseSigningProperties() + if (!missingProperties.isEmpty()) { + throw new GradleException( + "Release signing properties are missing in local.properties: ${missingProperties.join(', ')}" + ) + } + + def releaseStoreFile = rootProject.file(releaseSigningProperty('RELEASE_STORE_FILE')) + if (!releaseStoreFile.exists()) { + throw new GradleException( + "Release signing store file does not exist: ${releaseStoreFile}" + ) + } +} + dependencies { implementation "androidx.media:media:1.7.1" implementation 'androidx.core:core-ktx:1.16.0'