feat(release): release 서명 설정을 추가한다
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user