Skip to content

Commit

Permalink
Add script for reproducible builds
Browse files Browse the repository at this point in the history
  • Loading branch information
HalidOdat committed Sep 19, 2024
1 parent 5663ac3 commit 8bbbb1c
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions app/scripts/reproducible
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh

set -x

SCRIPTS_DIR="$( cd "$( dirname "$0" )" && pwd )"
FLUTTER_DIR="$SCRIPTS_DIR/.."
PROJECT_DIR="$FLUTTER_DIR/.."

APPLICATION_ID="org.stridetasks.stride"
BUILD_DIR="/tmp/$APPLICATION_ID"

cd "$PROJECT_DIR"

# Remove non-reproducable part of path strings.
SEP=$(echo -e "\x1f")
export CARGO_ENCODED_RUSTFLAGS="--remap-path-prefix=${HOME}/.cargo=/cargo/"
if [ ! -z "$CARGO_HOME" ]; then
export CARGO_ENCODED_RUSTFLAGS="$CARGO_ENCODED_RUSTFLAGS${SEP}--remap-path-prefix=${CARGO_HOME}=/cargo/"
fi

export SOURCE_DATE_EPOCH=1
export ZERO_AR_DATE=1

rm -rf "$BUILD_DIR"

COMMIT="$(git rev-parse HEAD)"
ORIGIN="$(git remote get-url origin)"
git clone --branch "$COMMIT" --reference "$PROJECT_DIR" "$ORIGIN" "$BUILD_DIR"

cd "$BUILD_DIR"

./scripts/rustup-setup

cd app

./flutter build $@

cd "app/build/app/outputs/flutter-apk" "$PROJECT_DIR"/app/build/apks

0 comments on commit 8bbbb1c

Please sign in to comment.