From 411426ebe54e32538aa0f0ac8285ef38a2a30dfb Mon Sep 17 00:00:00 2001 From: Peter Storch Date: Mon, 14 Oct 2024 15:49:49 +0200 Subject: [PATCH] reproducible builds --- app/build.gradle.kts | 42 ++++++++++++++++++++++++--------------- gradle/libs.versions.toml | 2 +- release.sh | 6 ++++++ 3 files changed, 33 insertions(+), 17 deletions(-) create mode 100755 release.sh diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 78257e9e..ad9a3964 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -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) { @@ -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" @@ -78,12 +95,6 @@ android { buildConfig = true } - packaging { - resources { - excludes += listOf("META-INF/*") - } - } - lint { abortOnError = false } @@ -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 @@ -114,8 +126,6 @@ kapt { } dependencies { - implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - coreLibraryDesugaring(libs.desugar.jdk.libs) implementation(libs.retrofit) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4a6bb86d..d6e96bc0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -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" diff --git a/release.sh b/release.sh new file mode 100755 index 00000000..b323a61e --- /dev/null +++ b/release.sh @@ -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"