[Git][ghc/ghc][wip/hadrian-werror-ci] ci: Pass -Werror when building hadrian in hadrian-ghc-in-ghci job

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Thu Jul 20 12:40:40 UTC 2023



Matthew Pickering pushed to branch wip/hadrian-werror-ci at Glasgow Haskell Compiler / GHC


Commits:
ba837d4a by Matthew Pickering at 2023-07-20T13:40:27+01:00
ci: Pass -Werror when building hadrian in hadrian-ghc-in-ghci job

Warnings when building Hadrian can end up cluttering the output of HLS,
and we've had bug reports in the past about these warnings when building
Hadrian. It would be nice to turn on -Werror on at least one build of
Hadrian in CI to avoid a patch introducing warnings when building
Hadrian.

Fixes #23638

- - - - -


6 changed files:

- .gitlab-ci.yml
- hadrian/ghci-cabal.in
- hadrian/src/Context.hs
- hadrian/src/Flavour.hs
- hadrian/src/Hadrian/Haskell/Hash.hs
- hadrian/src/Settings/Builders/Cabal.hs


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -371,6 +371,8 @@ hadrian-ghc-in-ghci:
     - git clean -xdf && git submodule foreach git clean -xdf
     - .gitlab/ci.sh setup
     - .gitlab/ci.sh configure
+    # Enable -Werror when building hadrian
+    - echo $'package hadrian\n  ghc-options: -Werror' > hadrian/cabal.project.local
     # Load ghc-in-ghci then immediately exit and check the modules loaded
     - echo ":q" | hadrian/ghci -j`mk/detect-cpu-count.sh`| tail -n2 | grep "Ok,"
   after_script:


=====================================
hadrian/ghci-cabal.in
=====================================
@@ -5,6 +5,6 @@
 set -e
 export TOOL_OUTPUT=.hadrian_ghci/ghci_args
 # Replace newlines with spaces, as these otherwise break the ghci invocation on windows.
-CABFLAGS=-v0 "hadrian/build-cabal" tool:compiler/GHC.hs --build-root=.hadrian_ghci --flavour=ghc-in-ghci $HADRIAN_ARGS
+CABFLAGS="-v0 $CABFLAGS" "hadrian/build-cabal" tool:compiler/GHC.hs --build-root=.hadrian_ghci --flavour=ghc-in-ghci $HADRIAN_ARGS
 GHC_FLAGS="$GHC_FLAGS $(cat $TOOL_OUTPUT | tr '\n\r' ' ')"
 @WithGhc@ --interactive $GHC_FLAGS $@ -fno-code -fwrite-interface -hidir=.hadrian_ghci/interface -O0 +RTS -A128m


=====================================
hadrian/src/Context.hs
=====================================
@@ -95,7 +95,7 @@ pkgSetupConfigFile context = pkgSetupConfigDir context <&> (-/- "setup-config")
 -- | Path to the haddock file of a given 'Context', e.g.:
 -- @_build/stage1/libraries/array/doc/html/array/array.haddock at .
 pkgHaddockFile :: Context -> Action FilePath
-pkgHaddockFile context at Context {..} = do
+pkgHaddockFile Context {..} = do
     root <- buildRoot
     version <- pkgUnitId stage package
     return $ root -/- "doc/html/libraries" -/- version -/- pkgName package <.> "haddock"
@@ -136,7 +136,7 @@ pkgGhciLibraryFile context at Context {..} = do
 
 -- | Path to the configuration file of a given 'Context'.
 pkgConfFile :: Context -> Action FilePath
-pkgConfFile context at Context {..} = do
+pkgConfFile Context {..} = do
     pid  <- pkgUnitId stage package
     dbPath <- packageDbPath (PackageDbLoc stage iplace)
     return $ dbPath -/- pid <.> "conf"


=====================================
hadrian/src/Flavour.hs
=====================================
@@ -37,7 +37,6 @@ import Text.Parsec.Combinator as P
 import Text.Parsec.Char as P
 import Control.Monad.Except
 import UserSettings
-import Oracles.Flag
 
 
 flavourTransformers :: Map String (Flavour -> Flavour)


=====================================
hadrian/src/Hadrian/Haskell/Hash.hs
=====================================
@@ -31,7 +31,6 @@ import Way
 import Packages
 import Development.Shake.Classes
 import Control.Monad
-import Utilities
 import Base
 import Context
 import System.Directory.Extra (listFilesRecursive)


=====================================
hadrian/src/Settings/Builders/Cabal.hs
=====================================
@@ -57,7 +57,6 @@ commonReinstallCabalArgs :: Args
 commonReinstallCabalArgs = do
     top       <- expr topDirectory
     root      <- getBuildRoot
-    threads   <- shakeThreads <$> expr getShakeOptions
     _pkg      <- getPackage
     compiler  <- expr $ programPath =<< programContext Stage1 ghc
     mconcat [ arg "--project-file"



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ba837d4a064bd946692a1abe4bc9b4025a5f9064

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ba837d4a064bd946692a1abe4bc9b4025a5f9064
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230720/c3ef496b/attachment-0001.html>


More information about the ghc-commits mailing list