Add Gradle release signing config for reproducible F-Droid builds
This commit is contained in:
parent
881f0c1f48
commit
1eff4656bd
2 changed files with 27 additions and 0 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -9,3 +9,8 @@
|
||||||
.externalNativeBuild
|
.externalNativeBuild
|
||||||
.cxx
|
.cxx
|
||||||
/receiver/receiver
|
/receiver/receiver
|
||||||
|
|
||||||
|
# Never commit signing secrets
|
||||||
|
/keystore.properties
|
||||||
|
*.jks
|
||||||
|
*.keystore
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import java.util.Properties
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application)
|
alias(libs.plugins.android.application)
|
||||||
alias(libs.plugins.kotlin.android)
|
alias(libs.plugins.kotlin.android)
|
||||||
|
|
@ -16,6 +18,25 @@ android {
|
||||||
versionName = "1.0"
|
versionName = "1.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Release signing is enabled only when keystore.properties is present (local
|
||||||
|
// release builds). F-Droid's build server has no such file, so it builds
|
||||||
|
// unsigned; F-Droid then verifies the developer-published APK reproduces.
|
||||||
|
// Signing via the Gradle build (not external apksigner) keeps the APK's zip
|
||||||
|
// layout identical to the unsigned build, which is required for apksigcopier.
|
||||||
|
val keystorePropsFile = rootProject.file("keystore.properties")
|
||||||
|
val releaseSigning = if (keystorePropsFile.exists()) {
|
||||||
|
val props = Properties()
|
||||||
|
keystorePropsFile.inputStream().use { props.load(it) }
|
||||||
|
signingConfigs.create("release") {
|
||||||
|
storeFile = rootProject.file(props.getProperty("storeFile"))
|
||||||
|
storePassword = props.getProperty("storePassword")
|
||||||
|
keyAlias = props.getProperty("keyAlias")
|
||||||
|
keyPassword = props.getProperty("keyPassword")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
isMinifyEnabled = false
|
isMinifyEnabled = false
|
||||||
|
|
@ -23,6 +44,7 @@ android {
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
"proguard-rules.pro",
|
"proguard-rules.pro",
|
||||||
)
|
)
|
||||||
|
signingConfig = releaseSigning
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue