Commit d4a438fb authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Refactor Oracles.

parent c1258966
......@@ -2,10 +2,9 @@
module Builder (Builder (..), builderPath, specified, needBuilder) where
import Base
import GHC.Generics
import Oracles.Base
import Oracles.Setting
import Oracles.WindowsRoot
import Util
import GHC.Generics (Generic)
import Oracles
import Stage
-- A Builder is an external command invoked in separate process using Shake.cmd
......
module Oracles (
module Oracles.Config,
module Oracles.Config.Flag,
module Oracles.Config.Setting,
module Oracles.Dependencies,
module Oracles.PackageData,
module Oracles.PackageDeps,
module Oracles.WindowsRoot
) where
import Oracles.Config
import Oracles.Config.Flag
import Oracles.Config.Setting
import Oracles.Dependencies
import Oracles.PackageData
import Oracles.PackageDeps
import Oracles.WindowsRoot
......@@ -8,7 +8,7 @@ import Base
import Target
import Expression
import Settings.Args
import Control.Applicative
import Settings.User
newtype ArgsHashKey = ArgsHashKey Target
deriving (Show, Eq, Typeable, Binary, Hashable, NFData)
......@@ -30,6 +30,6 @@ checkArgsHash target = do
-- Oracle for storing per-target argument list hashes
argsHashOracle :: Rules ()
argsHashOracle = do
argsHashOracle = when trackBuildSystem $ do
_ <- addOracle $ \(ArgsHashKey target) -> hash <$> interpret target getArgs
return ()
{-# LANGUAGE DeriveDataTypeable, GeneralizedNewtypeDeriving #-}
module Oracles.Base (
module Base,
module Control.Applicative,
module Util,
askConfig, askConfigWithDefault, configOracle
) where
module Oracles.Config (askConfig, askConfigWithDefault, configOracle) where
import Base
import Util
import Control.Applicative hiding ((*>))
import qualified Data.HashMap.Strict as Map
newtype ConfigKey = ConfigKey String
......
module Oracles.Flag (
module Oracles.Config.Flag (
Flag (..), flag,
crossCompiling, gccIsClang, gccLt46,
platformSupportsSharedLibs, ghcWithSMP, ghcWithNativeCodeGen
) where
import Oracles.Base
import Oracles.Setting
import Base
import Util
import Oracles.Config
import Oracles.Config.Setting
data Flag = GccIsClang
| GccLt46
......
module Oracles.Setting (
module Oracles.Config.Setting (
Setting (..), SettingList (..),
setting, settingList,
targetPlatform, targetPlatforms, targetOs, targetOss, notTargetOs,
......@@ -6,8 +6,9 @@ module Oracles.Setting (
ghcEnableTablesNextToCode, cmdLineLengthLimit
) where
import Base
import Stage
import Oracles.Base
import Oracles.Config
-- Each Setting comes from the system.config file, e.g. 'target-os = mingw32'.
-- setting TargetOs looks up the config file and returns "mingw32".
......
......@@ -8,7 +8,6 @@ module Oracles.Dependencies (
import Base
import Util
import qualified Data.HashMap.Strict as Map
import Control.Applicative
newtype DependenciesKey = DependenciesKey (FilePath, FilePath)
deriving (Show, Typeable, Eq, Hashable, Binary, NFData)
......
......@@ -7,7 +7,6 @@ module Oracles.PackageData (
import Base
import Util
import Control.Applicative
import qualified Data.HashMap.Strict as Map
-- For each (PackageData path) the file 'path/package-data.mk' contains
......
......@@ -5,8 +5,9 @@ module Oracles.PackageDeps (
packageDepsOracle
) where
import Base
import Util
import Package
import Oracles.Base
import qualified Data.HashMap.Strict as Map
newtype PackageDepsKey = PackageDepsKey PackageName
......
......@@ -6,8 +6,7 @@ module Predicates (
import Base
import Expression
import Oracles.Flag
import Oracles.Setting
import Oracles
import Settings.Default
-- Basic predicates (see Switches.hs for derived predicates)
......
......@@ -6,7 +6,7 @@ import Target hiding (builder)
import qualified Target
import Builder
import Expression
import Oracles.Setting
import Oracles
import Oracles.ArgsHash
import Settings.Args
import Settings.User
......
module Rules.Oracles (oracleRules) where
import Base
import Oracles
import Oracles.ArgsHash
import Oracles.Base
import Oracles.Dependencies
import Oracles.PackageData
import Oracles.PackageDeps
import Oracles.WindowsRoot
import Settings.User
oracleRules :: Rules ()
oracleRules = do
configOracle -- see Oracles.Base
packageDataOracle -- see Oracles.PackageData
packageDepsOracle -- see Oracles.PackageDeps
dependenciesOracle -- see Oracles.Dependencies
when trackBuildSystem argsHashOracle -- see Oracles.ArgsHash
windowsRootOracle -- see Oracles.WindowsRoot
configOracle -- see Oracles.Config
packageDataOracle -- see Oracles.PackageData
packageDepsOracle -- see Oracles.PackageDeps
dependenciesOracle -- see Oracles.Dependencies
argsHashOracle -- see Oracles.ArgsHash
windowsRootOracle -- see Oracles.WindowsRoot
......@@ -3,8 +3,7 @@ module Settings.Builders.Ghc (ghcArgs, ghcMArgs, commonGhcArgs) where
import Util
import Expression
import Predicates (stagedBuilder, splitObjects, stage0)
import Oracles.Flag
import Oracles.PackageData
import Oracles
import Settings.Util
import Settings.Ways
......
......@@ -11,8 +11,7 @@ import Builder
import Package
import Expression
import Predicates
import Oracles.Flag
import Oracles.Setting
import Oracles
import Settings.User
import Settings.Ways
import Settings.Util
......
......@@ -2,8 +2,8 @@ module Settings.Builders.Ld (ldArgs) where
import Builder
import Expression
import Oracles
import Predicates (builder)
import Oracles.Setting
import Settings.Util
ldArgs :: Args
......
......@@ -6,7 +6,7 @@ module Settings.Packages (
import Package
import Expression
import Predicates
import Oracles.Setting
import Oracles
import Settings.User
import Settings.Default
......
......@@ -15,9 +15,7 @@ import Builder
import Package
import Expression
import Predicates
import Oracles.Flag
import Oracles.Setting
import Oracles.PackageData
import Oracles
import Settings.TargetDirectory
-- A single argument.
......
......@@ -4,7 +4,7 @@ import Way
import Stage
import Expression
import Predicates
import Oracles.Flag
import Oracles
import Settings.User
-- Combining default ways with user modifications
......
module Util (
module Control.Applicative,
module Control.Monad.Extra,
module Data.Char,
module Data.Function,
......@@ -14,6 +15,7 @@ module Util (
) where
import Base hiding (doesFileExist)
import Control.Applicative
import Control.Monad.Extra
import Data.Char
import Data.Function
......
......@@ -15,7 +15,7 @@ module Way (
import Base
import Data.IntSet (IntSet)
import qualified Data.IntSet as Set
import Oracles.Setting
import Oracles
import Util hiding (unit)
data WayUnit = Threaded
......
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