Commit e982476c authored by Andrey Mokhov's avatar Andrey Mokhov

Clean up imports (improve consistency)

parent d1780e49
......@@ -5,11 +5,11 @@ module Builder (
) where
import Control.Monad.Trans.Reader
import GHC.Generics (Generic)
import Base
import Context
import GHC
import GHC.Generics (Generic)
import Oracles.Config
import Oracles.LookupInPath
import Oracles.WindowsPath
......
......@@ -3,16 +3,11 @@ module CmdLineFlag (
cmdProgressInfo, ProgressInfo (..), cmdSkipConfigure, cmdSplitObjects
) where
import Data.IORef
import Data.List.Extra
import System.Console.GetOpt
import Data.IORef
import System.IO.Unsafe (unsafePerformIO)
-- Command line flags
data ProgressInfo = None | Brief | Normal | Unicorn deriving (Eq, Show)
data Flavour = Default | Quick deriving (Eq, Show)
-- | 'CmdLineFlag.Untracked' is a collection of flags that can be passed via the
-- command line. These flags are not tracked, that is they do not force any
-- build rules to be rurun.
......@@ -24,6 +19,9 @@ data Untracked = Untracked
, splitObjects :: Bool }
deriving (Eq, Show)
data ProgressInfo = None | Brief | Normal | Unicorn deriving (Eq, Show)
data Flavour = Default | Quick deriving (Eq, Show)
-- | Default values for 'CmdLineFlag.Untracked'.
defaultUntracked :: Untracked
defaultUntracked = Untracked
......@@ -79,7 +77,7 @@ cmdFlags =
, Option [] ["split-objects"] (NoArg readSplitObjects)
"Generate split objects (requires a full clean rebuild)." ]
-- TODO: Avoid unsafePerformIO by using shakeExtra (awaiting Shake's release)
-- TODO: Avoid unsafePerformIO by using shakeExtra.
{-# NOINLINE cmdLineFlags #-}
cmdLineFlags :: IORef Untracked
cmdLineFlags = unsafePerformIO $ newIORef defaultUntracked
......@@ -87,7 +85,7 @@ cmdLineFlags = unsafePerformIO $ newIORef defaultUntracked
putCmdLineFlags :: [Untracked -> Untracked] -> IO ()
putCmdLineFlags flags = modifyIORef cmdLineFlags (\f -> foldl (flip id) f flags)
-- TODO: Avoid unsafePerformIO by using shakeExtra (awaiting Shake's release)
-- TODO: Avoid unsafePerformIO by using shakeExtra.
{-# NOINLINE getCmdLineFlags #-}
getCmdLineFlags :: Untracked
getCmdLineFlags = unsafePerformIO $ readIORef cmdLineFlags
......
module Environment (setupEnvironment) where
import Base
import System.Environment
import Base
-- | The build system invokes many external builders whose behaviour is
-- influenced by the environment variables. We need to modify some of them
-- for better robustness of the build system.
......
......@@ -30,9 +30,9 @@ import Control.Monad.Trans.Reader
import Data.Monoid
import Base
import Builder
import Context
import Package
import Builder
import Stage
import Target
import Way
......
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Oracles.Config (askConfig, askConfigWithDefault, configOracle) where
import Base
import qualified Data.HashMap.Strict as Map
import Development.Shake.Config
import Base
newtype ConfigKey = ConfigKey String
deriving (Show, Typeable, Eq, Hashable, Binary, NFData)
......
......@@ -10,9 +10,10 @@ module Package (
setPath, topLevel, library, utility, setType, isLibrary, isProgram
) where
import Base
import GHC.Generics (Generic)
import Data.String
import GHC.Generics (Generic)
import Base
-- | The name of a Cabal package
newtype PackageName = PackageName { fromPackageName :: String }
......
module Rules.Cabal (cabalRules) where
import Base
import Data.Version
import Distribution.Package as DP
import Distribution.PackageDescription
import Distribution.PackageDescription.Parse
import Distribution.Verbosity
import Base
import Expression
import GHC
import Settings
......
......@@ -4,9 +4,9 @@ import qualified System.Info as System
import Base
import Builder
import CmdLineFlag (cmdSkipConfigure)
import CmdLineFlag
import Context
import GHC (compiler)
import GHC
import Rules.Actions
import Rules.Generators.GhcAutoconfH
import Stage
......
......@@ -9,6 +9,8 @@ import Base
import Context hiding (stage)
import Expression
import GHC
import Oracles.ModuleFiles
import Rules.Actions
import Rules.Generators.ConfigHs
import Rules.Generators.GhcAutoconfH
import Rules.Generators.GhcBootPlatformH
......@@ -16,8 +18,6 @@ import Rules.Generators.GhcPlatformH
import Rules.Generators.GhcSplit
import Rules.Generators.GhcVersionH
import Rules.Generators.VersionHs
import Oracles.ModuleFiles
import Rules.Actions
import Rules.Libffi
import Settings
import Target hiding (builder, context)
......
......@@ -7,8 +7,8 @@ import GHC
import Oracles.Config.Setting
import Rules.Actions
import Settings.Packages.IntegerGmp
import Settings.User
import Settings.Paths
import Settings.User
import Target
gmpBase :: FilePath
......
......@@ -2,7 +2,7 @@ module Rules.Perl (perlScriptRules) where
import Base
import Expression
import Rules.Actions (runBuilder)
import Rules.Actions
-- TODO: get rid of perl scripts
-- | Generate perl scripts the build system requires, such as @ghc-split@,
......
......@@ -6,8 +6,8 @@ import Development.Shake
import Test.QuickCheck
import Base
import Oracles.ModuleFiles (decodeModule, encodeModule)
import Settings.Builders.Ar (chunksOfSize)
import Oracles.ModuleFiles
import Settings.Builders.Ar
import Way
instance Arbitrary Way where
......
......@@ -3,7 +3,7 @@ module Rules.Test (testRules) where
import Base
import Builder
import Expression
import GHC (compiler, rts, libffi)
import GHC
import Oracles.Config.Flag
import Oracles.Config.Setting
import Oracles.WindowsPath
......
module Settings.Builders.Alex (alexBuilderArgs) where
import Expression
import Predicates (builder)
import Predicates
alexBuilderArgs :: Args
alexBuilderArgs = builder Alex ? mconcat [ arg "-g"
......
......@@ -4,9 +4,9 @@ import Base
import Expression
import Oracles.Config.Flag
import Oracles.Config.Setting
import Predicates (builder)
import Predicates
-- | Default arguments for 'Ar' builder
-- | Default arguments for 'Ar' builder.
arBuilderArgs :: Args
arBuilderArgs = builder Ar ? mconcat [ arg "q"
, arg =<< getOutput
......
module Settings.Builders.Cc (ccBuilderArgs) where
import Development.Shake.FilePath
import Base
import Expression
import Oracles.Config.Setting
import Oracles.PackageData
import Predicates (builder)
import Predicates
import Settings
import Settings.Builders.Common (cIncludeArgs)
import Settings.Builders.Common
-- TODO: handle custom $1_$2_MKDEPENDC_OPTS and
ccBuilderArgs :: Args
......
......@@ -11,7 +11,7 @@ import Oracles.PackageData
import Settings
includes :: [FilePath]
includes = [ "includes", "includes/dist-derivedconstants/header" ]
includes = ["includes", "includes/dist-derivedconstants/header"]
includesArgs :: Args
includesArgs = append $ map ("-I" ++) includes
......
......@@ -3,7 +3,7 @@ module Settings.Builders.Configure (configureBuilderArgs) where
import Base
import Expression
import Oracles.Config.Setting
import Predicates (builder)
import Predicates
import Settings
configureBuilderArgs :: Args
......
......@@ -4,7 +4,7 @@ import Base
import Expression
import Oracles.Config.Flag
import Oracles.Config.Setting
import Predicates (builder, output)
import Predicates
import Settings.Builders.Common
-- TODO: do we need to support `includes_CC_OPTS += -DDYNAMIC_BY_DEFAULT`?
......
module Settings.Builders.GenPrimopCode (genPrimopCodeBuilderArgs) where
import Expression
import Predicates (builder, output)
import Predicates
-- Stdin/stdout are handled in a special way. See Rules/Actions.hs.
genPrimopCodeBuilderArgs :: Args
......
module Settings.Builders.Ghc (
ghcBuilderArgs, ghcMBuilderArgs, commonGhcArgs
) where
module Settings.Builders.Ghc (ghcBuilderArgs, ghcMBuilderArgs, commonGhcArgs) where
import Control.Monad.Trans.Reader
......@@ -12,8 +10,8 @@ import Oracles.Config.Setting
import Oracles.PackageData
import Predicates hiding (way, stage)
import Settings
import Settings.Builders.GhcCabal (bootPackageDbArgs)
import Settings.Builders.Common (cIncludeArgs)
import Settings.Builders.Common
import Settings.Builders.GhcCabal
-- TODO: add support for -dyno
-- $1/$2/build/%.$$($3_o-bootsuf) : $1/$4/%.hs-boot
......
......@@ -5,14 +5,11 @@ module Settings.Builders.GhcCabal (
) where
import Base
import Oracles.Config.Setting
import Oracles.Config.Flag
import GHC
import Package
import Way
import Builder
import Stage
import Expression
import GHC
import Oracles.Config.Flag
import Oracles.Config.Setting
import Predicates hiding (stage)
import Settings
import Settings.Builders.Common
......
module Settings.Builders.Haddock (haddockBuilderArgs) where
import Development.Shake.FilePath
import Base
import GHC
import Package
......
module Settings.Builders.Happy (happyBuilderArgs) where
import Expression
import Predicates (builder)
import Predicates
happyBuilderArgs :: Args
happyBuilderArgs = builder Happy ? mconcat [ arg "-agc"
......
......@@ -3,7 +3,7 @@ module Settings.Builders.HsCpp (hsCppBuilderArgs) where
import Expression
import GHC
import Oracles.Config.Setting
import Predicates (builder)
import Predicates
import Settings.Builders.GhcCabal
import Settings.Paths
......
module Settings.Builders.Hsc2Hs (hsc2hsBuilderArgs) where
import Control.Monad.Trans.Class
import Control.Monad.Extra
import Control.Monad.Trans.Class
import Base
import Expression
import Oracles.Config.Flag
import Oracles.Config.Setting
import Oracles.PackageData
import Predicates (builder, stage0, notStage0)
import Predicates
import Settings
import Settings.Builders.Common
......
module Settings.Builders.Make (makeBuilderArgs) where
import Expression
import Predicates (builder)
import Settings
makeBuilderArgs :: Args
makeBuilderArgs = mconcat
[ builder (Make "testsuite/tests") ? arg "fast"
, builder (Make gmpBuildPath ) ? arg "MAKEFLAGS="
, builder (Make libffiBuildPath ) ? append ["MAKEFLAGS=", "install"] ]
module Settings.Builders.Make (makeBuilderArgs) where
import Expression
import Predicates
import Settings
makeBuilderArgs :: Args
makeBuilderArgs = mconcat
[ builder (Make "testsuite/tests") ? arg "fast"
, builder (Make gmpBuildPath ) ? arg "MAKEFLAGS="
, builder (Make libffiBuildPath ) ? append ["MAKEFLAGS=", "install"] ]
......@@ -2,7 +2,7 @@ module Settings.Builders.Tar (tarBuilderArgs) where
import Base
import Expression
import Predicates (builder)
import Predicates
tarBuilderArgs :: Args
tarBuilderArgs = builder Tar ? do
......
module Settings.Flavours.Quick (quickFlavourArgs, quickFlavourWays) where
import Expression
import Predicates (builder)
import Predicates
quickFlavourArgs :: Args
quickFlavourArgs = builder Ghc ? arg "-O0"
......
......@@ -2,8 +2,8 @@ module Settings.Packages.Base (basePackageArgs) where
import Base
import Expression
import GHC (base)
import Predicates (builder, package)
import GHC
import Predicates
import Settings
basePackageArgs :: Args
......
......@@ -2,10 +2,10 @@ module Settings.Packages.Compiler (compilerPackageArgs) where
import Base
import Expression
import GHC (compiler)
import Oracles.Config.Setting
import GHC
import Oracles.Config.Flag
import Predicates (builder, package, notStage0)
import Oracles.Config.Setting
import Predicates
import Settings
compilerPackageArgs :: Args
......
module Settings.Packages.Directory (directoryPackageArgs) where
import Expression
import GHC (directory)
import Predicates (builder, package)
import GHC
import Predicates
-- TODO: I had to define symbol __GLASGOW_HASKELL__ as otherwise directory.c is
-- effectively empty. I presume it was expected that GHC will be used for
......
module Settings.Packages.Ghc (ghcPackageArgs) where
import Expression
import GHC (ghc, compiler)
import GHC
import Oracles.Config.Setting
import Predicates (builder, package, notStage0)
import Predicates
import Settings.Paths
ghcPackageArgs :: Args
......
......@@ -4,7 +4,7 @@ import Base
import Expression
import GHC
import Oracles.Config.Setting
import Predicates (builder, package, stage0)
import Predicates
import Settings
ghcCabalPackageArgs :: Args
......
module Settings.Packages.GhcPrim (ghcPrimPackageArgs) where
import Expression
import GHC (ghcPrim)
import Predicates (builder, package)
import GHC
import Predicates
ghcPrimPackageArgs :: Args
ghcPrimPackageArgs = package ghcPrim ?
......
module Settings.Packages.Haddock (haddockPackageArgs) where
import Expression
import GHC (haddock)
import Predicates (builder, package)
import GHC
import Predicates
haddockPackageArgs :: Args
haddockPackageArgs = package haddock ?
......
......@@ -2,8 +2,8 @@ module Settings.Packages.Hp2ps (hp2psPackageArgs) where
import Base
import Expression
import GHC (hp2ps)
import Predicates (builder, package)
import GHC
import Predicates
import Settings
hp2psPackageArgs :: Args
......
......@@ -2,10 +2,10 @@ module Settings.Packages.IntegerGmp (integerGmpPackageArgs, gmpBuildPath) where
import Base
import Expression
import GHC (integerGmp)
import Predicates (builder, package)
import Settings.Paths
import GHC
import Oracles.Config.Setting
import Predicates
import Settings.Paths
-- TODO: move build artefacts to buildRootPath, see #113
-- TODO: Is this needed?
......
module Settings.Packages.IservBin (iservBinPackageArgs) where
import Expression
import GHC (iservBin)
import Predicates (builder, package)
import GHC
import Predicates
iservBinPackageArgs :: Args
iservBinPackageArgs = package iservBin ? do
mconcat [ builder Ghc ? arg "-no-hs-main" ]
iservBinPackageArgs = package iservBin ? builder Ghc ? arg "-no-hs-main"
......@@ -4,10 +4,10 @@ module Settings.Packages.Rts (
import Base
import Expression
import GHC (rts, rtsContext)
import GHC
import Oracles.Config.Flag
import Oracles.Config.Setting
import Predicates (builder, package, input)
import Predicates
import Settings
import Settings.Builders.Common
......
module Settings.Packages.RunGhc (runGhcPackageArgs) where
import Expression
import GHC (runGhc)
import GHC
import Oracles.Config.Setting
import Predicates (builder, input, package)
import Predicates
runGhcPackageArgs :: Args
runGhcPackageArgs = package runGhc ? do
......
......@@ -2,8 +2,8 @@ module Settings.Packages.Touchy (touchyPackageArgs) where
import Base
import Expression
import GHC (touchy)
import Predicates (builder, package)
import GHC
import Predicates
import Settings
touchyPackageArgs :: Args
......
......@@ -2,8 +2,8 @@ module Settings.Packages.Unlit (unlitPackageArgs) where
import Base
import Expression
import GHC (unlit)
import Predicates (builder, package)
import GHC
import Predicates
import Settings
unlitPackageArgs :: Args
......
module Settings.Ways (getLibraryWays, getRtsWays) where
import CmdLineFlag
import Base
import CmdLineFlag
import Expression
import Oracles.Config.Flag
import Predicates
import Settings.Flavours.Quick
import Settings.User
-- | Combine default ways with user modifications
-- | Combine default library ways with user modifications.
getLibraryWays :: Expr [Way]
getLibraryWays = fromDiffExpr $ mconcat [ defaultLibraryWays
, userLibraryWays
, flavourLibraryWays ]
-- | Combine default RTS ways with user modifications.
getRtsWays :: Expr [Way]
getRtsWays = fromDiffExpr $ defaultRtsWays <> userRtsWays
......
......@@ -9,9 +9,10 @@ module Way (
wayPrefix, waySuffix, hisuf, osuf, hcsuf, obootsuf, hibootsuf, ssuf, libsuf
) where
import Base hiding (unit)
import Data.IntSet (IntSet)
import qualified Data.IntSet as Set
import Base hiding (unit)
import Oracles.Config.Setting
-- Note: order of constructors is important for compatibility with the old build
......