[commit: ghc] wip/T16197: Hadrian: configure packages with right 'htmldir' (da2d9cf)

git at git.haskell.org git at git.haskell.org
Thu Jan 17 13:58:18 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T16197
Link       : http://ghc.haskell.org/trac/ghc/changeset/da2d9cf8e028cd4e47285a71a720f33f112db69b/ghc

>---------------------------------------------------------------

commit da2d9cf8e028cd4e47285a71a720f33f112db69b
Author: Alec Theriault <alec.theriault at gmail.com>
Date:   Thu Dec 27 13:07:51 2018 -0800

    Hadrian: configure packages with right 'htmldir'
    
    This means that we can query the package DB for haddock interfaces.
    Haddock uses this in its testsuite. 'cabal {v1-,v2,}-haddock' also
    uses this.
    
    Also thread through to Haddock package-specific overrides of GHC
    warnings.


>---------------------------------------------------------------

da2d9cf8e028cd4e47285a71a720f33f112db69b
 hadrian/src/Settings/Builders/Cabal.hs | 14 +++++++++++++-
 hadrian/src/Settings/Builders/Ghc.hs   |  4 +++-
 hadrian/src/Settings/Default.hs        |  3 ++-
 hadrian/src/Settings/Warnings.hs       |  6 +++---
 4 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/hadrian/src/Settings/Builders/Cabal.hs b/hadrian/src/Settings/Builders/Cabal.hs
index 80b9b67..8eedcde 100644
--- a/hadrian/src/Settings/Builders/Cabal.hs
+++ b/hadrian/src/Settings/Builders/Cabal.hs
@@ -13,6 +13,7 @@ cabalBuilderArgs :: Args
 cabalBuilderArgs = builder (Cabal Setup) ? do
     verbosity <- expr getVerbosity
     top       <- expr topDirectory
+    pkg       <- getPackage
     path      <- getContextPath
     stage     <- getStage
     mconcat [ arg "configure"
@@ -25,13 +26,24 @@ cabalBuilderArgs = builder (Cabal Setup) ? do
             , flag CrossCompiling ? pure [ "--disable-executable-stripping"
                                          , "--disable-library-stripping" ]
             , arg "--cabal-file"
-            , arg =<< pkgCabalFile <$> getPackage
+            , arg $ pkgCabalFile pkg
             , arg "--distdir"
             , arg $ top -/- path
             , arg "--ipid"
             , arg "$pkg-$version"
             , arg "--prefix"
             , arg "${pkgroot}/.."
+
+            -- NB: this is valid only because Hadrian puts the @docs@ and
+            -- @libraries@ folders in the same relative position:
+            --
+            --   * libraries in @_build/stageN/libraries@
+            --   * docs in @_build/docs/html/libraries@
+            --
+            -- This doesn't hold if we move the @docs@ folder anywhere else.
+            , arg "--htmldir"
+            , arg $ "${pkgroot}/../../docs/html/libraries/" ++ pkgName pkg
+
             , withStaged $ Ghc CompileHs
             , withStaged (GhcPkg Update)
             , withBuilderArgs (GhcPkg Update stage)
diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs
index e2cad2c..a605873 100644
--- a/hadrian/src/Settings/Builders/Ghc.hs
+++ b/hadrian/src/Settings/Builders/Ghc.hs
@@ -83,7 +83,9 @@ findHsDependencies = builder (Ghc FindHsDependencies) ? do
             , getInputs ]
 
 haddockGhcArgs :: Args
-haddockGhcArgs = mconcat [ commonGhcArgs, getContextData hcOpts ]
+haddockGhcArgs = mconcat [ commonGhcArgs
+                         , getContextData hcOpts
+                         , ghcWarningsArgs ]
 
 -- | Common GHC command line arguments used in 'ghcBuilderArgs',
 -- 'ghcCBuilderArgs', 'ghcMBuilderArgs' and 'haddockGhcArgs'.
diff --git a/hadrian/src/Settings/Default.hs b/hadrian/src/Settings/Default.hs
index 2cadc4f..e2d7644 100644
--- a/hadrian/src/Settings/Default.hs
+++ b/hadrian/src/Settings/Default.hs
@@ -277,4 +277,5 @@ defaultBuilderArgs = mconcat
 
 -- | All 'Package'-dependent command line arguments.
 defaultPackageArgs :: Args
-defaultPackageArgs = mconcat [ packageArgs, warningArgs ]
+defaultPackageArgs = mconcat [ packageArgs
+                             , builder Ghc ? ghcWarningsArgs ]
diff --git a/hadrian/src/Settings/Warnings.hs b/hadrian/src/Settings/Warnings.hs
index 5a9e831..42e7662 100644
--- a/hadrian/src/Settings/Warnings.hs
+++ b/hadrian/src/Settings/Warnings.hs
@@ -1,4 +1,4 @@
-module Settings.Warnings (defaultGhcWarningsArgs, warningArgs) where
+module Settings.Warnings (defaultGhcWarningsArgs, ghcWarningsArgs) where
 
 import Expression
 import Oracles.Flag
@@ -18,8 +18,8 @@ defaultGhcWarningsArgs = mconcat
     , flag GccIsClang ? arg "-optc-Wno-unknown-pragmas" ]
 
 -- | Package-specific warnings-related arguments, mostly suppressing various warnings.
-warningArgs :: Args
-warningArgs = builder Ghc ? do
+ghcWarningsArgs :: Args
+ghcWarningsArgs = do
     isIntegerSimple <- (== integerSimple) <$> getIntegerPackage
     mconcat
         [ stage0 ? mconcat



More information about the ghc-commits mailing list