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

Add configFile to Base, track building ./settings

See #200.
parent 1329a948
......@@ -16,7 +16,7 @@ module Base (
module Development.Shake.FilePath,
-- * Paths
shakeFilesPath, configPath, sourcePath, programInplacePath,
shakeFilesPath, configPath, configFile, sourcePath, programInplacePath,
bootPackageConstraints, packageDependencies,
-- * Output
......@@ -54,6 +54,9 @@ shakeFilesPath = shakePath -/- ".db"
configPath :: FilePath
configPath = shakePath -/- "cfg"
configFile :: FilePath
configFile = configPath -/- "system.config"
-- | Path to source files of the build system, e.g. this file is located at
-- sourcePath -/- "Base.hs". We use this to `need` some of the source files.
sourcePath :: FilePath
......
......@@ -8,9 +8,6 @@ import Development.Shake.Config
newtype ConfigKey = ConfigKey String
deriving (Show, Typeable, Eq, Hashable, Binary, NFData)
configFile :: FilePath
configFile = configPath -/- "system.config"
askConfig :: String -> Action String
askConfig key = askConfigWithDefault key . putError
$ "Cannot find key '" ++ key ++ "' in configuration files."
......
......@@ -8,12 +8,14 @@ configRules :: Rules ()
configRules = do
-- We always rerun the configure script in this mode, because the flags
-- passed to it can affect the contents of system.config file.
configPath -/- "system.config" %> \out -> do
[configFile, "settings"] &%> \[cfg, settings] -> do
alwaysRerun
case cmdConfigure of
RunConfigure args -> runConfigure "." [] [args]
SkipConfigure -> unlessM (doesFileExist out) $
putError $ "Configuration file " ++ out ++ " is missing.\n"
RunConfigure args -> do
need [ settings <.> "in" ]
runConfigure "." [] [args]
SkipConfigure -> unlessM (doesFileExist cfg) $
putError $ "Configuration file " ++ cfg ++ " is missing.\n"
++ "Run the configure script either manually or via the "
++ "build system by passing --configure[=ARGS] flag."
......
Supports Markdown
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