diff --git a/Makefile b/Makefile index 2bc3f655500f6..1f01075a3e77e 100644 --- a/Makefile +++ b/Makefile @@ -367,8 +367,12 @@ lint-json-fix: node_modules ## lint and fix json files pnpm exec eslint -c eslint.json.config.ts --color --max-warnings=0 --concurrency $(ESLINT_CONCURRENCY) --fix .PHONY: watch -watch: ## watch everything and continuously rebuild - @bash tools/watch.sh +watch: ## watch everything (optional: WATCH_DB=sqlite|mysql|pgsql|mssql WATCH_ACT=true) + @WATCH_DB="$(WATCH_DB)" WATCH_ACT="$(WATCH_ACT)" bash tools/watch.sh + +.PHONY: watch-full +watch-full: ## watch with WATCH_DB=sqlite preset (pass WATCH_ACT=true when supported) + @$(MAKE) watch WATCH_DB=sqlite .PHONY: watch-frontend watch-frontend: node_modules ## start vite dev server for frontend diff --git a/tools/watch.sh b/tools/watch.sh index 5e8defa49c89e..979740a30db3b 100644 --- a/tools/watch.sh +++ b/tools/watch.sh @@ -1,6 +1,30 @@ #!/bin/bash set -euo pipefail +# WATCH_DB selects build tags for the backend (see Makefile TAGS). sqlite sets +# TAGS for CGO sqlite support. Other drivers use the default binary without +# sqlite tags; caller-supplied TAGS (pam, bindata, etc.) are preserved. When +# WATCH_DB is unset, TAGS is left unchanged. +# WATCH_ACT=true is reserved for starting act_runner alongside watch (not yet implemented). +if [[ -n "${WATCH_DB:-}" ]]; then + case "${WATCH_DB}" in + sqlite) + export TAGS="sqlite sqlite_unlock_notify" + ;; + mysql | pgsql | postgres | mssql) + # Do not touch TAGS so pam/bindata/other local tags from the caller are kept. + ;; + *) + echo "watch.sh: unknown WATCH_DB=${WATCH_DB} (use sqlite, mysql, pgsql, postgres, or mssql)" >&2 + exit 1 + ;; + esac +fi + +if [[ "${WATCH_ACT:-}" == "true" ]]; then + echo "watch.sh: WATCH_ACT=true is not implemented yet (act_runner integration pending); ignoring." >&2 +fi + make --no-print-directory watch-frontend & make --no-print-directory watch-backend &