diff --git a/scripts/build-android.sh b/scripts/build-android.sh index 8cf1345..297bb1d 100755 --- a/scripts/build-android.sh +++ b/scripts/build-android.sh @@ -49,6 +49,9 @@ ABIS="${ABIS:-arm64-v8a}" # Expo both do that, and so does the gomobile binding layer. The build still succeeds; the app crashes # on the device. This cannot be verified by looking at a file size, and it must not become the default # until a build with it has been opened on a real phone, connected to a tailnet, and used. +# Expanded below as ${MINIFY_ARGS[@]+...} rather than bare: macOS ships bash 3.2, where expanding an +# EMPTY array under `set -u` is itself an unbound-variable error. The monorepo's copy of this script +# survives the bare form only because it does not set -u — the bug was latent there and real here. MINIFY_ARGS=() if [[ "${MINIFY:-0}" == "1" ]]; then MINIFY_ARGS=(-Pandroid.enableMinifyInReleaseBuilds=true) @@ -57,7 +60,7 @@ fi # assembleRelease, always. A debug build needs Metro attached and behaves differently from what ships, # so testing it answers the wrong question. if ! (cd android && ./gradlew :app:assembleRelease -PreactNativeArchitectures="$ABIS" \ - "${MINIFY_ARGS[@]}" --console=plain) >>"$log" 2>&1; then + ${MINIFY_ARGS[@]+"${MINIFY_ARGS[@]}"} --console=plain) >>"$log" 2>&1; then echo "GRADLE FAILED — $log"; exit 1 fi