aboutsummaryrefslogtreecommitdiff
path: root/src/CabalHelper/Compiletime/Types.hs
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2019-08-06 02:41:02 +0200
committerDaniel Gröber (dxld) <dxld@darkboxed.org>2019-09-17 17:48:26 +0200
commitaad828c48f26ea6febaabf37632b0e45868db895 (patch)
tree365ecc552992717c4e42d651fed8e8aee876f88f /src/CabalHelper/Compiletime/Types.hs
parent25e12596dce80ce2cf3928bbe0b2eac339da8c96 (diff)
Add exported interface for running build-tools
Diffstat (limited to 'src/CabalHelper/Compiletime/Types.hs')
-rw-r--r--src/CabalHelper/Compiletime/Types.hs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/CabalHelper/Compiletime/Types.hs b/src/CabalHelper/Compiletime/Types.hs
index 619538c..d206cf0 100644
--- a/src/CabalHelper/Compiletime/Types.hs
+++ b/src/CabalHelper/Compiletime/Types.hs
@@ -269,7 +269,7 @@ type ReadProcessWithCwdAndEnv =
String -> CallProcessWithCwdAndEnv String
type CallProcessWithCwdAndEnv a =
- Maybe FilePath -> [(String, String)] -> FilePath -> [String] -> IO a
+ Maybe FilePath -> [(String, EnvOverride)] -> FilePath -> [String] -> IO a
data QueryCache pt = QueryCache
{ qcProjInfo :: !(Maybe (ProjInfo pt))
@@ -484,14 +484,14 @@ type Progs = (?progs :: Programs)
data Programs = Programs
{ cabalProgram :: !FilePath
-- ^ The path to the @cabal@ program.
- , cabalArgsBefore :: ![String]
- , cabalArgsAfter :: ![String]
+ , cabalProjArgs :: ![String]
+ , cabalUnitArgs :: ![String]
, stackProgram :: !FilePath
-- ^ The path to the @stack@ program.
- , stackArgsBefore :: ![String]
- , stackArgsAfter :: ![String]
- , stackEnv :: ![(String, String)]
+ , stackProjArgs :: ![String]
+ , stackUnitArgs :: ![String]
+ , stackEnv :: ![(String, EnvOverride)]
-- ^ TODO: Stack doesn't support passing the compiler as a
-- commandline option so we meddle with PATH instead. We should
-- patch that upstream.
@@ -509,6 +509,12 @@ data Programs = Programs
defaultPrograms :: Programs
defaultPrograms = Programs "cabal" [] [] "stack" [] [] [] "ghc" "ghc-pkg"
+data EnvOverride
+ = EnvPrepend String
+ | EnvAppend String
+ | EnvReplace String
+ deriving (Eq, Ord, Show, Read, Generic, Typeable)
+
data CompileOptions = CompileOptions
{ oVerbose :: Bool
, oCabalPkgDb :: Maybe PackageDbDir