mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-31 12:01:54 +02:00
Add ProGuard rules and OSS build type
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
import java.io.FileInputStream
|
||||
import java.io.FileNotFoundException
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.kotlin.android)
|
||||
@@ -22,19 +26,86 @@ android {
|
||||
manifestPlaceholders["appRoundIcon"] = "@mipmap/ic_launcher_round"
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
create("release") {
|
||||
val keystorePropertiesFile = rootProject.file("../../openScale.keystore")
|
||||
val keystoreProperties = Properties()
|
||||
var propertiesLoaded : Boolean
|
||||
|
||||
try {
|
||||
FileInputStream(keystorePropertiesFile).use { fis ->
|
||||
keystoreProperties.load(fis)
|
||||
}
|
||||
propertiesLoaded = true
|
||||
} catch (e: FileNotFoundException) {
|
||||
project.logger.warn("Keystore properties file not found: ${keystorePropertiesFile.absolutePath}. Release signing might fail if not configured via environment variables.")
|
||||
propertiesLoaded = false
|
||||
}
|
||||
|
||||
if (propertiesLoaded && keystoreProperties.containsKey("releaseKeyStore")) {
|
||||
storeFile = file(rootProject.projectDir.canonicalPath + "/" + keystoreProperties.getProperty("releaseKeyStore"))
|
||||
keyAlias = keystoreProperties.getProperty("releaseKeyAlias")
|
||||
keyPassword = keystoreProperties.getProperty("releaseKeyPassword")
|
||||
storePassword = keystoreProperties.getProperty("releaseStorePassword")
|
||||
} else {
|
||||
project.logger.warn("Release signing information not fully loaded from properties. Ensure it's set via environment variables or the properties file is correct.")
|
||||
}
|
||||
}
|
||||
|
||||
create("oss") {
|
||||
val keystoreOSSPropertiesFile = rootProject.file("../../openScale_oss.keystore")
|
||||
val keystoreOSSProperties = Properties()
|
||||
var propertiesLoaded : Boolean
|
||||
|
||||
try {
|
||||
FileInputStream(keystoreOSSPropertiesFile).use { fis ->
|
||||
keystoreOSSProperties.load(fis)
|
||||
}
|
||||
propertiesLoaded = true
|
||||
} catch (e: FileNotFoundException) {
|
||||
project.logger.warn("OSS Keystore properties file not found: ${keystoreOSSPropertiesFile.absolutePath}. OSS signing might fail if not configured via environment variables.")
|
||||
propertiesLoaded = false
|
||||
}
|
||||
|
||||
if (propertiesLoaded && keystoreOSSProperties.containsKey("releaseKeyStore")) {
|
||||
storeFile = file(rootProject.projectDir.canonicalPath + "/" + keystoreOSSProperties.getProperty("releaseKeyStore"))
|
||||
keyAlias = keystoreOSSProperties.getProperty("releaseKeyAlias")
|
||||
keyPassword = keystoreOSSProperties.getProperty("releaseKeyPassword")
|
||||
storePassword = keystoreOSSProperties.getProperty("releaseStorePassword")
|
||||
} else {
|
||||
project.logger.warn("OSS signing information not fully loaded from properties. Ensure it's set via environment variables or the properties file is correct.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
|
||||
create("beta") {
|
||||
initWith(getByName("debug"))
|
||||
initWith(getByName("release"))
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
applicationIdSuffix = ".beta"
|
||||
versionNameSuffix = "-beta"
|
||||
manifestPlaceholders["appName"] = "openScale beta"
|
||||
manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher_beta"
|
||||
manifestPlaceholders["appRoundIcon"] = "@mipmap/ic_launcher_beta_round"
|
||||
}
|
||||
|
||||
create("oss") {
|
||||
initWith(getByName("release"))
|
||||
signingConfig = signingConfigs.getByName("oss")
|
||||
applicationIdSuffix = ".oss"
|
||||
versionNameSuffix = "-oss"
|
||||
manifestPlaceholders["appName"] = "openScale"
|
||||
manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher_beta"
|
||||
manifestPlaceholders["appRoundIcon"] = "@mipmap/ic_launcher_beta_round"
|
||||
}
|
||||
}
|
||||
|
||||
applicationVariants.all {
|
||||
|
Reference in New Issue
Block a user