summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2025-10-15 15:18:28 +0200
committerLinus Färnstrand <linus@mullvad.net>2025-10-22 13:16:05 +0200
commitca148b0b384168cad76e7bbdeed1afed287654b8 (patch)
treede1c99af6f09305958f5af9ffef67f1149571188 /android
parent5b3dadce554013f084890aff3dc88ccb182a153e (diff)
downloadmullvadvpn-ca148b0b384168cad76e7bbdeed1afed287654b8.tar.xz
mullvadvpn-ca148b0b384168cad76e7bbdeed1afed287654b8.zip
Verify that release builds did not pollute the working directory
Refuse to sign binaries or produce final bundles if building the app made the git working directory dirty. A dirty working directory is an indication that the build process changed something that it should not touch
Diffstat (limited to 'android')
-rwxr-xr-xandroid/build.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/android/build.sh b/android/build.sh
index e8392f345d..e37fd3bf2f 100755
--- a/android/build.sh
+++ b/android/build.sh
@@ -30,11 +30,15 @@ while [ -n "${1:-""}" ]; do
shift 1
done
-if [[ "$GRADLE_BUILD_TYPE" == "release" ]]; then
+function assert_clean_working_directory {
if [[ -n "$(git status --porcelain)" ]]; then
- echo "Dirty working directory! Will not accept that for an official release."
- exit 1
+ echo "Dirty working directory! Will not accept that for an official release."
+ exit 1
fi
+}
+
+if [[ "$GRADLE_BUILD_TYPE" == "release" ]]; then
+ assert_clean_working_directory
if [ ! -f "$SCRIPT_DIR/credentials/keystore.properties" ]; then
echo "ERROR: No keystore.properties file found" >&2
@@ -80,6 +84,14 @@ if [[ "$BUILD_BUNDLE" == "yes" ]]; then
$GRADLE_CMD --console plain "${BUNDLE_TASKS[@]}"
fi
+# When building releases, we check that the working directory is clean before building,
+# further up. Now verify that this is still true. The build process should never make the
+# working directory dirty.
+# This could for example happen if lockfiles are outdated, and the build process updates them.
+if [[ "$GRADLE_BUILD_TYPE" == "release" ]]; then
+ assert_clean_working_directory
+fi
+
if [[ "$RUN_PLAY_PUBLISH_TASKS" == "yes" && "${#PLAY_PUBLISH_TASKS[@]}" -ne 0 ]]; then
$GRADLE_CMD --console plain "${PLAY_PUBLISH_TASKS[@]}"
fi