[commit: ghc] wip/nfs-locking: Add --haddock command line flag. (7f2c6a1)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:47:27 UTC 2017


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

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/7f2c6a1a360d5351fadc3ab9a6cfa322a56b797e/ghc

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

commit 7f2c6a1a360d5351fadc3ab9a6cfa322a56b797e
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sun Feb 7 02:31:37 2016 +0000

    Add --haddock command line flag.
    
    See #98.


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

7f2c6a1a360d5351fadc3ab9a6cfa322a56b797e
 src/CmdLineFlag.hs   | 18 ++++++++++++++----
 src/Settings/User.hs |  2 +-
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/CmdLineFlag.hs b/src/CmdLineFlag.hs
index 0142abb..84d4f11 100644
--- a/src/CmdLineFlag.hs
+++ b/src/CmdLineFlag.hs
@@ -1,6 +1,6 @@
 module CmdLineFlag (
-    putCmdLineFlags, cmdFlags, cmdConfigure, Configure (..), cmdFlavour,
-    Flavour (..), cmdProgressInfo, ProgressInfo (..), cmdSplitObjects
+    putCmdLineFlags, cmdFlags, cmdBuildHaddock, cmdConfigure, Configure (..),
+    cmdFlavour, Flavour (..), cmdProgressInfo, ProgressInfo (..), cmdSplitObjects
     ) where
 
 import Data.List.Extra
@@ -18,7 +18,8 @@ data Flavour      = Default | Quick deriving (Eq, Show)
 -- command line. These flags are not tracked, that is they do not force any
 -- build rules to be rurun.
 data Untracked = Untracked
-    { configure    :: Configure
+    { buildHaddock :: Bool
+    , configure    :: Configure
     , flavour      :: Flavour
     , progressInfo :: ProgressInfo
     , splitObjects :: Bool }
@@ -27,11 +28,15 @@ data Untracked = Untracked
 -- | Default values for 'CmdLineFlag.Untracked'.
 defaultUntracked :: Untracked
 defaultUntracked = Untracked
-    { configure    = SkipConfigure
+    { buildHaddock = False
+    , configure    = SkipConfigure
     , flavour      = Default
     , progressInfo = Normal
     , splitObjects = False }
 
+readBuildHaddock :: Either String (Untracked -> Untracked)
+readBuildHaddock = Right $ \flags -> flags { buildHaddock = True }
+
 readConfigure :: Maybe String -> Either String (Untracked -> Untracked)
 readConfigure ms =
     maybe (Left "Cannot parse configure") (Right . set) (go $ lower <$> ms)
@@ -75,6 +80,8 @@ cmdFlags =
       "Run configure with ARGS (also run boot if necessary)."
     , Option [] ["flavour"] (OptArg readFlavour "FLAVOUR")
       "Build flavour (Default or Quick)."
+    , Option [] ["haddock"] (NoArg readBuildHaddock)
+      "Generate Haddock documentation."
     , Option [] ["progress-info"] (OptArg readProgressInfo "STYLE")
       "Progress info style (None, Brief, Normal, or Unicorn)."
     , Option [] ["split-objects"] (NoArg readSplitObjects)
@@ -93,6 +100,9 @@ putCmdLineFlags flags = modifyIORef cmdLineFlags (\f -> foldl (flip id) f flags)
 getCmdLineFlags :: Untracked
 getCmdLineFlags = unsafePerformIO $ readIORef cmdLineFlags
 
+cmdBuildHaddock :: Bool
+cmdBuildHaddock = buildHaddock getCmdLineFlags
+
 cmdConfigure :: Configure
 cmdConfigure = configure getCmdLineFlags
 
diff --git a/src/Settings/User.hs b/src/Settings/User.hs
index 2cf39aa..dd6150a 100644
--- a/src/Settings/User.hs
+++ b/src/Settings/User.hs
@@ -84,7 +84,7 @@ laxDependencies :: Bool
 laxDependencies = False
 
 buildHaddock :: Predicate
-buildHaddock = return False -- FIXME: should be return True, see #98
+buildHaddock = return cmdBuildHaddock
 
 -- | Set to True to print full command lines during the build process. Note,
 -- this is a Predicate, hence you can enable verbose output for a chosen package



More information about the ghc-commits mailing list