1+ import com.android.build.gradle.LibraryExtension
2+
13allprojects {
24 repositories {
35 google()
@@ -17,6 +19,39 @@ subprojects {
1719}
1820subprojects {
1921 project.evaluationDependsOn(" :app" )
22+
23+ // `package:jni` compiles libdartjni.so through CMake, and the linker stamps a
24+ // GNU build ID into it by default -- a hash that comes out different on every
25+ // machine even when the library itself does not. Measured on this project: the
26+ // APK published from CI and one built locally from the same tag differ in
27+ // exactly 20 bytes, and those 20 bytes are the build ID. Nothing reads it here,
28+ // and it is the one thing standing between two builds of the same source being
29+ // byte for byte the same.
30+ //
31+ // That matters because of what F-Droid can then do: with `binary:` in the build
32+ // recipe it rebuilds a release from source, compares it against the APK
33+ // published here, and on a match ships *this project's* signed APK rather than
34+ // one of its own -- so somebody moving from a GitHub download to F-Droid keeps
35+ // their install and their database. The comparison is a signature copy, which
36+ // v2 signatures make equivalent to byte equality, so 20 bytes is as fatal as a
37+ // megabyte.
38+ //
39+ // Scoped to `jni` rather than applied to every subproject: it is the only module
40+ // here that builds native code of its own, and a flag that reaches libraries
41+ // nobody has looked at is a change whose effects nobody has looked at either.
42+ plugins.withId(" com.android.library" ) {
43+ if (name == " jni" ) {
44+ extensions.configure<LibraryExtension >(" android" ) {
45+ defaultConfig {
46+ externalNativeBuild {
47+ cmake {
48+ arguments + = " -DCMAKE_SHARED_LINKER_FLAGS=-Wl,--build-id=none"
49+ }
50+ }
51+ }
52+ }
53+ }
54+ }
2055}
2156
2257tasks.register<Delete >(" clean" ) {
0 commit comments