tools: make stack command configurable, for ghc 8 testing

This commit is contained in:
Simon Michael 2016-05-27 08:12:48 -07:00
parent ad3c5dfb4d
commit 25a2fe100c

View File

@ -49,7 +49,7 @@ help2: \
export LANG?=en_US.UTF-8 export LANG?=en_US.UTF-8
# command to run during profiling (time and heap) # command to run during profiling (time and heap)
#PROFCMD=stack exec -- hledgerprof balance -f data/1000x1000x10.journal >/dev/null PROFCMD=stack exec -- hledgerprof balance -f data/10000x1000x10.journal >/dev/null
#PROFRTSFLAGS=-p #PROFRTSFLAGS=-p
PROFRTSFLAGS=-P PROFRTSFLAGS=-P
@ -74,14 +74,16 @@ GHCI=ghci #-package ghc-datasize #-package ghc-heap-view
# HADDOCK=haddock # HADDOCK=haddock
# CABAL=cabal # CABAL=cabal
# CABALINSTALL=cabal install -w $(GHC) # CABALINSTALL=cabal install -w $(GHC)
STACK=stack
#STACK=stack --stack-yaml=stack-ghc8.yaml
# -j16 sometimes gives "commitAndReleaseBuffer: resource vanished (Broken pipe)" but seems harmless # -j16 sometimes gives "commitAndReleaseBuffer: resource vanished (Broken pipe)" but seems harmless
SHELLTESTOPTS=--execdir -- -j16 --hide-successes SHELLTESTOPTS=--execdir -- -j16 --hide-successes
# run shell tests using the executable specified in tests # run shell tests using the executable specified in tests
SHELLTEST=shelltest $(SHELLTESTOPTS) SHELLTEST=shelltest $(SHELLTESTOPTS)
# run shell tests using the stack build # run shell tests using the stack build
SHELLTESTSTK=stack exec -- shelltest $(SHELLTESTOPTS)
#SHELLTESTSTK=shelltest -w `stack exec which hledger` $(SHELLTESTOPTS) #SHELLTESTSTK=shelltest -w `stack exec which hledger` $(SHELLTESTOPTS)
SHELLTESTSTK=$(STACK) exec -- shelltest $(SHELLTESTOPTS)
# # used for make auto, http://joyful.com/repos/searchpath # # used for make auto, http://joyful.com/repos/searchpath
# SP=sp # SP=sp
@ -218,7 +220,7 @@ $(call def-help-subsection,INSTALLING:)
install: \ install: \
$(call def-help,install, download dependencies and install hledger executables to ~/.local/bin or equivalent (with stack)) $(call def-help,install, download dependencies and install hledger executables to ~/.local/bin or equivalent (with stack))
stack install $(STACK) install
# cabal-install: \ # cabal-install: \
# $(call def-help,cabal-install,\ # $(call def-help,cabal-install,\
@ -247,7 +249,7 @@ $(call def-help-subsection,BUILDING:)
build: \ build: \
$(call def-help,build, download dependencies and build hledger executables (with stack)) $(call def-help,build, download dependencies and build hledger executables (with stack))
stack build $(STACK) build
# check-setup: \ # check-setup: \
# $(call def-help,check-setup,\ # $(call def-help,check-setup,\
@ -335,9 +337,9 @@ bin/hledgerdev hledgerdev: \
hledgerprof: \ hledgerprof: \
$(call def-help,hledgerprof, build "hledgerprof" for profiling (with stack) ) $(call def-help,hledgerprof, build "hledgerprof" for profiling (with stack) )
stack build hledger-lib hledger --library-profiling --executable-profiling --ghc-options=-fprof-auto $(STACK) build hledger-lib hledger --library-profiling --executable-profiling --ghc-options=-fprof-auto
cp `stack exec which hledger`{,prof} cp `$(STACK) exec which hledger`{,prof}
@echo to profile, use stack exec -- hledgerprof ... @echo to profile, use $(STACK) exec -- hledgerprof ...
# bin/hledgerprof: \ # bin/hledgerprof: \
# $(call def-help,bin/hledgerprof,\ # $(call def-help,bin/hledgerprof,\
@ -359,21 +361,21 @@ hledgercov: \
# hledger-lib/Hledger/Read/TimeclockReaderPP.hs # hledger-lib/Hledger/Read/TimeclockReaderPP.hs
dev: dev.hs $(SOURCEFILES) \ dev: dev.hs $(SOURCEFILES) \
$(call def-help,dev, build the dev.hs script for quick experiments (with ghc) ) $(call def-help,dev, build the dev.hs script for quick experiments (with ghc) )
stack ghc -- $(CABALMACROSFLAGS) -ihledger-lib dev.hs \ $(STACK) ghc -- $(CABALMACROSFLAGS) -ihledger-lib dev.hs \
# dev0: dev.hs $(SOURCEFILES) \ # dev0: dev.hs $(SOURCEFILES) \
# $(call def-help,dev, build the dev.hs script for quick experiments (with ghc -O0) ) # $(call def-help,dev, build the dev.hs script for quick experiments (with ghc -O0) )
# stack ghc -- -O0 $(CABALMACROSFLAGS) -ihledger-lib dev.hs -o dev0 \ # $(STACK) ghc -- -O0 $(CABALMACROSFLAGS) -ihledger-lib dev.hs -o dev0 \
# dev2: dev.hs $(SOURCEFILES) \ # dev2: dev.hs $(SOURCEFILES) \
# $(call def-help,dev, build the dev.hs script for quick experiments (with ghc -O2) ) # $(call def-help,dev, build the dev.hs script for quick experiments (with ghc -O2) )
# stack ghc -- -O2 $(CABALMACROSFLAGS) -ihledger-lib dev.hs -o dev2 \ # $(STACK) ghc -- -O2 $(CABALMACROSFLAGS) -ihledger-lib dev.hs -o dev2 \
# to get profiling deps installed, first do something like: # to get profiling deps installed, first do something like:
# stack build --library-profiling hledger-lib timeit criterion # stack build --library-profiling hledger-lib timeit criterion
devprof: dev.hs $(SOURCEFILES) \ devprof: dev.hs $(SOURCEFILES) \
$(call def-help,devprof, build the dev.hs script with profiling support ) $(call def-help,devprof, build the dev.hs script with profiling support )
stack ghc -- $(CABALMACROSFLAGS) -ihledger-lib dev.hs -rtsopts -prof -fprof-auto -osuf p_o -o devprof $(STACK) ghc -- $(CABALMACROSFLAGS) -ihledger-lib dev.hs -rtsopts -prof -fprof-auto -osuf p_o -o devprof
dev-profile: devprof \ dev-profile: devprof \
$(call def-help,dev-profile, get a time & space profile of the dev.hs script ) $(call def-help,dev-profile, get a time & space profile of the dev.hs script )
@ -505,7 +507,7 @@ dev-heap-upload:
tools/simplebench: tools/simplebench.hs \ tools/simplebench: tools/simplebench.hs \
$(call def-help,tools/simplebench, build the standalone generic benchmark runner. Requires libs installed by stack build --bench. ) $(call def-help,tools/simplebench, build the standalone generic benchmark runner. Requires libs installed by stack build --bench. )
stack exec -- $(GHC) tools/simplebench.hs $(STACK) exec -- $(GHC) tools/simplebench.hs
# tools/criterionbench: tools/criterionbench.hs \ # tools/criterionbench: tools/criterionbench.hs \
# $(call def-help,tools/criterionbench,\ # $(call def-help,tools/criterionbench,\
@ -580,14 +582,14 @@ test: pkgtest builtintest functest \
#@echo package tests: #@echo package tests:
pkgtest: \ pkgtest: \
$(call def-help,pkgtest, run the test suites for each package ) $(call def-help,pkgtest, run the test suites for each package )
@(stack test \ @($(STACK) test \
&& echo $@ PASSED) || echo $@ FAILED && echo $@ PASSED) || echo $@ FAILED
# NB ensure hledger executable is current (eg do pkgtest first) # NB ensure hledger executable is current (eg do pkgtest first)
#@echo "built-in tests (hledger cli unit tests)": #@echo "built-in tests (hledger cli unit tests)":
builtintest: \ builtintest: \
$(call def-help,builtintest, run tests built in to the hledger executable (subset of pkg tests) ) $(call def-help,builtintest, run tests built in to the hledger executable (subset of pkg tests) )
@(stack exec hledger test \ @($(STACK) exec hledger test \
&& echo $@ PASSED) || echo $@ FAILED && echo $@ PASSED) || echo $@ FAILED
# builtintestghc: bin/hledgerdev \ # builtintestghc: bin/hledgerdev \
@ -610,7 +612,7 @@ builtintest: \
functest: tests/addons/hledger-addon \ functest: tests/addons/hledger-addon \
$(call def-help,functest, run the functional tests for hledger ) $(call def-help,functest, run the functional tests for hledger )
@stack build hledger @$(STACK) build hledger
@(COLUMNS=80 $(SHELLTESTSTK) tests \ @(COLUMNS=80 $(SHELLTESTSTK) tests \
&& echo $@ PASSED) || echo $@ FAILED && echo $@ PASSED) || echo $@ FAILED
@ -723,7 +725,7 @@ quickbench: samplejournals bench.tests tools/simplebench \
quickprof-%: hledgerprof samplejournals \ quickprof-%: hledgerprof samplejournals \
$(call def-help,quickprof-"CMD", run some command against a sample journal and display the execution profile ) $(call def-help,quickprof-"CMD", run some command against a sample journal and display the execution profile )
stack exec -- hledgerprof +RTS $(PROFRTSFLAGS) -RTS $* -f data/10000x1000x10.journal >/dev/null $(STACK) exec -- hledgerprof +RTS $(PROFRTSFLAGS) -RTS $* -f data/10000x1000x10.journal >/dev/null
profiteur hledgerprof.prof profiteur hledgerprof.prof
@echo @echo
@head -20 hledgerprof.prof @head -20 hledgerprof.prof
@ -749,7 +751,7 @@ quickprof-%: hledgerprof samplejournals \
quickheap-%: hledgerprof samplejournals \ quickheap-%: hledgerprof samplejournals \
$(call def-help,quickheap-"CMD", run some command against a sample journal and display the heap profile ) $(call def-help,quickheap-"CMD", run some command against a sample journal and display the heap profile )
stack exec -- hledgerprof +RTS -hc -RTS $* -f data/10000x1000x10.journal >/dev/null $(STACK) exec -- hledgerprof +RTS -hc -RTS $* -f data/10000x1000x10.journal >/dev/null
hp2ps hledgerprof.hp hp2ps hledgerprof.hp
@echo generated hledgerprof.ps @echo generated hledgerprof.ps
$(VIEWPS) hledgerprof.ps $(VIEWPS) hledgerprof.ps
@ -791,26 +793,26 @@ quickheap-%: hledgerprof samplejournals \
# multi-package GHCI prompts # multi-package GHCI prompts
ghci: \ ghci: \
# $(call def-help,ghci, start a GHCI REPL and load the hledger-lib and hledger packages) # $(call def-help,ghci, start a GHCI REPL and load the hledger-lib and hledger packages)
stack exec -- $(GHCI) $(BUILDFLAGS) hledger/Hledger/Cli/Main.hs $(STACK) exec -- $(GHCI) $(BUILDFLAGS) hledger/Hledger/Cli/Main.hs
ghci-dev: \ ghci-dev: \
# $(call def-help,ghci, start a GHCI REPL and load the dev.hs script plus hledger-lib and hledger) # $(call def-help,ghci, start a GHCI REPL and load the dev.hs script plus hledger-lib and hledger)
stack exec -- $(GHCI) $(BUILDFLAGS) -fno-warn-unused-imports -fno-warn-unused-binds dev.hs $(STACK) exec -- $(GHCI) $(BUILDFLAGS) -fno-warn-unused-imports -fno-warn-unused-binds dev.hs
ghci-ui: \ ghci-ui: \
# $(call def-help,ghci-ui, start a GHCI REPL and load the hledger-lib, hledger and hledger-ui packages) # $(call def-help,ghci-ui, start a GHCI REPL and load the hledger-lib, hledger and hledger-ui packages)
stack exec -- $(GHCI) $(BUILDFLAGS) hledger-ui/Hledger/UI/Main.hs $(STACK) exec -- $(GHCI) $(BUILDFLAGS) hledger-ui/Hledger/UI/Main.hs
ghci-web: \ ghci-web: \
# $(call def-help,ghci-web, start a GHCI REPL and load the hledger-lib, hledger and hledger-web packages) # $(call def-help,ghci-web, start a GHCI REPL and load the hledger-lib, hledger and hledger-web packages)
stack exec -- $(GHCI) $(BUILDFLAGS) hledger-web/app/main.hs $(STACK) exec -- $(GHCI) $(BUILDFLAGS) hledger-web/app/main.hs
ghci-api: \ ghci-api: \
# $(call def-help,ghci-api, start a GHCI REPL and load the hledger-lib, hledger and hledger-api packages) # $(call def-help,ghci-api, start a GHCI REPL and load the hledger-lib, hledger and hledger-api packages)
stack exec -- $(GHCI) $(BUILDFLAGS) hledger-api/hledger-api.hs $(STACK) exec -- $(GHCI) $(BUILDFLAGS) hledger-api/hledger-api.hs
ghcid-lib-doctest: ghcid-lib-doctest:
ghcid --command 'cd hledger-lib; stack ghci hledger-lib:test:doctests' --test ':main' --reload hledger-lib ghcid --command 'cd hledger-lib; $(STACK) ghci hledger-lib:test:doctests' --test ':main' --reload hledger-lib
samplejournals: \ samplejournals: \
data/sample.journal \ data/sample.journal \
@ -970,8 +972,8 @@ HADDOCKFLAGS= \
haddock: \ haddock: \
$(call def-help,haddock, generate haddock docs for the hledger packages ) $(call def-help,haddock, generate haddock docs for the hledger packages )
stack haddock --no-haddock-deps --no-keep-going # && echo OK $(STACK) haddock --no-haddock-deps --no-keep-going # && echo OK
# stack -v haddock --no-haddock-deps --no-keep-going # && echo OK # $(STACK) -v haddock --no-haddock-deps --no-keep-going # && echo OK
# view-haddock: \ # view-haddock: \
# $(call def-help,view-haddock-cli,\ # $(call def-help,view-haddock-cli,\
@ -1466,11 +1468,11 @@ cleantags: \
stackclean: \ stackclean: \
$(call def-help-hide,stackclean, remove .stack-work/* in packages (but not in project) ) $(call def-help-hide,stackclean, remove .stack-work/* in packages (but not in project) )
stack clean $(STACK) clean
Stackclean: \ Stackclean: \
$(call def-help-hide,Stackclean, remove all stack working dirs ) $(call def-help-hide,Stackclean, remove all stack working dirs )
stack clean $(STACK) clean
cleanghco: \ cleanghco: \
$(call def-help-hide,cleanghc, remove ghc build leftovers ) $(call def-help-hide,cleanghc, remove ghc build leftovers )