Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ init: ## Set up git hooks and ignored revisions

.PHONY: style
style: ## Run the code styler
@fourmolu -q -i Cabal Cabal-syntax cabal-install
@fourmolu -q -i Cabal Cabal-syntax cabal-install cabal-validate

.PHONY: style-modified
style-modified: ## Run the code styler on modified files
@git ls-files --modified Cabal Cabal-syntax cabal-install \
@git ls-files --modified Cabal Cabal-syntax cabal-install cabal-validate \
| grep '.hs$$' | xargs -P $(PROCS) -I {} fourmolu -q -i {}

.PHONY: style-commit
style-commit: ## Run the code styler on the previous commit
@git diff --name-only HEAD $(COMMIT) Cabal Cabal-syntax cabal-install \
@git diff --name-only HEAD $(COMMIT) Cabal Cabal-syntax cabal-install cabal-validate \
| grep '.hs$$' | xargs -P $(PROCS) -I {} fourmolu -q -i {}

# source generation: SPDX
Expand Down
23 changes: 23 additions & 0 deletions cabal-validate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# cabal-validate

`cabal-validate` is a script that builds and tests `Cabal` and `cabal-install`.
`cabal-validate` can be run with `validate.sh` in the repository root;
arguments passed to `validate.sh` will be forwarded to `cabal-validate`.

Notable arguments include:

- `-v`/`--verbose` to display build and test output in real-time, instead of
only if commands fail.
- `-s`/`--step` to run a specific step (e.g. `-s build -s lib-tests` will only
run the `build` and `lib-tests` steps).
- `-p`/`--pattern` to filter tests by a pattern.

## Hacking on cabal-validate

Overview of important modules:

- `Main.hs` encodes all the commands that are run for each step.
- `Cli.hs` parses the CLI arguments and resolves default values from the
environment, like determining which steps are run by default or the `--jobs`
argument to pass to test suites.
- `Step.hs` lists the available steps.
47 changes: 47 additions & 0 deletions cabal-validate/cabal-validate.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
cabal-version: 3.0
name: cabal-validate
version: 1.0.0
copyright: 2024-2024, Cabal Development Team (see AUTHORS file)
license: BSD-3-Clause
author: Cabal Development Team <[email protected]>
synopsis: An internal tool for building and testing the Cabal package manager
build-type: Simple

common common
ghc-options: -Wall

if impl(ghc <9.6)
-- Pattern exhaustiveness checker is not as good, misses a case.
ghc-options: -Wno-incomplete-patterns

default-language: Haskell2010
default-extensions:
OverloadedStrings
, TypeApplications

executable cabal-validate
import: common
ghc-options: -O -threaded -rtsopts -with-rtsopts=-N

main-is: Main.hs
hs-source-dirs: src

other-modules:
, Cli
, ClockUtil
, OutputUtil
, ProcessUtil
, Step

build-depends:
, base >=4 && <5
, ansi-terminal >=1 && <2
, bytestring >=0.11 && <1
, containers >=0.6 && <1
, directory >=1.0 && <2
, filepath >=1 && <2
, optparse-applicative >=0.18 && <1
, terminal-size >=0.3 && <1
, text >=2 && <3
, time >=1 && <2
, typed-process >=0.2 && <1
Loading