diff --git a/Makefile b/Makefile index 60b39e1ba..27ee6f1a0 100644 --- a/Makefile +++ b/Makefile @@ -154,16 +154,31 @@ TIME:=$(shell date +"%Y%m%d%H%M") defaulttarget: bin/hledgerdev ###################################################################### -# BUILDING +# SETUP +# work in progress +# Some rules use a sandbox, some don't, ideally we'll handle both cases. +# Initial dev setup involves: +# initialising a sandbox, probably +# cabal update, perhaps +# cabal clean in hledger packages, perhaps +# cabal install dependencies for hledger packages +# cabal install hledger-lib and hledger, perhaps hledger-web +# at least start cabal build in hledger packages, to make cabal include files (dist/build/{Paths_PKG.hs,cabal_macros.h}) (not working with a sandbox) +# When done we should be able to make install, repl-{lib,cli,web}, ghci[-web], check etc. -EXTRAINSTALLARGS= +sandbox: .cabal-sandbox + +.cabal-sandbox: + cabal sandbox init + cabal sandbox add-source ./hledger-lib ./hledger ./hledger-web # cabal install the main hledger packages and all their dependencies +# in the sandbox if any, otherwise in the user's package db install: $(CABALINSTALL) $(patsubst %,./%,$(PACKAGES)) $(EXTRAINSTALLARGS) --enable-tests -# cabal install the main hledger packages and all their dependencies, more forcibly -# (may break installed libs, requiring ghc-pkg-clean) +# cabal install the main hledger packages and all their dependencies more forcibly +# (can break installed libs, requiring ghc-pkg-clean) install-force: $(CABALINSTALL) $(patsubst %,./%,$(PACKAGES)) $(EXTRAINSTALLARGS) --enable-tests --allow-newer --force-reinstalls @@ -184,6 +199,14 @@ allcabal%: # all%: # for p in $(PACKAGES); do (echo doing $* in $$p; cd $$p; $*); done +Reset: + cabal sandbox delete + +###################################################################### +# BUILDING + +EXTRAINSTALLARGS= + # auto-recompile and run (something, eg --help or unit tests) whenever a module changes auto: auto---version @@ -353,12 +376,10 @@ tools/generatejournal: tools/generatejournal.hs # TESTING # developer environment checks -###################################################################### -# DOCUMENTATION check: @echo sanity-check developer environment: - @($(SHELLTEST) checks -- --threads=8 \ + @($(SHELLTEST) checks -- \ && echo $@ PASSED) || echo $@ FAILED @@ -367,6 +388,10 @@ check: packdeps: for p in $(PACKAGES); do packdeps $$p/$$p.cabal; done +###################################################################### +# DOCUMENTATION + + ###################################################################### # RELEASING @@ -576,10 +601,10 @@ viewcoverage: # get a debug prompt ghci: - $(GHCI) $(WARNINGS) $(INCLUDEPATHS) $(MAIN) + cabal exec $(GHCI) -- $(WARNINGS) $(INCLUDEPATHS) $(MAIN) -ghciweb: - $(GHCI) $(BUILDFLAGS) $(WEBLANGEXTS) hledger-web/app/main.hs +ghci-web: + cabal exec $(GHCI) -- $(BUILDFLAGS) $(WEBLANGEXTS) hledger-web/app/main.hs repl-lib: (cd hledger-lib; cabal repl) diff --git a/checks/10-cabal-installed.test b/checks/11-cabal-installed.test similarity index 100% rename from checks/10-cabal-installed.test rename to checks/11-cabal-installed.test diff --git a/checks/10-ghc-installed.test b/checks/12-ghc-installed.test similarity index 100% rename from checks/10-ghc-installed.test rename to checks/12-ghc-installed.test diff --git a/checks/20-ghc-pkg-check.test b/checks/21-ghc-pkg-check.test similarity index 100% rename from checks/20-ghc-pkg-check.test rename to checks/21-ghc-pkg-check.test diff --git a/checks/31-hledger-lib-cabal-deps-installed.test b/checks/31-hledger-lib-cabal-deps-installed.test deleted file mode 100644 index f166b1ba6..000000000 --- a/checks/31-hledger-lib-cabal-deps-installed.test +++ /dev/null @@ -1,5 +0,0 @@ -# hledger-lib's cabal dependencies are installed -cabal install ./hledger-lib --only-dep --dry || echo HINT: cabal install ./hledger-lib --only-dep ->>> /All the requested packages are already installed/ ->>>2 ->>>= 0 diff --git a/checks/32-hledger-cli-cabal-deps-installed.test b/checks/32-hledger-cli-cabal-deps-installed.test deleted file mode 100644 index 1423c896c..000000000 --- a/checks/32-hledger-cli-cabal-deps-installed.test +++ /dev/null @@ -1,5 +0,0 @@ -# hledger's cabal dependencies are installed -cabal install ./hledger --only-dep --dry || echo HINT: cabal install ./hledger-lib ->>> /All the requested packages are already installed/ ->>>2 ->>>= 0 diff --git a/checks/33-hledger-web-cabal-deps-installed.test b/checks/33-hledger-web-cabal-deps-installed.test deleted file mode 100644 index 1e8388cea..000000000 --- a/checks/33-hledger-web-cabal-deps-installed.test +++ /dev/null @@ -1,5 +0,0 @@ -# hledger-lib's cabal dependencies are installed -cabal install ./hledger-web --only-dep --dry || echo HINT: cabal install ./hledger ->>> /All the requested packages are already installed/ ->>>2 ->>>= 0 diff --git a/checks/51-make-ghci.test b/checks/51-make-ghci.test index 2a1b0fc8c..b60fb49b6 100644 --- a/checks/51-make-ghci.test +++ b/checks/51-make-ghci.test @@ -1,4 +1,4 @@ # hledger+hledger-lib GHCI prompt works echo :q | make ghci | tail ->>> /Ok, modules loaded: Hledger, / +>>> /Ok, modules loaded/ >>>= 0 diff --git a/checks/52-make-ghci-web.test b/checks/52-make-ghci-web.test index 8861bb05e..8fc345300 100644 --- a/checks/52-make-ghci-web.test +++ b/checks/52-make-ghci-web.test @@ -1,4 +1,4 @@ # hledger-web+hledger+hledger-lib GHCI prompt works -echo :q | make ghciweb | tail ->>> /Ok, modules loaded: Settings, Main, / +echo :q | make ghci-web | tail +>>> /Ok, modules loaded/ >>>= 0