Commit 7f2c6a1a authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Add --haddock command line flag.

See #98.
parent 63bbebfd
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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment