From c5a69a49500d60bc66a0de30dad65c36857418fa Mon Sep 17 00:00:00 2001 From: sh <37271604+shumvgolove@users.noreply.github.com> Date: Wed, 10 Dec 2025 09:30:53 +0000 Subject: [PATCH] scripts/build-android: make build reproducible (#6493) * scripts/build-android: attempt to make it reproducible * scripts/build-android: set epoch to 1764547200 --- scripts/android/build-android.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/android/build-android.sh b/scripts/android/build-android.sh index 97190ec103..90d6092385 100755 --- a/scripts/android/build-android.sh +++ b/scripts/android/build-android.sh @@ -138,10 +138,15 @@ build() { mkdir -p "$android_tmp_folder" unzip -oqd "$android_tmp_folder" "$android_apk_output" + # Determenistic build + find "$android_tmp_folder" -type f -exec chmod 644 {} + + find "$android_tmp_folder" -type d -exec chmod 755 {} + + find "$android_tmp_folder" -exec touch -h -d '@1764547200' {} + + ( cd "$android_tmp_folder" && \ - zip -rq5 "$tmp/$android_apk_output_final" . && \ - zip -rq0 "$tmp/$android_apk_output_final" resources.arsc res + find . -type f -print0 | sort -z | xargs -0 zip -X -rq5 "$tmp/$android_apk_output_final" && \ + find res resources.arsc -type f -print0 | sort -z | xargs -0 zip -X -rq0 "$tmp/$android_apk_output_final" ) zipalign -p -f 4 "$tmp/$android_apk_output_final" "$PWD/$android_apk_output_final"