Commit a55f53d2 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov

s/progConf/progDb/

parent 9e307529
......@@ -44,7 +44,7 @@ import System.IO
createArLibArchive :: Verbosity -> LocalBuildInfo
-> FilePath -> [FilePath] -> IO ()
createArLibArchive verbosity lbi targetPath files = do
(ar, _) <- requireProgram verbosity arProgram progConf
(ar, _) <- requireProgram verbosity arProgram progDb
let (targetDir, targetName) = splitFileName targetPath
withTempDirectory verbosity targetDir "objs" $ \ tmpDir -> do
......@@ -92,7 +92,7 @@ createArLibArchive verbosity lbi targetPath files = do
unless equal $ renameFile tmpPath targetPath
where
progConf = withPrograms lbi
progDb = withPrograms lbi
Platform hostArch hostOS = hostPlatform lbi
verbosityOpts v | v >= deafening = ["-v"]
| v >= verbose = []
......
......@@ -22,8 +22,8 @@ import Distribution.Version
import System.FilePath (takeBaseName)
runStrip :: Verbosity -> ProgramDb -> FilePath -> [String] -> IO ()
runStrip verbosity progConf path args =
case lookupProgram stripProgram progConf of
runStrip verbosity progDb path args =
case lookupProgram stripProgram progDb of
Just strip -> runProgram verbosity strip (path:args)
Nothing -> unless (buildOS == Windows) $
-- Don't bother warning on windows, we don't expect them to
......
......@@ -439,9 +439,9 @@ configAbsolutePaths f =
(configPackageDBs f)
defaultConfigFlags :: ProgramDb -> ConfigFlags
defaultConfigFlags progConf = emptyConfigFlags {
defaultConfigFlags progDb = emptyConfigFlags {
configArgs = [],
configPrograms_ = pure progConf,
configPrograms_ = pure progDb,
configHcFlavor = maybe NoFlag Flag defaultCompilerFlavor,
configVanillaLib = Flag True,
configProfLib = NoFlag,
......@@ -479,7 +479,7 @@ defaultConfigFlags progConf = emptyConfigFlags {
}
configureCommand :: ProgramDb -> CommandUI ConfigFlags
configureCommand progConf = CommandUI
configureCommand progDb = CommandUI
{ commandName = "configure"
, commandSynopsis = "Prepare to build the package."
, commandDescription = Just $ \_ -> wrapText $
......@@ -488,17 +488,17 @@ configureCommand progConf = CommandUI
++ "\n"
++ "The configuration affects several other commands, "
++ "including build, test, bench, run, repl.\n"
, commandNotes = Just $ \_pname -> programFlagsDescription progConf
, commandNotes = Just $ \_pname -> programFlagsDescription progDb
, commandUsage = \pname ->
"Usage: " ++ pname ++ " configure [FLAGS]\n"
, commandDefaultFlags = defaultConfigFlags progConf
, commandDefaultFlags = defaultConfigFlags progDb
, commandOptions = \showOrParseArgs ->
configureOptions showOrParseArgs
++ programConfigurationPaths progConf showOrParseArgs
++ programConfigurationPaths progDb showOrParseArgs
configProgramPaths (\v fs -> fs { configProgramPaths = v })
++ programConfigurationOption progConf showOrParseArgs
++ programConfigurationOption progDb showOrParseArgs
configProgramArgs (\v fs -> fs { configProgramArgs = v })
++ programConfigurationOptions progConf showOrParseArgs
++ programConfigurationOptions progDb showOrParseArgs
configProgramArgs (\v fs -> fs { configProgramArgs = v })
}
......@@ -1367,15 +1367,15 @@ haddockCommand = CommandUI
, commandDefaultFlags = defaultHaddockFlags
, commandOptions = \showOrParseArgs ->
haddockOptions showOrParseArgs
++ programConfigurationPaths progConf ParseArgs
++ programConfigurationPaths progDb ParseArgs
haddockProgramPaths (\v flags -> flags { haddockProgramPaths = v})
++ programConfigurationOption progConf showOrParseArgs
++ programConfigurationOption progDb showOrParseArgs
haddockProgramArgs (\v fs -> fs { haddockProgramArgs = v })
++ programConfigurationOptions progConf ParseArgs
++ programConfigurationOptions progDb ParseArgs
haddockProgramArgs (\v flags -> flags { haddockProgramArgs = v})
}
where
progConf = addKnownProgram haddockProgram
progDb = addKnownProgram haddockProgram
$ addKnownProgram ghcProgram
$ emptyProgramDb
......@@ -1561,7 +1561,7 @@ defaultBuildFlags = BuildFlags {
}
buildCommand :: ProgramDb -> CommandUI BuildFlags
buildCommand progConf = CommandUI
buildCommand progDb = CommandUI
{ commandName = "build"
, commandSynopsis = "Compile all/specific components."
, commandDescription = Just $ \_ -> wrapText $
......@@ -1574,7 +1574,7 @@ buildCommand progConf = CommandUI
++ " All the components in the package\n"
++ " " ++ pname ++ " build foo "
++ " A component (i.e. lib, exe, test suite)\n\n"
++ programFlagsDescription progConf
++ programFlagsDescription progDb
--TODO: re-enable once we have support for module/file targets
-- ++ " " ++ pname ++ " build Foo.Bar "
-- ++ " A module\n"
......@@ -1596,12 +1596,12 @@ buildCommand progConf = CommandUI
, optionDistPref
buildDistPref (\d flags -> flags { buildDistPref = d }) showOrParseArgs
]
++ buildOptions progConf showOrParseArgs
++ buildOptions progDb showOrParseArgs
}
buildOptions :: ProgramDb -> ShowOrParseArgs
-> [OptionField BuildFlags]
buildOptions progConf showOrParseArgs =
buildOptions progDb showOrParseArgs =
[ optionNumJobs
buildNumJobs (\v flags -> flags { buildNumJobs = v })
......@@ -1611,13 +1611,13 @@ buildOptions progConf showOrParseArgs =
trueArg
]
++ programConfigurationPaths progConf showOrParseArgs
++ programConfigurationPaths progDb showOrParseArgs
buildProgramPaths (\v flags -> flags { buildProgramPaths = v})
++ programConfigurationOption progConf showOrParseArgs
++ programConfigurationOption progDb showOrParseArgs
buildProgramArgs (\v fs -> fs { buildProgramArgs = v })
++ programConfigurationOptions progConf showOrParseArgs
++ programConfigurationOptions progDb showOrParseArgs
buildProgramArgs (\v flags -> flags { buildProgramArgs = v})
emptyBuildFlags :: BuildFlags
......@@ -1660,7 +1660,7 @@ instance Semigroup ReplFlags where
(<>) = gmappend
replCommand :: ProgramDb -> CommandUI ReplFlags
replCommand progConf = CommandUI
replCommand progDb = CommandUI
{ commandName = "repl"
, commandSynopsis =
"Open an interpreter session for the given component."
......@@ -1708,13 +1708,13 @@ replCommand progConf = CommandUI
replDistPref (\d flags -> flags { replDistPref = d })
showOrParseArgs
: programConfigurationPaths progConf showOrParseArgs
: programConfigurationPaths progDb showOrParseArgs
replProgramPaths (\v flags -> flags { replProgramPaths = v})
++ programConfigurationOption progConf showOrParseArgs
++ programConfigurationOption progDb showOrParseArgs
replProgramArgs (\v flags -> flags { replProgramArgs = v})
++ programConfigurationOptions progConf showOrParseArgs
++ programConfigurationOptions progDb showOrParseArgs
replProgramArgs (\v flags -> flags { replProgramArgs = v})
++ case showOrParseArgs of
......@@ -1941,14 +1941,14 @@ instance Semigroup BenchmarkFlags where
-- ------------------------------------------------------------
programFlagsDescription :: ProgramDb -> String
programFlagsDescription progConf =
programFlagsDescription progDb =
"The flags --with-PROG and --PROG-option(s) can be used with"
++ " the following programs:"
++ (concatMap (\line -> "\n " ++ unwords line) . wrapLine 77 . sort)
[ programName prog | (prog, _) <- knownPrograms progConf ]
[ programName prog | (prog, _) <- knownPrograms progDb ]
++ "\n"
-- | For each known program @PROG@ in 'progConf', produce a @with-PROG@
-- | For each known program @PROG@ in 'progDb', produce a @with-PROG@
-- 'OptionField'.
programConfigurationPaths
:: ProgramDb
......@@ -1956,8 +1956,8 @@ programConfigurationPaths
-> (flags -> [(String, FilePath)])
-> ([(String, FilePath)] -> (flags -> flags))
-> [OptionField flags]
programConfigurationPaths progConf showOrParseArgs get set =
programConfigurationPaths' ("with-" ++) progConf showOrParseArgs get set
programConfigurationPaths progDb showOrParseArgs get set =
programConfigurationPaths' ("with-" ++) progDb showOrParseArgs get set
-- | Like 'programConfigurationPaths', but allows to customise the option name.
programConfigurationPaths'
......@@ -1967,12 +1967,12 @@ programConfigurationPaths'
-> (flags -> [(String, FilePath)])
-> ([(String, FilePath)] -> (flags -> flags))
-> [OptionField flags]
programConfigurationPaths' mkName progConf showOrParseArgs get set =
programConfigurationPaths' mkName progDb showOrParseArgs get set =
case showOrParseArgs of
-- we don't want a verbose help text list so we just show a generic one:
ShowArgs -> [withProgramPath "PROG"]
ParseArgs -> map (withProgramPath . programName . fst)
(knownPrograms progConf)
(knownPrograms progDb)
where
withProgramPath prog =
option "" [mkName prog]
......@@ -1981,7 +1981,7 @@ programConfigurationPaths' mkName progConf showOrParseArgs get set =
(reqArg' "PATH" (\path -> [(prog, path)])
(\progPaths -> [ path | (prog', path) <- progPaths, prog==prog' ]))
-- | For each known program @PROG@ in 'progConf', produce a @PROG-option@
-- | For each known program @PROG@ in 'progDb', produce a @PROG-option@
-- 'OptionField'.
programConfigurationOption
:: ProgramDb
......@@ -1989,12 +1989,12 @@ programConfigurationOption
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> (flags -> flags))
-> [OptionField flags]
programConfigurationOption progConf showOrParseArgs get set =
programConfigurationOption progDb showOrParseArgs get set =
case showOrParseArgs of
-- we don't want a verbose help text list so we just show a generic one:
ShowArgs -> [programOption "PROG"]
ParseArgs -> map (programOption . programName . fst)
(knownPrograms progConf)
(knownPrograms progDb)
where
programOption prog =
option "" [prog ++ "-option"]
......@@ -2005,7 +2005,7 @@ programConfigurationOption progConf showOrParseArgs get set =
(\progArgs -> concat [ args
| (prog', args) <- progArgs, prog==prog' ]))
-- | For each known program @PROG@ in 'progConf', produce a @PROG-options@
-- | For each known program @PROG@ in 'progDb', produce a @PROG-options@
-- 'OptionField'.
programConfigurationOptions
:: ProgramDb
......@@ -2013,12 +2013,12 @@ programConfigurationOptions
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> (flags -> flags))
-> [OptionField flags]
programConfigurationOptions progConf showOrParseArgs get set =
programConfigurationOptions progDb showOrParseArgs get set =
case showOrParseArgs of
-- we don't want a verbose help text list so we just show a generic one:
ShowArgs -> [programOptions "PROG"]
ParseArgs -> map (programOptions . programName . fst)
(knownPrograms progConf)
(knownPrograms progDb)
where
programOptions prog =
option "" [prog ++ "-options"]
......
......@@ -13,7 +13,8 @@ import PackageTests.Tests
import Distribution.Simple.Configure
( ConfigStateFileError(..), findDistPrefOrDefault, getConfigStateFile
, interpretPackageDbFlags, configCompilerEx )
import Distribution.Simple.Compiler (PackageDB(..), PackageDBStack, CompilerFlavor(GHC))
import Distribution.Simple.Compiler (PackageDB(..), PackageDBStack
,CompilerFlavor(GHC))
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..))
import Distribution.Simple.Program (defaultProgramDb)
import Distribution.Simple.Setup (Flag(..), readPackageDbList, showPackageDbList)
......
......@@ -1157,7 +1157,7 @@ programLocationsSectionDescr =
}
-- | For each known program @PROG@ in 'progConf', produce a @PROG-options@
-- | For each known program @PROG@ in 'progDb', produce a @PROG-options@
-- 'OptionField'.
programConfigurationOptions
:: ProgramDb
......@@ -1165,12 +1165,12 @@ programConfigurationOptions
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> (flags -> flags))
-> [OptionField flags]
programConfigurationOptions progConf showOrParseArgs get set =
programConfigurationOptions progDb showOrParseArgs get set =
case showOrParseArgs of
-- we don't want a verbose help text list so we just show a generic one:
ShowArgs -> [programOptions "PROG"]
ParseArgs -> map (programOptions . programName . fst)
(knownPrograms progConf)
(knownPrograms progDb)
where
programOptions prog =
option "" [prog ++ "-options"]
......
......@@ -559,7 +559,7 @@ testCommand = parent {
(commandOptions parent showOrParseArgs)
++
liftOptions get2 set2
(Cabal.buildOptions progConf showOrParseArgs)
(Cabal.buildOptions progDb showOrParseArgs)
++
liftOptions get3 set3 (buildExOptions showOrParseArgs)
}
......@@ -568,8 +568,8 @@ testCommand = parent {
get2 (_,b,_) = b; set2 b (a,_,c) = (a,b,c)
get3 (_,_,c) = c; set3 c (a,b,_) = (a,b,c)
parent = Cabal.testCommand
progConf = defaultProgramDb
parent = Cabal.testCommand
progDb = defaultProgramDb
-- ------------------------------------------------------------
-- * Bench command
......@@ -584,7 +584,7 @@ benchmarkCommand = parent {
(commandOptions parent showOrParseArgs)
++
liftOptions get2 set2
(Cabal.buildOptions progConf showOrParseArgs)
(Cabal.buildOptions progDb showOrParseArgs)
++
liftOptions get3 set3 (buildExOptions showOrParseArgs)
}
......@@ -593,8 +593,8 @@ benchmarkCommand = parent {
get2 (_,b,_) = b; set2 b (a,_,c) = (a,b,c)
get3 (_,_,c) = c; set3 c (a,b,_) = (a,b,c)
parent = Cabal.benchmarkCommand
progConf = defaultProgramDb
parent = Cabal.benchmarkCommand
progDb = defaultProgramDb
-- ------------------------------------------------------------
-- * Fetch command
......
......@@ -380,9 +380,9 @@ buildAction (buildFlags, buildExFlags) extraArgs globalFlags = do
build :: Verbosity -> SavedConfig -> FilePath -> BuildFlags -> [String] -> IO ()
build verbosity config distPref buildFlags extraArgs =
setupWrapper verbosity setupOptions Nothing
(Cabal.buildCommand progConf) mkBuildFlags extraArgs
(Cabal.buildCommand progDb) mkBuildFlags extraArgs
where
progConf = defaultProgramDb
progDb = defaultProgramDb
setupOptions = defaultSetupScriptOptions { useDistPref = distPref }
mkBuildFlags version = filterBuildFlags version config buildFlags'
......@@ -432,7 +432,7 @@ replAction (replFlags, buildExFlags) extraArgs globalFlags = do
reconfigure verbosity (replDistPref replFlags)
mempty [] globalFlags noAddSource NoFlag
(const Nothing)
let progConf = defaultProgramDb
let progDb = defaultProgramDb
setupOptions = defaultSetupScriptOptions
{ useCabalVersion = orLaterVersion $ Version [1,18,0] []
, useDistPref = distPref
......@@ -444,7 +444,7 @@ replAction (replFlags, buildExFlags) extraArgs globalFlags = do
maybeWithSandboxDirOnSearchPath useSandbox $
setupWrapper verbosity setupOptions Nothing
(Cabal.replCommand progConf) (const replFlags') extraArgs
(Cabal.replCommand progDb) (const replFlags') extraArgs
-- No .cabal file in the current directory: just start the REPL (possibly
-- using the sandbox package DB).
......
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