From 1375a77fd74a4c3cbc697ee3073d961af8f732d5 Mon Sep 17 00:00:00 2001 From: Daniel Harvey Date: Tue, 19 Jul 2022 13:19:12 +0100 Subject: [PATCH] tooling: add make ghcid commands PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5097 GitOrigin-RevId: 2463c61afbffedaaf21bdd3a014f79f1cc4b930e --- Makefile | 1 + scripts/make/ghcid.mk | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 scripts/make/ghcid.mk 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) +