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 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
1c3a5386f4
commit
1be5ab2f6d
1 file changed
+11
@@ -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)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user