Skip to content
This repository has been archived by the owner on Aug 2, 2020. It is now read-only.

Commit

Permalink
Drop --haddock flag and always build Haddock and xthml
Browse files Browse the repository at this point in the history
See #414
  • Loading branch information
snowleopard committed Nov 4, 2017
1 parent 882c4a6 commit c53363d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 37 deletions.
20 changes: 5 additions & 15 deletions src/CommandLine.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module CommandLine (
optDescrs, cmdLineArgsMap, cmdBuildHaddock, cmdFlavour, lookupFreeze1,
cmdIntegerSimple, cmdProgressColour, cmdProgressInfo, cmdSkipConfigure,
cmdSplitObjects, cmdInstallDestDir
optDescrs, cmdLineArgsMap, cmdFlavour, lookupFreeze1, cmdIntegerSimple,
cmdProgressColour, cmdProgressInfo, cmdSkipConfigure, cmdSplitObjects,
cmdInstallDestDir
) where

import Data.Either
Expand All @@ -14,8 +14,7 @@ import System.Environment

-- | All arguments that can be passed to Hadrian via the command line.
data CommandLineArgs = CommandLineArgs
{ buildHaddock :: Bool
, flavour :: Maybe String
{ flavour :: Maybe String
, freeze1 :: Bool
, installDestDir :: Maybe String
, integerSimple :: Bool
Expand All @@ -28,8 +27,7 @@ data CommandLineArgs = CommandLineArgs
-- | Default values for 'CommandLineArgs'.
defaultCommandLineArgs :: CommandLineArgs
defaultCommandLineArgs = CommandLineArgs
{ buildHaddock = False
, flavour = Nothing
{ flavour = Nothing
, freeze1 = False
, installDestDir = Nothing
, integerSimple = False
Expand All @@ -41,9 +39,6 @@ defaultCommandLineArgs = CommandLineArgs
readFreeze1 :: Either String (CommandLineArgs -> CommandLineArgs)
readFreeze1 = Right $ \flags -> flags { freeze1 = True }

readBuildHaddock :: Either String (CommandLineArgs -> CommandLineArgs)
readBuildHaddock = Right $ \flags -> flags { buildHaddock = True }

readFlavour :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
readFlavour ms = Right $ \flags -> flags { flavour = lower <$> ms }

Expand Down Expand Up @@ -91,8 +86,6 @@ optDescrs =
"Build flavour (Default, Devel1, Devel2, Perf, Prof, Quick or Quickest)."
, Option [] ["freeze1"] (NoArg readFreeze1)
"Freeze Stage1 GHC."
, Option [] ["haddock"] (NoArg readBuildHaddock)
"Generate Haddock documentation."
, Option [] ["install-destdir"] (OptArg readInstallDestDir "DESTDIR")
"Installation destination directory."
, Option [] ["integer-simple"] (NoArg readIntegerSimple)
Expand All @@ -119,9 +112,6 @@ cmdLineArgsMap = do
cmdLineArgs :: Action CommandLineArgs
cmdLineArgs = userSetting defaultCommandLineArgs

cmdBuildHaddock :: Action Bool
cmdBuildHaddock = buildHaddock <$> cmdLineArgs

cmdFlavour :: Action (Maybe String)
cmdFlavour = flavour <$> cmdLineArgs

Expand Down
2 changes: 0 additions & 2 deletions src/Flavour.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ data Flavour = Flavour {
rtsWays :: Ways,
-- | Build split objects.
splitObjects :: Predicate,
-- | Build Haddock and documentation.
buildHaddock :: Predicate,
-- | Build dynamic GHC programs.
dynamicGhcPrograms :: Bool,
-- | Enable GHCi debugger.
Expand Down
11 changes: 4 additions & 7 deletions src/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ module GHC (
import Base
import CommandLine
import Context
import Oracles.Flag
import Oracles.Setting
import Oracles.Flag (crossCompiling)

-- | These are all GHC packages we know about. Build rules will be generated for
-- all of them. However, not all of these packages will be built. For example,
Expand Down Expand Up @@ -166,7 +166,6 @@ stage0Packages = do
stage1Packages :: Action [Package]
stage1Packages = do
win <- windowsHost
doc <- cmdBuildHaddock
intSimple <- cmdIntegerSimple
libraries0 <- filter isLibrary <$> stage0Packages
return $ libraries0 -- Build all Stage0 libraries in Stage1
Expand All @@ -190,16 +189,14 @@ stage1Packages = do
, rts
, runGhc
, stm
, time ]
, time
, xhtml ]
++ [ iservBin | not win ]
++ [ unix | not win ]
++ [ win32 | win ]
++ [ xhtml | doc ]

stage2Packages :: Action [Package]
stage2Packages = do
doc <- cmdBuildHaddock
return [ haddock | doc ]
stage2Packages = return [haddock]

-- | Given a 'Context', compute the name of the program that is built in it
-- assuming that the corresponding package's type is 'Program'. For example, GHC
Expand Down
9 changes: 2 additions & 7 deletions src/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import qualified Hadrian.Oracles.Path
import qualified Hadrian.Oracles.TextFile

import Expression
import Flavour
import qualified Oracles.ModuleFiles
import qualified Rules.Compile
import qualified Rules.PackageData
Expand All @@ -20,8 +19,8 @@ import qualified Rules.Library
import qualified Rules.Program
import qualified Rules.Register
import Settings
import UserSettings (stage1Only)
import Target
import UserSettings
import Utilities

allStages :: [Stage]
Expand Down Expand Up @@ -63,13 +62,9 @@ packageTargets includeGhciLib stage pkg = do
let pkgWays = if pkg == rts then getRtsWays else getLibraryWays
ways <- interpretInContext context pkgWays
libs <- mapM (pkgLibraryFile . Context stage pkg) ways
docs <- interpretInContext context =<< buildHaddock <$> flavour
more <- libraryTargets includeGhciLib context
setup <- pkgSetupConfigFile context
haddock <- pkgHaddockFile context
return $ [ setup | not $ nonCabalContext context ]
++ [ haddock | pkg /= rts && docs && stage == Stage1 ]
++ libs ++ more
return $ [ setup | not (nonCabalContext context) ] ++ libs ++ more
else do -- The only target of a program package is the executable.
prgContext <- programContext stage pkg
prgPath <- programPath prgContext
Expand Down
3 changes: 1 addition & 2 deletions src/Settings/Default.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module Settings.Default (
) where

import qualified Hadrian.Builder.Ar
import qualified Hadrian.Builder.Tar
import qualified Hadrian.Builder.Sphinx
import qualified Hadrian.Builder.Tar

import CommandLine
import Expression
Expand Down Expand Up @@ -121,7 +121,6 @@ defaultFlavour = Flavour
, libraryWays = defaultLibraryWays
, rtsWays = defaultRtsWays
, splitObjects = defaultSplitObjects
, buildHaddock = expr cmdBuildHaddock
, dynamicGhcPrograms = False
, ghciWithDebugger = False
, ghcProfiled = False
Expand Down
6 changes: 2 additions & 4 deletions src/Settings/Flavours/Quickest.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Settings.Flavours.Quickest (quickestFlavour) where

import Flavour
import Expression
import Flavour
import {-# SOURCE #-} Settings.Default

quickestFlavour :: Flavour
Expand All @@ -19,6 +19,4 @@ quickestArgs = sourceArgs SourceArgs
, hsGhc = stage0 ? arg "-O" }

quickestRtsWays :: Ways
quickestRtsWays = mconcat
[ pure [vanilla]
, buildHaddock defaultFlavour ? pure [threaded] ]
quickestRtsWays = pure [vanilla, threaded]

0 comments on commit c53363d

Please sign in to comment.