aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2020-05-01 23:13:48 +0200
committerDaniel Gröber <dxld@darkboxed.org>2020-05-02 15:44:26 +0200
commit5b85a4b9e1c6463c94ffa595893ad02c9a3d2ec3 (patch)
tree5a1e715378d7da40d6adc3954efc0c556a11a5a8
parent852dbc69d276e19add3917d17dff5541d84e29d4 (diff)
Only pass pjUnits to compile module instead of whole PlanJson
-rw-r--r--lib/Distribution/Helper.hs7
-rw-r--r--src/CabalHelper/Compiletime/Compile.hs9
-rw-r--r--tests/CompileTest.hs2
3 files changed, 9 insertions, 9 deletions
diff --git a/lib/Distribution/Helper.hs b/lib/Distribution/Helper.hs
index 84c1c30..f8adcc4 100644
--- a/lib/Distribution/Helper.hs
+++ b/lib/Distribution/Helper.hs
@@ -840,7 +840,7 @@ mkCompHelperEnv
, cheProjDir = plCabalProjectDir projloc
, cheProjLocalCacheDir = distdir
, chePkgDb = []
- , chePlanJson = Nothing
+ , chePjUnits = Nothing
, cheDistV2 = Nothing
}
mkCompHelperEnv
@@ -855,9 +855,8 @@ mkCompHelperEnv
cheCabalVer = cabal_ver
cheProjLocalCacheDir = distdir </> "cache"
chePkgDb = []
- chePlanJson = Just plan
+ chePjUnits = Just $ pjUnits plan
cheDistV2 = Just distdir
- PlanJson {pjCabalLibVersion=Ver pjCabalLibVersion } = plan
mkCompHelperEnv
(ProjLocStackYaml stack_yaml)
(DistDirStack mworkdir)
@@ -874,6 +873,6 @@ mkCompHelperEnv
, cheProjDir = projdir
, cheProjLocalCacheDir = projdir </> workdir
, chePkgDb = [sppGlobalPkgDb, sppSnapPkgDb, sppLocalPkgDb]
- , chePlanJson = Nothing
+ , chePjUnits = Nothing
, cheDistV2 = Nothing
}
diff --git a/src/CabalHelper/Compiletime/Compile.hs b/src/CabalHelper/Compiletime/Compile.hs
index 4c92fba..e468c1b 100644
--- a/src/CabalHelper/Compiletime/Compile.hs
+++ b/src/CabalHelper/Compiletime/Compile.hs
@@ -21,7 +21,7 @@ module CabalHelper.Compiletime.Compile where
import qualified Cabal.Plan as CP
import Cabal.Plan
- ( PlanJson(..), PkgId(..), PkgName(..), Ver(..), uPId)
+ ( PkgId(..), PkgName(..), Ver(..), uPId)
import Control.Applicative
import Control.Arrow
import Control.Exception as E
@@ -30,6 +30,7 @@ import Control.Monad.Trans.Maybe
import Control.Monad.IO.Class
import Data.Char
import Data.List
+import Data.Map.Strict (Map)
import Data.Maybe
import Data.String
import Data.Version
@@ -94,7 +95,7 @@ data CompHelperEnv' cv = CompHelperEnv
, chePkgDb :: ![PackageDbDir]
-- ^ A package-db where we are guaranteed to find Cabal-`cheCabalVer`.
, cheProjDir :: !FilePath
- , chePlanJson :: !(Maybe PlanJson)
+ , chePjUnits :: !(Maybe (Map CP.UnitId CP.Unit))
, cheDistV2 :: !(Maybe FilePath)
, cheProjLocalCacheDir :: FilePath
}
@@ -185,8 +186,8 @@ compileHelper' CompHelperEnv {..} = do
compileWithCabalV2Inplace ghcVer cabalVer = do
-- TODO: Test coverage! Neither compile-test nor ghc-session test out
-- this code path
- PlanJson {pjUnits} <- maybe mzero pure chePlanJson
- distdir_newstyle <- maybe mzero pure cheDistV2
+ pjUnits <- maybe mzero pure chePjUnits
+ distdir_newstyle <- maybe mzero pure cheDistV2
let cabal_pkgid =
PkgId (PkgName (Text.pack "Cabal")) (Ver $ versionBranch cabalVer)
mcabal_unit = listToMaybe $
diff --git a/tests/CompileTest.hs b/tests/CompileTest.hs
index e77e3de..c0280bf 100644
--- a/tests/CompileTest.hs
+++ b/tests/CompileTest.hs
@@ -142,7 +142,7 @@ testCabalVersions versions = do
{ cheCabalVer = icv
, chePkgDb = db
, cheProjDir = tmpdir
- , chePlanJson = Nothing
+ , chePjUnits = Nothing
, cheDistV2 = Just $ tmpdir </> "dist-newstyle"
, cheProjLocalCacheDir =
tmpdir </> "dist-newstyle" </> "cache"