diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2019-08-04 21:14:45 +0200 |
---|---|---|
committer | Daniel Gröber (dxld) <dxld@darkboxed.org> | 2019-09-17 17:48:26 +0200 |
commit | 23864c59abfc6dad5a6b137941d618903817e1e3 (patch) | |
tree | 7a7394017e8ec0595acb8bb0a5ec3201b8bbaf47 /src/CabalHelper/Compiletime/Types.hs | |
parent | a93ed8c7d93df1860d2e56b400b724ac47edf470 (diff) |
Allow passing override-env to process functions
Unfortunately we need this to pass a custom GHC executable path to stack,
since it doesn't have an option to override it on the commandline (yet?).
Diffstat (limited to 'src/CabalHelper/Compiletime/Types.hs')
-rw-r--r-- | src/CabalHelper/Compiletime/Types.hs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/CabalHelper/Compiletime/Types.hs b/src/CabalHelper/Compiletime/Types.hs index 1f3bd3d..330fdbc 100644 --- a/src/CabalHelper/Compiletime/Types.hs +++ b/src/CabalHelper/Compiletime/Types.hs @@ -231,12 +231,12 @@ data Ex a = forall x. Ex (a x) type QueryEnv = QueryEnvI QueryCache data QueryEnvI c (pt :: ProjType) = QueryEnv - { qeReadProcess :: !ReadProcessWithCwd + { qeReadProcess :: !ReadProcessWithCwdAndEnv -- ^ Field accessor for 'QueryEnv'. Function used to to start -- processes. Useful if you need to, for example, redirect standard error -- output of programs started by cabal-helper. - , qeCallProcess :: !(CallProcessWithCwd ()) + , qeCallProcess :: !(CallProcessWithCwdAndEnv ()) , qePrograms :: !Programs -- ^ Field accessor for 'QueryEnv'. @@ -255,8 +255,11 @@ data QueryEnvI c (pt :: ProjType) = QueryEnv -- 'QueryEnv' is used. } -type ReadProcessWithCwd = String -> CallProcessWithCwd String -type CallProcessWithCwd a = Maybe FilePath -> FilePath -> [String] -> IO a +type ReadProcessWithCwdAndEnv = + String -> CallProcessWithCwdAndEnv String + +type CallProcessWithCwdAndEnv a = + Maybe FilePath -> [(String, String)] -> FilePath -> [String] -> IO a data QueryCache pt = QueryCache { qcProjInfo :: !(Maybe (ProjInfo pt)) @@ -472,6 +475,10 @@ data Programs = Programs -- ^ The path to the @stack@ program. , stackArgsBefore :: ![String] , stackArgsAfter :: ![String] + , stackEnv :: ![(String, String)] + -- ^ TODO: Stack doesn't support passing the compiler as a + -- commandline option so we meddle with PATH instead. We should + -- patch that upstream. , ghcProgram :: !FilePath -- ^ The path to the @ghc@ program. @@ -484,7 +491,7 @@ data Programs = Programs -- | By default all programs use their unqualified names, i.e. they will be -- searched for on @PATH@. defaultPrograms :: Programs -defaultPrograms = Programs "cabal" [] [] "stack" [] [] "ghc" "ghc-pkg" +defaultPrograms = Programs "cabal" [] [] "stack" [] [] [] "ghc" "ghc-pkg" data CompileOptions = CompileOptions { oVerbose :: Bool |