Skip to content

Commit ed97f96

Browse files
committed
WIP
1 parent 16eb7e2 commit ed97f96

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

src/HaskellCI/Config/Grammar.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ configGrammar = Config
159159
^^^ metaActionHelp "PATCH" "file" ".patch files to apply to the generated Travis YAML file"
160160
<*> monoidalFieldAla "github-patches" (C.alaList' C.NoCommaFSep C.Token') (field @"cfgGitHubPatches")
161161
^^^ metaActionHelp "PATCH" "file" ".patch files to apply to the generated GitHub Actions YAML file"
162-
<*> booleanFieldDef "insert-version" (field @"cfgInsertVersion") defaultConfig
162+
<*> booleanFieldDef "insert-version" (field @"cfgInsertVersion") defaultConfig
163163
^^^ help "Don't insert the haskell-ci version into the generated Travis YAML file"
164-
<*> optionalFieldDef "error-missing-methods" (field @"cfgErrorMissingMethods") defaultConfig
164+
<*> optionalFieldDef "error-missing-methods" (field @"cfgErrorMissingMethods") defaultConfig
165165
^^^ metahelp "PKGSCOPE" "Insert -Werror=missing-methods for package scope (none, local, all)"
166-
<*> booleanFieldDef "error-unused-packages" (field @"cfgErrorUnusedPkgs") defaultConfig
167-
^^^ help "Insert -Werror=unused-packages"
166+
<*> rangeField "error-unused-packages" (field @"cfgErrorUnusedPkgs") defaultConfig
167+
^^^ metahelp "RANGE" "Insert -Werror=unused-packages"
168168
<*> blurFieldGrammar (field @"cfgDoctest") doctestConfigGrammar defaultConfig
169169
<*> blurFieldGrammar (field @"cfgDocspec") docspecConfigGrammar defaultConfig
170170
<*> pure [] -- constraint sets

src/HaskellCI/Config/History.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ configHistory =
8383
, ver 0 19 20250606 := \cfg -> cfg
8484
& field @"cfgDocspec" . field @"cfgDocspecUrl" .~ "https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20250606/cabal-docspec-0.0.0.20250606-x86_64-linux.xz"
8585
& field @"cfgDocspec" . field @"cfgDocspecHash" .~ "cc20bb5c19501b42bde77556bc419c7c0a5c8d1eb65663024d8a4e4c868bef25"
86+
, ver 0 19 20250708 := \cfg -> cfg
87+
& field @"cfgErrorUnusedPkgs" .~ C.orLaterVersion (C.mkVersion [9,4])
8688
]
8789
where
8890
ver x y z = [x, y, z]

src/HaskellCI/Config/Initial.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ initialConfig = Config
7474
, cfgGitHubPatches = []
7575
, cfgInsertVersion = True
7676
, cfgErrorMissingMethods = PackageScopeLocal
77-
, cfgErrorUnusedPkgs = True -- TODO: False
77+
, cfgErrorUnusedPkgs = noVersion
7878
, cfgDoctest = initialDoctestConfig
7979
, cfgDocspec = initialDocspecConfig
8080
, cfgConstraintSets = []

src/HaskellCI/Config/Type.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ data Config = Config
7474
, cfgGitHubPatches :: [FilePath]
7575
, cfgInsertVersion :: !Bool
7676
, cfgErrorMissingMethods :: !PackageScope
77-
, cfgErrorUnusedPkgs :: !Bool
77+
, cfgErrorUnusedPkgs :: !VersionRange
7878
, cfgDoctest :: !DoctestConfig
7979
, cfgDocspec :: !DocspecConfig
8080
, cfgConstraintSets :: [ConstraintSet]

src/HaskellCI/GitHub.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,10 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
356356
, " ghc-options: -Werror=missing-methods -Werror=missing-fields"
357357
]
358358

359-
when cfgErrorUnusedPkgs $ for_ pkgs $ \Pkg{pkgName,pkgJobs} -> do
360-
let range = Range (C.orLaterVersion (C.mkVersion [9,4])) /\ RangePoints pkgJobs
359+
-- -Werror-unused-pkgs
360+
for_ pkgs $ \Pkg{pkgName,pkgJobs} -> do
361+
-- is introduced in 8.10.
362+
let range = Range cfgErrorUnusedPkgs /\ Range (C.orLaterVersion (C.mkVersion [8,10])) /\ RangePoints pkgJobs
361363
echo_if_to range "cabal.project" $ "package " ++ pkgName
362364
echo_if_to range "cabal.project" $ " ghc-options: -Werror=unused-packages"
363365

0 commit comments

Comments
 (0)