tooling: add make ghcid commands

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5097
GitOrigin-RevId: 2463c61afbffedaaf21bdd3a014f79f1cc4b930e
This commit is contained in:
Daniel Harvey 2022-07-19 13:19:12 +01:00 committed by hasura-bot
parent 38a10bebb7
commit 1375a77fd7
2 changed files with 24 additions and 0 deletions

View File

@ -8,3 +8,4 @@ help:
include ./scripts/make/tests.mk
include ./scripts/make/lint.mk
include ./scripts/make/build.mk
include ./scripts/make/ghcid.mk

23
scripts/make/ghcid.mk Normal file
View File

@ -0,0 +1,23 @@
GHCID_FLAGS = --builddir ./dist-newstyle/repl --repl-option -O0 --repl-option -fobject-code
PANE_WIDTH = $(shell tmux display -p "\#{pane_width}" || echo 80)
PANE_HEIGHT = $(shell tmux display -p "\#{pane_height}" || echo 30 )
define run_ghcid
@if [[ $$(uname -p) == 'arm' ]]; then \
ghcid -c "cabal repl $(1) $(GHCID_FLAGS)" --width=$(PANE_WIDTH) --height=$(PANE_HEIGHT); \
else \
ghcid -c "cabal repl $(1) $(GHCID_FLAGS)"; \
fi
endef
.PHONY: ghcid-library
## ghcid-library: build and watch library in ghcid
ghcid-library:
$(call run_ghcid,graphql-engine:lib:graphql-engine)
.PHONY: ghcid-hspec
## ghcid-hspec: build and watch tests-hspec in ghcid
ghcid-hspec:
$(call run_ghcid,graphql-engine:tests-hspec)