mirror of
https://github.com/penpot/penpot.git
synced 2026-10-29 14:00:37 +00:00
Forward Cargo arguments as an array and honor explicit profiles. Build and copy each renderer target once under the repository lock, with watch rebuilds using the same wrapper. Select this checkout's compiler artifact and matching generated enum table from Cargo JSON. Record actual features, profile and output paths, and allow callers to override publication destinations. Run the existing Cargo parser tests before the renderer's native tests and stop on parser failures. AI-assisted-by: gpt-6.1-sol
35 lines
866 B
Bash
Executable File
35 lines
866 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Usage: ./watch [frontend|export] [extra cargo params...]
|
|
|
|
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_COMMAND=("$_SCRIPT_DIR/build" "$RENDER_TARGET" "${@:2}")
|
|
|
|
# The initial build uses the protected build entry point. Its lock is released
|
|
# before cargo watch starts waiting for source changes.
|
|
"${_BUILD_COMMAND[@]}"
|
|
|
|
# cargo watch runs shell commands; single-quote each original argument for sh.
|
|
_WATCH_BUILD_COMMAND=""
|
|
for _arg in "${_BUILD_COMMAND[@]}"; do
|
|
_arg=${_arg//\'/\'\\\'\'}
|
|
_WATCH_BUILD_COMMAND+=" '$_arg'"
|
|
done
|
|
|
|
set -x
|
|
|
|
cargo watch \
|
|
--why \
|
|
--postpone \
|
|
-i "_tmp*" \
|
|
-s "$_WATCH_BUILD_COMMAND" \
|
|
-s "echo 'DONE\n'";
|
|
|
|
popd > /dev/null
|