mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-07 21:15:19 +03:00
;just: port more make rules
This commit is contained in:
parent
f7763cbc9c
commit
f4156475cf
229
Justfile
229
Justfile
@ -5,7 +5,8 @@
|
||||
# https://just.systems/man/en/chapter_31.html Functions
|
||||
# https://cheatography.com/linux-china/cheat-sheets/justfile Cheatsheet
|
||||
# https://github.com/casey/just/discussions
|
||||
# See also Makefile, Shake.hs.
|
||||
# This has absorbed all of Makefile; uncomment and update remaining bits when needed.
|
||||
# See also Shake.hs.
|
||||
# ** prelude
|
||||
|
||||
@help:
|
||||
@ -21,7 +22,7 @@
|
||||
just -q _check || just --fmt --unstable
|
||||
|
||||
@_watch:
|
||||
watchexec -w {{ justfile() }} -- 'just; just -q _check && echo format ok || echo format non-standard'
|
||||
watchexec -w {{ justfile() }} -- 'just; just -q _check && echo format ok || echo non-standard format'
|
||||
|
||||
# ** vars
|
||||
# GHC-compiled executables require a locale (and not just C) or they
|
||||
@ -349,7 +350,6 @@ TESTING:
|
||||
# run tests that are reasonably quick (files, unit, functional) and benchmarks
|
||||
test: filestest functest
|
||||
|
||||
#bench
|
||||
# For quieter tests add --silent. It may hide troubleshooting info.
|
||||
# For very verbose tests add --verbosity=debug. It seems hard to get something in between.
|
||||
|
||||
@ -465,110 +465,74 @@ installtest:
|
||||
BENCHMARKING:
|
||||
|
||||
# generate standard sample journals in examples/
|
||||
mksamplejournals:
|
||||
samplejournals:
|
||||
tools/generatejournal.hs 3 5 5 > examples/ascii.journal
|
||||
tools/generatejournal.hs 3 5 5 --chinese > examples/chinese.journal
|
||||
tools/generatejournal.hs 3 5 5 --mixed > examples/mixed.journal
|
||||
tools/generatejournal.hs 10 10 10 > examples/10x10x10.journal
|
||||
tools/generatejournal.hs 100 100 10 > examples/100x100x10.journal
|
||||
tools/generatejournal.hs 1000 1000 10 > examples/1000x1000x10.journal
|
||||
tools/generatejournal.hs 1000 10000 10 > examples/1000x10000x10.journal
|
||||
tools/generatejournal.hs 2000 1000 10 > examples/2000x1000x10.journal
|
||||
tools/generatejournal.hs 3000 1000 10 > examples/3000x1000x10.journal
|
||||
tools/generatejournal.hs 4000 1000 10 > examples/4000x1000x10.journal
|
||||
tools/generatejournal.hs 5000 1000 10 > examples/5000x1000x10.journal
|
||||
tools/generatejournal.hs 6000 1000 10 > examples/6000x1000x10.journal
|
||||
tools/generatejournal.hs 7000 1000 10 > examples/7000x1000x10.journal
|
||||
tools/generatejournal.hs 8000 1000 10 > examples/8000x1000x10.journal
|
||||
tools/generatejournal.hs 9000 1000 10 > examples/9000x1000x10.journal
|
||||
tools/generatejournal.hs 10000 1000 10 > examples/10000x1000x10.journal
|
||||
tools/generatejournal.hs 10000 10000 10 > examples/10000x10000x10.journal
|
||||
tools/generatejournal.hs 100000 1000 10 > examples/100000x1000x10.journal
|
||||
tools/generatejournal.hs 1000000 1000 10 > examples/1000000x1000x10.journal
|
||||
|
||||
# $ just --set BENCHEXES ledger,hledger bench
|
||||
|
||||
BENCHEXES := 'hledger'
|
||||
|
||||
bench: quickbench
|
||||
|
||||
# run benchmark commands in bench.sh for each of BENCHEXES, with quickbench
|
||||
@quickbench:
|
||||
printf "Running benchmarks with {{ BENCHEXES }} (times are approximate, can be skewed):\n"
|
||||
which quickbench >/dev/null && quickbench -w {{ BENCHEXES }} || echo "quickbench not installed (see bench.sh), skipping"
|
||||
|
||||
# samplejournals bench.sh
|
||||
# bench: samplejournals tests/bench.tests tools/simplebench \
|
||||
# $(call def-help,bench,\
|
||||
# run simple performance benchmarks and archive results\
|
||||
# Requires some commands defined in tests/bench.tests and some BENCHEXES defined above.\
|
||||
# )
|
||||
# tools/simplebench -v -ftests/bench.tests $(BENCHEXES) | tee doc/profs/$(TIME).bench
|
||||
# @rm -f benchresults.*
|
||||
# @(cd doc/profs; rm -f latest.bench; ln -s $(TIME).bench latest.bench)
|
||||
# criterionbench: samplejournals tools/criterionbench \
|
||||
# $(call def-help,criterionbench,\
|
||||
# run criterion benchmark tests and save graphical results\
|
||||
# )
|
||||
# tools/criterionbench -t png -k png
|
||||
# progressionbench: samplejournals tools/progressionbench \
|
||||
# $(call def-help,progressionbench,\
|
||||
# run progression benchmark tests and save graphical results\
|
||||
# )
|
||||
# tools/progressionbench -- -t png -k png
|
||||
|
||||
# show throughput at various data sizes with the given hledger executable (requires samplejournals)
|
||||
@throughput HLEDGEREXE:
|
||||
echo date: `date`
|
||||
echo system: `uname -a`
|
||||
echo executable: {{ HLEDGEREXE }}
|
||||
echo version: `{{ HLEDGEREXE }} --version`
|
||||
for n in 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 100000 ; do \
|
||||
printf "%6d txns: " $n; {{ HLEDGEREXE }} stats -f examples/${n}x1000x10.journal | tail -1; \
|
||||
done
|
||||
date
|
||||
|
||||
# show throughput at various data sizes with the latest hledger dev build, optimised or not (requires samplejournals)
|
||||
@throughput-dev:
|
||||
stack build hledger
|
||||
stack exec -- just throughput hledger
|
||||
|
||||
# samplejournals: $(call def-help,samplejournals, regenerate standard sample journals in examples/) \
|
||||
# examples/sample.journal \
|
||||
# examples/10x10x10.journal \
|
||||
# examples/100x100x10.journal \
|
||||
# examples/1000x1000x10.journal \
|
||||
# examples/1000x10000x10.journal \
|
||||
# examples/2000x1000x10.journal \
|
||||
# examples/3000x1000x10.journal \
|
||||
# examples/4000x1000x10.journal \
|
||||
# examples/5000x1000x10.journal \
|
||||
# examples/6000x1000x10.journal \
|
||||
# examples/7000x1000x10.journal \
|
||||
# examples/8000x1000x10.journal \
|
||||
# examples/9000x1000x10.journal \
|
||||
# examples/10000x1000x10.journal \
|
||||
# examples/10000x10000x10.journal \
|
||||
# examples/100000x1000x10.journal \
|
||||
# examples/1000000x1000x10.journal \
|
||||
# # examples/ascii.journal \
|
||||
# # examples/chinese.journal \
|
||||
# # examples/mixed.journal \
|
||||
# examples/sample.journal:
|
||||
# true # XXX should probably regenerate this
|
||||
# examples/10x10x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 10 10 10 >$@
|
||||
# examples/100x100x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 100 100 10 >$@
|
||||
# examples/1000x1000x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 1000 1000 10 >$@
|
||||
# examples/1000x10000x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 1000 10000 10 >$@
|
||||
# examples/2000x1000x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 2000 1000 10 >$@
|
||||
# examples/3000x1000x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 3000 1000 10 >$@
|
||||
# examples/4000x1000x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 4000 1000 10 >$@
|
||||
# examples/5000x1000x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 5000 1000 10 >$@
|
||||
# examples/6000x1000x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 6000 1000 10 >$@
|
||||
# examples/7000x1000x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 7000 1000 10 >$@
|
||||
# examples/8000x1000x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 8000 1000 10 >$@
|
||||
# examples/9000x1000x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 9000 1000 10 >$@
|
||||
# examples/10000x1000x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 10000 1000 10 >$@
|
||||
# examples/10000x10000x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 10000 10000 10 >$@
|
||||
# examples/100000x1000x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 100000 1000 10 >$@
|
||||
# examples/1000000x1000x10.journal: tools/generatejournal
|
||||
# tools/generatejournal 1000000 1000 10 >$@
|
||||
# examples/ascii.journal: tools/generatejournal
|
||||
# tools/generatejournal 3 5 5 >$@
|
||||
# examples/chinese.journal: tools/generatejournal
|
||||
# tools/generatejournal 3 5 5 --chinese >$@
|
||||
# examples/mixed.journal: tools/generatejournal
|
||||
# tools/generatejournal 3 5 5 --mixed >$@
|
||||
# # hledger executables to bench test, can be overridden by env var,
|
||||
# # eg: BENCHEXES=ledger,hledger-1.18,hledger make bench
|
||||
# BENCHEXES ?= hledger
|
||||
# bench: quickbench
|
||||
# quickbench: samplejournals bench.sh $(call def-help,quickbench, benchmark commands in bench.sh with quickbench and $(BENCHEXES))
|
||||
# @echo; echo "run quick performance benchmarks in bench.sh (approximate, can be skewed):"
|
||||
# @which quickbench >/dev/null && quickbench -w $(BENCHEXES) || echo "quickbench not installed (see bench.sh), skipping"
|
||||
# # bench: samplejournals tests/bench.tests tools/simplebench \
|
||||
# # $(call def-help,bench,\
|
||||
# # run simple performance benchmarks and archive results\
|
||||
# # Requires some commands defined in tests/bench.tests and some BENCHEXES defined above.\
|
||||
# # )
|
||||
# # tools/simplebench -v -ftests/bench.tests $(BENCHEXES) | tee doc/profs/$(TIME).bench
|
||||
# # @rm -f benchresults.*
|
||||
# # @(cd doc/profs; rm -f latest.bench; ln -s $(TIME).bench latest.bench)
|
||||
# # criterionbench: samplejournals tools/criterionbench \
|
||||
# # $(call def-help,criterionbench,\
|
||||
# # run criterion benchmark tests and save graphical results\
|
||||
# # )
|
||||
# # tools/criterionbench -t png -k png
|
||||
# # progressionbench: samplejournals tools/progressionbench \
|
||||
# # $(call def-help,progressionbench,\
|
||||
# # run progression benchmark tests and save graphical results\
|
||||
# # )
|
||||
# # tools/progressionbench -- -t png -k png
|
||||
# throughput: throughput-hledger \
|
||||
# $(call def-help,throughput, show throughput at various data sizes with the default hledger executable )
|
||||
# throughput-%: samplejournals \
|
||||
# $(call def-help,throughput-HLEDGEREXE, show throughput at various data sizes with the given hledger executable )
|
||||
# @echo date: `date`
|
||||
# @echo system: `uname -a`
|
||||
# @echo executable: $*
|
||||
# @echo version: `$* --version`
|
||||
# @for n in 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 100000 ; do \
|
||||
# printf "%6d txns: " $$n; $* stats -f examples/$${n}x1000x10.journal | tail -1; \
|
||||
# done
|
||||
# @date
|
||||
# throughput-dev: samplejournals \
|
||||
# $(call def-help,throughput-dev, show throughput at various data sizes with the latest hledger dev build (optimised or not) )
|
||||
# @stack build hledger
|
||||
# @stack exec -- make -s throughput
|
||||
# # prof: samplejournals \
|
||||
# # $(call def-help,prof,\
|
||||
# # generate and archive an execution profile\
|
||||
@ -632,22 +596,33 @@ mksamplejournals:
|
||||
# # view the last html code coverage report\
|
||||
# # )
|
||||
# # $(VIEWHTML) doc/profs/coverage/index.html
|
||||
# ###############################################################################
|
||||
# $(call def-help-subheading,DOCUMENTATION: (see also Shake.hs))
|
||||
# # http://www.haskell.org/haddock/doc/html/invoking.html
|
||||
# STACKHADDOCK=time $(STACK) --verbosity=error haddock --fast --no-keep-going \
|
||||
# --only-locals --no-haddock-deps --no-haddock-hyperlink-source \
|
||||
# --haddock-arguments="--no-warnings"
|
||||
# # -ghc-options='-optP-P' # workaround for http://trac.haskell.org/haddock/ticket/284
|
||||
# # uncomment to run haddock on fewer packages, saving time
|
||||
# #HADDOCKPKGS=hledger-lib
|
||||
# releasediag: \
|
||||
# $(call def-help,releasediag, optimise and commit RELEASING value map diagram )
|
||||
# pngquant doc/HledgerReleaseValueMap.png -f -o doc/HledgerReleaseValueMap.png && git add doc/HledgerReleaseValueMap.png && git commit -m ';doc: RELEASING: update value map' -- doc/HledgerReleaseValueMap.png
|
||||
# # Renders all hledger packages. Run make haddock-open to open contents page.
|
||||
# haddock: \
|
||||
# $(call def-help,haddock, regenerate haddock docs for the hledger packages and open them )
|
||||
# $(STACKHADDOCK) $(HADDOCKPKGS) && make -s haddock-open # --open shows all deps and packages
|
||||
# ** documentation
|
||||
|
||||
DOCUMENTATION:
|
||||
|
||||
# see also Shake.hs
|
||||
# http://www.haskell.org/haddock/doc/html/invoking.html
|
||||
|
||||
# optimise and commit RELEASING value map diagram
|
||||
@releasediag:
|
||||
pngquant doc/HledgerReleaseValueMap.png -f -o doc/HledgerReleaseValueMap.png
|
||||
git add doc/HledgerReleaseValueMap.png
|
||||
git commit -m ';doc: RELEASING: update value map' -- doc/HledgerReleaseValueMap.png
|
||||
|
||||
STACKHADDOCK := 'time ' + STACK + ' --verbosity=error haddock --fast --no-keep-going \
|
||||
--only-locals --no-haddock-deps --no-haddock-hyperlink-source \
|
||||
--haddock-arguments="--no-warnings" \
|
||||
'
|
||||
|
||||
# -ghc-options='-optP-P' # workaround for http://trac.haskell.org/haddock/ticket/284
|
||||
|
||||
HADDOCKPKGS := 'hledger-lib'
|
||||
|
||||
# regenerate haddock docs for the hledger packages and open them
|
||||
haddock:
|
||||
{{ STACKHADDOCK }} {{ HADDOCKPKGS }}
|
||||
just haddock-open # --open shows all deps and packages
|
||||
|
||||
# # Rerenders all hledger packages. Run make haddock-open to open contents page.
|
||||
# haddock-watch1: \
|
||||
# $(call def-help,haddock-watch, regenerate haddock docs when files change )
|
||||
@ -661,9 +636,11 @@ mksamplejournals:
|
||||
# haddock-watch: \
|
||||
# $(call def-help,haddock-watch3, quickly regenerate & reload Hledger.hs haddock when files change )
|
||||
# watchexec -r -e yaml,cabal,hs --print-events --shell=none -- bash -c 'mkdir -p tmp && rm -f tmp/Hledger.html && haddock -h -o tmp hledger-lib/Hledger.hs --no-warnings --no-print-missing-docs 2>&1 | grep -v "Could not find documentation" && open tmp/Hledger.html'
|
||||
# haddock-open: \
|
||||
# $(call def-help,haddock-open, open the haddock packages contents page in a browser )
|
||||
# $(BROWSE) `stack path --local-install-root`/doc/index.html
|
||||
|
||||
# open the haddock packages contents page in a browser
|
||||
haddock-open:
|
||||
{{ BROWSE }} `{{ STACK }} path --local-install-root`/doc/index.html
|
||||
|
||||
# hoogle-setup: $(call def-help,hoogle-setup, install hoogle then build haddocks and a hoogle db for the project and all deps )
|
||||
# stack hoogle --rebuild
|
||||
# HOOGLEBROWSER="/Applications/Firefox Dev.app/Contents/MacOS/firefox" # safari not supported
|
||||
@ -839,8 +816,6 @@ _gitSwitchAutoCreate BRANCH:
|
||||
git switch -c {{ BRANCH }}
|
||||
fi
|
||||
|
||||
# ###############################################################################
|
||||
# $(call def-help-subheading,RELEASING:)
|
||||
# # old/desired release process:
|
||||
# # a normal release: echo 0.7 >.version; make release
|
||||
# # a bugfix release: echo 0.7.1 >.version; make release
|
||||
|
Loading…
Reference in New Issue
Block a user