diff --git a/Makefile b/Makefile index b149d460ad2..37c3419a4d8 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/scripts/make/ghcid.mk b/scripts/make/ghcid.mk new file mode 100644 index 00000000000..3e1fbd4ed7b --- /dev/null +++ b/scripts/make/ghcid.mk @@ -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) +