build(Makefile): add/reimplement shell-% and ghci targets

This commit is contained in:
Sarah Vaupel 2024-11-13 03:37:46 +01:00
parent 4d19773223
commit cbf167d197
2 changed files with 26 additions and 8 deletions

1
.gitignore vendored
View File

@ -65,3 +65,4 @@ tunnel.log
**/result-*
.develop.cmd
/.vscode
.ghc/ghci_history

View File

@ -113,6 +113,11 @@ start:
%-uniworxdb: SERVICE_VARIANT=uniworxdb
%-uniworxdb: CONTAINER_CMD=localhost/fradrive/backend
.PHONY: %-ghci
%-ghci: SERVICE=backend
%-ghci: SERVICE_VARIANT=ghci
%-ghci: CONTAINER_CMD=localhost/fradrive/backend
.PHONY: %-hoogle
%-hoogle: SERVICE=backend
%-hoogle: SERVICE_VARIANT=hoogle
@ -175,6 +180,16 @@ lint-%: CF_PREFIX = lint-
lint-%: CONTAINER_ATTACHED = true
lint-%: --act ;
.PHONY: shell-%
# HELP(shell-$SERVICE): launch (bash) shell inside a new $SERVICE container
shell-%: JOB=shell
shell-%: CF_PREFIX=shell-
shell-%: CONTAINER_ATTACHED=true
shell-%: --act ;
.PHONY: ghci
# HELP: launch new backend instance and enter interactive ghci shell (WIP)
ghci: shell-ghci;
--act: --develop_containerized;
--develop_%: PORTS = $(foreach PORT,$(BASE_PORTS),$(shell utils/next_free_port.pl $(PORT)))
@ -299,6 +314,13 @@ well-known: static;
AVSPASS=${AVSPASS:-nopasswordset} ; \
stack exec uniworxdb -- $(UNIWORXDB_OPTS)
--shell-ghci:
stack exec -- ghci
# --main-is uniworx:exe:uniworx
--shell-%:
/bin/bash
# HELP(start-minio): start minio service
.PHONY: status
@ -324,21 +346,16 @@ log-%:
.PHONY: enter
# HELP: launch (bash) shell inside a currently running container. Use ./enter shell wrapper for more convenient usage, possibly with tab-completion in the future
enter: --ensure-develop
$(MAKE) -- --shell
$(MAKE) -- --enter
.PHONY: psql
# HELP: enter psql (postgresql) cli inside a currently running database container
psql: ENTRYPOINT=/usr/bin/psql -d uniworx
psql: EXEC_OPTS=--user postgres
psql: --ensure-develop
$(MAKE) -- --shell CONTAINER_FILE=develop/`cat develop/.current`/start-postgres
$(MAKE) -- --enter CONTAINER_FILE=develop/`cat develop/.current`/start-postgres
.PHONY: ghci
# HELP: launch new backend instance and enter interactive ghci shell (WIP)
ghci: ENTRYPOINT=stack ghci
ghci: --shell;
--shell:
--enter:
CONTAINER_ID=`cat $(CONTAINER_FILE) | grep 'CONTAINER_ID=' | sed 's/CONTAINER_ID=//'` ; \
$(CONTAINER_COMMAND) exec -it $(EXEC_OPTS) $${CONTAINER_ID} $(if $(ENTRYPOINT),$(ENTRYPOINT),/bin/bash)