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