mirror of
https://github.com/penpot/penpot.git
synced 2026-09-29 01:52:58 +08:00
Protect shared setup, compilation, artifact copy, and target cleanup with one flock lock per checkout. Route watch builds and frontend cleanup through the protected scripts. Document the lock contract and normalize the frontend and exporter build:wasm commands. Closes #11901 AI-assisted-by: Space Bunny Free
32 lines
601 B
Bash
Executable File
32 lines
601 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Usage: ./clean [frontend|export]
|
|
|
|
set -e
|
|
|
|
_SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
|
|
_RENDER_TARGET=${1:-frontend}
|
|
|
|
case "$_RENDER_TARGET" in
|
|
frontend|export) ;;
|
|
*)
|
|
echo "ERROR: unknown render target '$_RENDER_TARGET' (expected 'frontend' or 'export')" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
pushd "$_SCRIPT_DIR" > /dev/null
|
|
|
|
export RENDER_TARGET="$_RENDER_TARGET"
|
|
unset CARGO_TARGET_DIR
|
|
. ./_build_env "$_RENDER_TARGET"
|
|
. ./_build_lock
|
|
|
|
acquire_build_lock
|
|
cargo clean --target-dir "$CARGO_TARGET_DIR"
|
|
|
|
RESULT=$?
|
|
popd > /dev/null
|
|
|
|
exit $RESULT
|