Files
Andrey Antukh 5ef70c7284 ✨ Serialize render-wasm builds per checkout (#11903)
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
2026-09-25 09:42:27 +02:00

28 lines
682 B
Bash
Executable File

#!/usr/bin/env bash
# Usage: ./watch [frontend|export]
set -e
_SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
pushd "$_SCRIPT_DIR" > /dev/null
_RENDER_TARGET=${1:-${RENDER_TARGET:-frontend}}
export RENDER_TARGET="$_RENDER_TARGET"
. ./_build_env "$_RENDER_TARGET" "${@:2}"
# The initial build uses the protected build entry point. Its lock is released
# before cargo watch starts waiting for source changes.
"$_SCRIPT_DIR/build" "$RENDER_TARGET" $CARGO_PARAMS
set -x
cargo watch \
--why \
-i "_tmp*" \
-x "build $CARGO_PARAMS" \
-s "\"$_SCRIPT_DIR/build\" \"$RENDER_TARGET\" $CARGO_PARAMS" \
-s "echo 'DONE\n'";
popd > /dev/null