From 1be5ab2f6d01bf2c54fcf5661ef3b4b478b662e9 Mon Sep 17 00:00:00 2001 From: M57 <41645758+Hy4ri@users.noreply.github.com> Date: Sun, 5 Jul 2026 20:04:52 +0300 Subject: [PATCH] fix: make version control info empty for reproducible F-Droid builds * fix: disable versionControlInfo for reproducible F-Droid builds Add versionControlInfoEnabled = false to strip the embedded git revision metadata from the APK. This prevents byte-level differences between GitHub-released and F-Droid-built APKs (AGP embeds branch name, which differs between detached-HEAD CI and main-branch builds). * fix: make version control info empty for reproducible F-Droid builds The extractReleaseVersionControlInfo task generates META-INF/version-control-info.textproto, which differs between GitHub CI (builds on main branch) and F-Droid CI (detached HEAD). This caused a 'dex/prof differs from embedded git revision' failure. Fix: empty the file via doLast hook + exclude it from packaging. * fix: use robust task hook for reproducible version-control-info Replace brittle buildFeatures flag (not available in AGP 9.0.1) with a lazy tasks.matching hook that empties the generated version-control-info.textproto after extraction. Both CI environments produce identical content (empty file), ensuring byte-for-byte reproducible APKs. --------- Co-authored-by: M57 --- app/build.gradle.kts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8a41b645..3cb665b4 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -102,6 +102,17 @@ android { } } +// Overwrite version-control-info with empty content for reproducible builds +// F-Droid CI uses detached HEAD (branches: []) while GitHub CI uses main +// (branches: ["main"]) — this field in the generated textproto causes a +// byte-level APK difference. Emptying the file makes both CI environments +// produce identical artifacts. +tasks.matching { it.name.endsWith("VersionControlInfo") }.configureEach { + doLast { + outputs.files.filter { it.exists() }.forEach { it.writeText("") } + } +} + kotlin { jvmToolchain(21) }