aboutsummaryrefslogtreecommitdiff
path: root/src/CabalHelper/Compiletime/Compile.hs
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2020-01-11 07:46:33 +0100
committerDaniel Gröber <dxld@darkboxed.org>2020-05-02 15:44:26 +0200
commit852dbc69d276e19add3917d17dff5541d84e29d4 (patch)
treeb01a16ee9a03fb491dfdf50a7bc717b76e95d445 /src/CabalHelper/Compiletime/Compile.hs
parentf0741c61bd82ec0f94edcfa8d950f349eac86c33 (diff)
Fix Cabal version selection for build-type:Custom
Previously we would pick up Stack's Cabal version with ghc-pkg on the global package-db. This however ignores that Stack also supports custom Setup.hs with the Cabal version from the snapshot instead. In cabal v2-build we have a similar problem. We used to assume that plan.json's cabal-lib-version is used uniformly across units but this is similarly untrue. To fix both of these we re-stage the cabal version query to after reconfiguring a unit, then we can just lookup the Cabal version in setup-config. Fixes #95
Diffstat (limited to 'src/CabalHelper/Compiletime/Compile.hs')
-rw-r--r--src/CabalHelper/Compiletime/Compile.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/CabalHelper/Compiletime/Compile.hs b/src/CabalHelper/Compiletime/Compile.hs
index 2993906..4c92fba 100644
--- a/src/CabalHelper/Compiletime/Compile.hs
+++ b/src/CabalHelper/Compiletime/Compile.hs
@@ -91,7 +91,7 @@ data CompilationProductScope = CPSGlobal | CPSProject
type CompHelperEnv = CompHelperEnv' CabalVersion
data CompHelperEnv' cv = CompHelperEnv
{ cheCabalVer :: !cv
- , chePkgDb :: !(Maybe PackageDbDir)
+ , chePkgDb :: ![PackageDbDir]
-- ^ A package-db where we are guaranteed to find Cabal-`cheCabalVer`.
, cheProjDir :: !FilePath
, chePlanJson :: !(Maybe PlanJson)
@@ -120,7 +120,7 @@ compileHelper' CompHelperEnv {..} = do
CabalVersion cabalVerPlain -> do
runMaybeT $ msum $ map (\f -> f ghcVer cabalVerPlain) $
case chePkgDb of
- Nothing ->
+ [] ->
[ compileWithCabalV2Inplace
, compileWithCabalV2GhcEnv
, compileCabalSource
@@ -128,8 +128,8 @@ compileHelper' CompHelperEnv {..} = do
, compileGlobal
, compileWithCabalInPrivatePkgDb
]
- Just db ->
- [ ((.).(.)) liftIO (compilePkgDb db)
+ dbs ->
+ [ ((.).(.)) liftIO (compilePkgDbs dbs)
]
appdir <- appCacheDir
let cp@CompPaths {compExePath} = compPaths appdir cheProjLocalCacheDir comp
@@ -149,11 +149,11 @@ compileHelper' CompHelperEnv {..} = do
-- for relaxed deps: find (sameMajorVersionAs cheCabalVer) . reverse . sort
- compilePkgDb db _ghcVer cabalVer = return $
+ compilePkgDbs dbs _ghcVer cabalVer = return $
(,)
(pure ())
CompileWithCabalPackage
- { compPackageSource = GPSPackageDBs [db]
+ { compPackageSource = GPSPackageDBs dbs
, compCabalVersion = CabalVersion cabalVer
, compProductTarget = CPSProject
}