#!/usr/bin/env bash
# Run from an isolated checkout of either comparison commit on native Linux x64.
set -u
: "${PROOF_OUTPUT:?Choose an empty output directory outside the checkout}"
mkdir -p "$PROOF_OUTPUT"
vp i
vp run build:desktop || exit $?
printf '\nimport "t3-release-proof-missing-package";\n' >> apps/server/dist/bin.mjs
TMPDIR="$PROOF_OUTPUT" vp run dist:desktop:linux --skip-build --keep-stage --output-dir "$PROOF_OUTPUT/artifacts" > "$PROOF_OUTPUT/package.log" 2>&1
status=$?
printf 'Packaging exit status: %s\n' "$status"
cat "$PROOF_OUTPUT/package.log"
find "$PROOF_OUTPUT/artifacts" -maxdepth 1 -type f -printf '%f\n' 2>/dev/null
exit "$status"
