Skip to content

Commit

Permalink
Convert validate.sh to cabal-validate
Browse files Browse the repository at this point in the history
Closes haskell#10317.

A Haskell script will be easier to maintain and expand than the existing
Bash script.

This also adds a `--pattern PATTERN` option which lets you filter tests
across all test suites.
  • Loading branch information
9999years committed Sep 7, 2024
1 parent db167ca commit 7331115
Show file tree
Hide file tree
Showing 5 changed files with 995 additions and 547 deletions.
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
37 changes: 37 additions & 0 deletions cabal-validate/cabal-validate.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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 <cabal-devel@haskell.org>
synopsis: An internal tool for building and testing the Cabal package manager
build-type: Simple

common warnings
ghc-options: -Wall

executable cabal-validate
import: warnings
default-language: Haskell2010
default-extensions:
OverloadedStrings
, TypeApplications
ghc-options: -O -threaded -rtsopts -with-rtsopts=-N

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

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

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

0 comments on commit 7331115

Please sign in to comment.