File tree Expand file tree Collapse file tree 2 files changed +41
-4
lines changed
Expand file tree Collapse file tree 2 files changed +41
-4
lines changed Original file line number Diff line number Diff line change 138138 ( python3 . withPackages ( ps : with ps ; [ sphinx sphinx_rtd_theme recommonmark sphinx-markdown-tables sphinxemoji ] ) )
139139 haskellPackages . implicit-hie
140140 shellcheck
141- ] ;
141+ ] ++
142+ ( let
143+ doctest = haskell-nix . hackage-package {
144+ name = "doctest" ;
145+ version = "0.24.0" ;
146+ configureArgs = "-f cabal-doctest" ;
147+ inherit ( config ) compiler-nix-name ;
148+ } ;
149+ in
150+ [
151+ ( doctest . getComponent "exe:cabal-doctest" )
152+ ( doctest . getComponent "exe:doctest" )
153+ ] ) ;
142154 # disable Hoogle until someone request it
143155 withHoogle = false ;
144156 # Skip cross compilers for the shell
Original file line number Diff line number Diff line change 22
33set -euo pipefail
44
5- # Install doctest's Cabal integration
6- cabal install doctest --flag cabal-doctest --ignore-project --overwrite-policy=always
5+ # Packages to run doctests for; defaults to all packages if none are specified
6+ PACKAGES=(" $@ " )
7+
8+ # Install doctest's Cabal integration, if it's not present already
9+ if [[ -z " $( type -t cabal-doctest) " ]]
10+ then
11+ cabal install doctest --flag cabal-doctest --ignore-project --overwrite-policy=always
12+ fi
13+
14+ # Ensure doctest and PATH are using the same ghc version
15+
16+ getExecutablePath ()
17+ {
18+ " $1 " -package-env - -e ' import System.Environment' -e ' putStrLn =<< getExecutablePath'
19+ }
20+
21+ default_ghc=$( type -p ghc)
22+ doctest_ghc=$( doctest --info | ghc -e ' interact $ maybe "" id . lookup "ghc" . read' )
23+
24+ if [[ " $( getExecutablePath " $default_ghc " ) " != " $( getExecutablePath " $doctest_ghc " ) " ]]
25+ then
26+ echo " Incompatible GHC's:" >&2
27+ echo " Default ghc: $( getExecutablePath " $default_ghc " ) " >&2
28+ echo " Doctest ghc: $( getExecutablePath " $doctest_ghc " ) " >&2
29+ exit 1
30+ fi
731
832# Ensure the cabal-doctest executable can be found
933PATH=$( cabal path --installdir) :$PATH
@@ -21,9 +45,10 @@ cardano-ledger-api:lib:cardano-ledger-api --build-depends=cardano-ledger-babbage
2145EOF
2246
2347# Run the doctests for some or all packages
24- cabal-targets.hs " $@ " |
48+ cabal-targets.hs " ${PACKAGES[@]} " |
2549sort | join -t' ' -a1 -j1 - " $EXTRA_ARGS " |
2650while read -ra ARGS
2751do
52+ echo " ***** cabal doctest ${ARGS[0]} *****"
2853 cabal doctest --repl-options=' -w -Wdefault' " ${ARGS[@]} "
2954done
You can’t perform that action at this time.
0 commit comments