File tree Expand file tree Collapse file tree 4 files changed +10
-1
lines changed Expand file tree Collapse file tree 4 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,8 @@ configGrammar = Config
163163 ^^^ help " Don't insert the haskell-ci version into the generated Travis YAML file"
164164 <*> 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"
166168 <*> blurFieldGrammar (field @ " cfgDoctest" ) doctestConfigGrammar defaultConfig
167169 <*> blurFieldGrammar (field @ " cfgDocspec" ) docspecConfigGrammar defaultConfig
168170 <*> pure [] -- constraint sets
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ initialConfig = Config
7474 , cfgGitHubPatches = []
7575 , cfgInsertVersion = True
7676 , cfgErrorMissingMethods = PackageScopeLocal
77+ , cfgErrorUnusedPkgs = True -- TODO: False
7778 , cfgDoctest = initialDoctestConfig
7879 , cfgDocspec = initialDocspecConfig
7980 , cfgConstraintSets = []
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ data Config = Config
7474 , cfgGitHubPatches :: [FilePath ]
7575 , cfgInsertVersion :: ! Bool
7676 , cfgErrorMissingMethods :: ! PackageScope
77+ , cfgErrorUnusedPkgs :: ! Bool
7778 , cfgDoctest :: ! DoctestConfig
7879 , cfgDocspec :: ! DocspecConfig
7980 , cfgConstraintSets :: [ConstraintSet ]
Original file line number Diff line number Diff line change @@ -350,12 +350,17 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
350350 PackageScopeLocal -> for_ pkgs $ \ Pkg {pkgName,pkgJobs} -> do
351351 let range = Range (C. orLaterVersion (C. mkVersion [8 ,2 ])) /\ RangePoints pkgJobs
352352 echo_if_to range " cabal.project" $ " package " ++ pkgName
353- echo_if_to range " cabal.project" $ " ghc-options: -Werror=missing-methods"
353+ echo_if_to range " cabal.project" $ " ghc-options: -Werror=missing-methods -Werror=missing-fields "
354354 PackageScopeAll -> cat " cabal.project" $ unlines
355355 [ " package *"
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 [8 ,10 ])) /\ RangePoints pkgJobs
361+ echo_if_to range " cabal.project" $ " package " ++ pkgName
362+ echo_if_to range " cabal.project" $ " ghc-options: -Werror=unused-packages"
363+
359364 -- extra cabal.project fields
360365 cat " cabal.project" $ C. showFields' (const C. NoComment ) (const id ) 2 $ extraCabalProjectFields " $GITHUB_WORKSPACE/source/"
361366
You can’t perform that action at this time.
0 commit comments