Commit 322214cc authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Teach cabal exec the --builddir option.


Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 2ae93d3b
...@@ -2058,12 +2058,14 @@ instance Semigroup SandboxFlags where ...@@ -2058,12 +2058,14 @@ instance Semigroup SandboxFlags where
-- ------------------------------------------------------------ -- ------------------------------------------------------------
data ExecFlags = ExecFlags { data ExecFlags = ExecFlags {
execVerbosity :: Flag Verbosity execVerbosity :: Flag Verbosity,
execDistPref :: Flag FilePath
} deriving Generic } deriving Generic
defaultExecFlags :: ExecFlags defaultExecFlags :: ExecFlags
defaultExecFlags = ExecFlags { defaultExecFlags = ExecFlags {
execVerbosity = toFlag normal execVerbosity = toFlag normal,
execDistPref = NoFlag
} }
execCommand :: CommandUI ExecFlags execCommand :: CommandUI ExecFlags
...@@ -2104,9 +2106,12 @@ execCommand = CommandUI { ...@@ -2104,9 +2106,12 @@ execCommand = CommandUI {
"Usage: " ++ pname ++ " exec [FLAGS] [--] COMMAND [--] [ARGS]\n", "Usage: " ++ pname ++ " exec [FLAGS] [--] COMMAND [--] [ARGS]\n",
commandDefaultFlags = defaultExecFlags, commandDefaultFlags = defaultExecFlags,
commandOptions = \_ -> commandOptions = \showOrParseArgs ->
[ optionVerbosity execVerbosity [ optionVerbosity execVerbosity
(\v flags -> flags { execVerbosity = v }) (\v flags -> flags { execVerbosity = v })
, Cabal.optionDistPref
execDistPref (\d flags -> flags { execDistPref = d })
showOrParseArgs
] ]
} }
......
...@@ -1095,8 +1095,10 @@ execAction :: ExecFlags -> [String] -> Action ...@@ -1095,8 +1095,10 @@ execAction :: ExecFlags -> [String] -> Action
execAction execFlags extraArgs globalFlags = do execAction execFlags extraArgs globalFlags = do
let verbosity = fromFlag (execVerbosity execFlags) let verbosity = fromFlag (execVerbosity execFlags)
(useSandbox, config) <- loadConfigOrSandboxConfig verbosity globalFlags (useSandbox, config) <- loadConfigOrSandboxConfig verbosity globalFlags
distPref <- findSavedDistPref config (execDistPref execFlags)
let configFlags = savedConfigureFlags config let configFlags = savedConfigureFlags config
(comp, platform, progdb) <- getPersistOrConfigCompiler configFlags configFlags' = configFlags { configDistPref = Flag distPref }
(comp, platform, progdb) <- getPersistOrConfigCompiler configFlags'
exec verbosity useSandbox comp platform progdb extraArgs exec verbosity useSandbox comp platform progdb extraArgs
userConfigAction :: UserConfigFlags -> [String] -> Action userConfigAction :: UserConfigFlags -> [String] -> Action
......
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