Skip to content

Commit

Permalink
reproducible builds
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorch committed Oct 14, 2024
1 parent 7b77eb1 commit 411426e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 17 deletions.
42 changes: 26 additions & 16 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,19 @@ android {
compileSdk = 34
minSdk = 26
targetSdk = 34
versionCode = 92
versionName = "15.3.0"
versionCode = 93
versionName = "16.0.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled = true
}

dependenciesInfo {
// Disables dependency metadata when building APKs.
includeInApk = false
// Disables dependency metadata when building Android App Bundles.
includeInBundle = false
}

signingConfigs {
register("nightly") {
if (System.getProperty("nightly_store_file") != null) {
Expand All @@ -55,11 +63,20 @@ android {
keyPassword = System.getProperty("nightly_key_password")
}
}
register("release") {
if (System.getProperty("release_store_file") != null) {
storeFile = file(System.getProperty("release_store_file"))
storePassword = System.getProperty("release_store_password")
keyAlias = System.getProperty("release_key_alias")
keyPassword = System.getProperty("release_key_password")
}
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
signingConfig = signingConfigs.getByName("release")
}
getByName("debug") {
applicationIdSuffix = ".debug"
Expand All @@ -78,12 +95,6 @@ android {
buildConfig = true
}

packaging {
resources {
excludes += listOf("META-INF/*")
}
}

lint {
abortOnError = false
}
Expand All @@ -92,20 +103,21 @@ android {
val gitVersion = gitVersionProvider.get()

applicationVariants.all {
if (name == "nightly") {
if (name == "nightly" || name == "debug") {
outputs.forEach { output ->
output as com.android.build.gradle.internal.api.ApkVariantOutputImpl
output.versionCodeOverride = gitVersion
output.versionNameOverride = "${applicationId}_${output.versionCode}"
output.outputFileName = "${applicationId}_${versionCode}.apk"
}
} else {
outputs.forEach { output ->
output as com.android.build.gradle.internal.api.ApkVariantOutputImpl
output.outputFileName = "${applicationId}_${versionName}.apk"
}
}
outputs.forEach { output ->
output as com.android.build.gradle.internal.api.ApkVariantOutputImpl
output.outputFileName = "${applicationId}_${output.versionCode}.apk"
}
}

}
}

// Allow references to generated code
Expand All @@ -114,8 +126,6 @@ kapt {
}

dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))

coreLibraryDesugaring(libs.desugar.jdk.libs)

implementation(libs.retrofit)
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
androidGradlePlugin = "8.6.0"
androidGradlePlugin = "8.6.1"
androidJunit5 = "1.11.2.0"
androidsvg = "1.4"
androidTestCore = "1.6.0"
Expand Down
6 changes: 6 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

export JAVA_HOME=/usr/lib/jvm/java-17-openjdk/
export PATH=$JAVA_HOME/bin:$PATH

./gradlew --no-configuration-cache clean assembleRelease -Drelease_store_file=/home/peter/bahnhofsfotos.jks -Drelease_store_password="$1" -Drelease_key_alias='bahnhofsfotos' -Drelease_key_password="$2"

0 comments on commit 411426e

Please sign in to comment.