Skip to content
Snippets Groups Projects
Verified Commit 3d3d4e3a authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Properly handle situations where no valid signing config is available

parent 0ae64f88
Branches
Tags v1.0.3
No related merge requests found
Pipeline #303 passed
...@@ -37,13 +37,12 @@ android { ...@@ -37,13 +37,12 @@ android {
compileSdkVersion(28) compileSdkVersion(28)
signingConfigs { signingConfigs {
val signing = project.rootProject.properties("signing.properties") SigningData.of(project.rootProject.properties("signing.properties"))?.let {
if (signing != null) {
create("default") { create("default") {
storeFile = file(signing.getProperty("storeFile")) storeFile = file(it.storeFile)
storePassword = signing.getProperty("storePassword") storePassword = it.storePassword
keyAlias = signing.getProperty("keyAlias") keyAlias = it.keyAlias
keyPassword = signing.getProperty("keyPassword") keyPassword = it.keyPassword
} }
} }
} }
......
...@@ -41,3 +41,23 @@ fun Project.properties(fileName: String): Properties? { ...@@ -41,3 +41,23 @@ fun Project.properties(fileName: String): Properties? {
props.load(file.inputStream()) props.load(file.inputStream())
return props return props
} }
data class SigningData(
val storeFile: String,
val storePassword: String,
val keyAlias: String,
val keyPassword: String
) {
companion object {
fun of(properties: Properties?): SigningData? {
if (properties == null) return null
val storeFile = properties.getProperty("storeFile") ?: return null
val storePassword = properties.getProperty("storePassword") ?: return null
val keyAlias = properties.getProperty("keyAlias") ?: return null
val keyPassword = properties.getProperty("keyPassword") ?: return null
return SigningData(storeFile, storePassword, keyAlias, keyPassword)
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment