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
45 lines
1008 B
Bash
Executable File
45 lines
1008 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Usage: ./build [frontend|export] [extra cargo params...]
|
|
#
|
|
# With no target, builds both. Set BUILD_MODE=release (or NODE_ENV=production)
|
|
# for an optimized build. See `_build_env` for what each target changes.
|
|
|
|
_SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
|
|
_RENDER_TARGET=${1:-}
|
|
|
|
case "$_RENDER_TARGET" in
|
|
frontend|export) ;;
|
|
"")
|
|
# Each target needs its own `_build_env`, so re-enter per target.
|
|
for _target in frontend export; do
|
|
"$_SCRIPT_DIR/build" "$_target" "$@" || exit $?
|
|
done
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "ERROR: unknown render target '$_RENDER_TARGET' (expected 'frontend' or 'export')" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
set -e -o pipefail
|
|
|
|
EMSDK_QUIET=1 . /opt/emsdk/emsdk_env.sh
|
|
|
|
pushd "$_SCRIPT_DIR" > /dev/null
|
|
|
|
export RENDER_TARGET="$_RENDER_TARGET"
|
|
. ./_build_env "$_RENDER_TARGET" "${@:2}"
|
|
. ./_build_lock
|
|
|
|
acquire_build_lock
|
|
|
|
set -x
|
|
|
|
setup
|
|
build
|
|
copy_target_artifacts
|
|
|
|
popd > /dev/null
|