Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 32 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
CABALBUILD := cabal build
CABALRUN := cabal run

DOCTEST := cabal doctest
CABAL_DOCTEST := cabal doctest
REPL_WITH_DOCTEST := cabal repl --with-compiler=doctest --build-depends=QuickCheck --verbose=0 --repl-options='-w -Wdefault -Wno-inconsistent-flags'

# default rules

Expand Down Expand Up @@ -149,17 +150,40 @@ ghcid-lib: ## Run ghcid for the Cabal library.
ghcid-cli: ## Run ghcid for the cabal-install executable.
ghcid -c 'cabal repl cabal-install'

# doctests

# To find package directories that might have doctests:
# $ grep --exclude generics-sop-lens.hs -E "\- >>>" **/*.hs | awk -F/ '{print $1}' | sort -u
DOCTEST_PACKAGES := \
Cabal \
Cabal-described \
Cabal-syntax \
cabal-install \
cabal-install-solver \
cabal-testsuite

DOCTEST_TARGETS := $(addprefix doctest-, $(DOCTEST_PACKAGES))

doctest-%: ## Run doctests for a specific package.
@echo "Running doctests for $*:" && cd $* && $(CABAL_DOCTEST) $*

doctest-cabal-testsuite: ## Run doctests for a specific package.
@echo "Running doctests for cabal-testsuite:" && $(REPL_WITH_DOCTEST) cabal-testsuite

doctest-PACKAGENAME: ## Run doctests for a single package (replace PACKAGENAME).
@echo 'Please use one of the following targets:'
@printf "%s\n" $(DOCTEST_TARGETS)

.PHONY: doctest
doctest: ## Run doctests.
cd Cabal-syntax && $(DOCTEST)
cd Cabal-described && $(DOCTEST)
cd Cabal && $(DOCTEST)
cd cabal-install-solver && $(DOCTEST)
cd cabal-install && $(DOCTEST)
doctest: ## Run doctests in all packages.
doctest: $(DOCTEST_TARGETS)

# We don't use the cabal-doctest external command but we install it anyway along
# with doctest.
# SEE: https://github.com/haskell/cabal/issues/11493
.PHONY: doctest-install
doctest-install: ## Install doctest tool needed for running doctests.
cabal install doctest --overwrite-policy=always --ignore-project --flag cabal-doctest
cabal install doctest-0.24.3 --overwrite-policy=always --ignore-project --flag cabal-doctest

# tests

Expand Down
Loading