Reproducible build: F-Droid needs build flavors (not build types).

Part of #418.
This commit is contained in:
Dennis Guse
2024-12-25 17:43:41 +01:00
parent a03825e10e
commit c011fd4e60
2 changed files with 36 additions and 31 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ jobs:
shell: bash shell: bash
run: | run: |
echo ${NIGHTLY_STORE_FILE} | base64 -d > KEY_NIGHTLY.jks echo ${NIGHTLY_STORE_FILE} | base64 -d > KEY_NIGHTLY.jks
./gradlew assembleNightly -Dnightly_store_file=KEY_NIGHTLY.jks -Dnightly_store_password="${NIGHTLY_STORE_PASSWORD}" -Dnightly_key_alias="${NIGHTLY_KEY_ALIAS}" -Dnightly_key_password="${NIGHTLY_STORE_PASSWORD}" ./gradlew assembleNightlyRelease -Dnightly_store_file=KEY_NIGHTLY.jks -Dnightly_store_password="${NIGHTLY_STORE_PASSWORD}" -Dnightly_key_alias="${NIGHTLY_KEY_ALIAS}" -Dnightly_key_password="${NIGHTLY_STORE_PASSWORD}"
env: env:
NIGHTLY_STORE_FILE: ${{ secrets.NIGHTLY_STORE_FILE }} NIGHTLY_STORE_FILE: ${{ secrets.NIGHTLY_STORE_FILE }}
NIGHTLY_STORE_PASSWORD: ${{ secrets.NIGHTLY_STORE_PASSWORD }} NIGHTLY_STORE_PASSWORD: ${{ secrets.NIGHTLY_STORE_PASSWORD }}
+35 -30
View File
@@ -63,7 +63,7 @@ android {
} }
defaultConfig { defaultConfig {
applicationId "de.dennisguse.opentracks" applicationId 'de.dennisguse.opentracks'
versionCode 5978 versionCode 5978
versionName "v4.17.1" versionName "v4.17.1"
@@ -72,16 +72,16 @@ android {
minSdk 26 minSdk 26
targetSdk 35 targetSdk 35
testInstrumentationRunner "de.dennisguse.opentracks.TestRunner" testInstrumentationRunner 'de.dennisguse.opentracks.TestRunner'
testInstrumentationRunnerArguments clearPackageData: 'true' testInstrumentationRunnerArguments clearPackageData: 'true'
} }
signingConfigs { signingConfigs {
nightly { nightly {
if (System.getProperty("nightly_store_file") != null) { if (System.getProperty('nightly_store_file') != null) {
storeFile file(System.getProperty("nightly_store_file")) storeFile file(System.getProperty('nightly_store_file'))
storePassword System.getProperty("nightly_store_password") storePassword System.getProperty('nightly_store_password')
keyAlias System.getProperty("nightly_key_alias") keyAlias System.getProperty('nightly_key_alias')
keyPassword System.getProperty("nightly_key_password") keyPassword System.getProperty('nightly_key_password')
} }
} }
} }
@@ -90,41 +90,46 @@ android {
buildTypes { buildTypes {
debug { debug {
applicationIdSuffix ".debug" applicationIdSuffix '.debug'
versionNameSuffix "-debug" versionNameSuffix '-debug'
} }
nightly {
applicationIdSuffix ".nightly"
signingConfig signingConfigs.nightly
}
release { release {
// Non-reproducible: https://f-droid.org/de/packages/de.dennisguse.opentracks/
crunchPngs false
minifyEnabled false
versionNameSuffix "irreproducible"
}
reproducible {
// Developer Binaries: https://github.com/OpenTracksApp/OSMDashboard/releases/download/v%v/de.dennisguse.opentracks.playstore_%v.apk
// FDroid: https://f-droid.org/de/packages/de.dennisguse.opentracks.playstore
// PlayStore: https://play.google.com/store/apps/details?id=de.dennisguse.opentracks.playstore
applicationIdSuffix ".playstore"
crunchPngs false crunchPngs false
minifyEnabled false minifyEnabled false
} }
} }
flavorDimensions 'version'
productFlavors {
nightly {
dimension 'version'
applicationIdSuffix '.nightly'
signingConfig signingConfigs.nightly
}
irreproducible {
// Non-reproducible: https://f-droid.org/de/packages/de.dennisguse.opentracks/
dimension 'version'
applicationId 'de.dennisguse.opentracks'
versionNameSuffix 'irreproducible'
}
reproducible {
// Developer Binaries: https://github.com/OpenTracksApp/OSMDashboard/releases/download/v%v/de.dennisguse.opentracks.playstore_%v.apk
// FDroid: https://f-droid.org/de/packages/de.dennisguse.opentracks.playstore
// PlayStore: https://play.google.com/store/apps/details?id=de.dennisguse.opentracks.playstore
dimension 'version'
applicationId 'de.dennisguse.opentracks.playstore'
}
}
applicationVariants.configureEach { variant -> applicationVariants.configureEach { variant ->
variant.resValue "string", "applicationId", variant.applicationId variant.resValue 'string', 'applicationId', variant.applicationId
variant.outputs.configureEach { variant.outputs.configureEach {
if (variant.buildType.name == 'reproducible') { if (variant.buildType.name == 'reproducible') {
outputFileName = "${applicationId}_${variant.buildType.name}_${variant.versionName}.apk" outputFileName = '${applicationId}_${variant.buildType.name}_${variant.versionName}.apk'
} else { } else {
outputFileName = "${applicationId}_${variant.buildType.name}_${variant.versionCode}.apk" outputFileName = '${applicationId}_${variant.buildType.name}_${variant.versionCode}.apk'
} }
if (variant.buildType.name == 'nightly') { if (variant.buildType.name == 'nightly') {