Skip to content

Commit 9292bda

Browse files
committed
move elabInstantiatedWith and elabLinkedInstantiatedWith from ElaboratedConfiguredPackage to
ElaboratedComponent
1 parent 3e56dea commit 9292bda

File tree

3 files changed

+19
-22
lines changed

3 files changed

+19
-22
lines changed

cabal-install/src/Distribution/Client/ProjectOrchestration.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -987,25 +987,25 @@ printPlan
987987
, case elabPkgOrComp elab of
988988
ElabPackage pkg -> showTargets elab ++ ifVerbose (showStanzas (pkgStanzasEnabled pkg))
989989
ElabComponent comp ->
990-
"(" ++ showComp elab comp ++ ")"
990+
"(" ++ showComp comp ++ ")"
991991
, showFlagAssignment (nonDefaultFlags elab)
992992
, showConfigureFlags elab
993993
, let buildStatus = pkgsBuildStatus Map.! installedUnitId elab
994994
in "(" ++ showBuildStatus buildStatus ++ ")"
995995
]
996996

997-
showComp :: ElaboratedConfiguredPackage -> ElaboratedComponent -> String
998-
showComp elab comp =
997+
showComp :: ElaboratedComponent -> String
998+
showComp comp =
999999
maybe "custom" prettyShow (compComponentName comp)
1000-
++ if Map.null (elabInstantiatedWith elab)
1000+
++ if Map.null (compInstantiatedWith comp)
10011001
then ""
10021002
else
10031003
" with "
10041004
++ intercalate
10051005
", "
10061006
-- TODO: Abbreviate the UnitIds
10071007
[ prettyShow k ++ "=" ++ prettyShow v
1008-
| (k, v) <- Map.toList (elabInstantiatedWith elab)
1008+
| (k, v) <- Map.toList (compInstantiatedWith comp)
10091009
]
10101010

10111011
nonDefaultFlags :: ElaboratedConfiguredPackage -> FlagAssignment

cabal-install/src/Distribution/Client/ProjectPlanning.hs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,6 @@ elaborateInstallPlan
17281728
{ elabModuleShape = emptyModuleShape
17291729
, elabUnitId = notImpl "elabUnitId"
17301730
, elabComponentId = notImpl "elabComponentId"
1731-
, elabLinkedInstantiatedWith = Map.empty
17321731
, elabInstallDirs = notImpl "elabInstallDirs"
17331732
, elabPkgOrComp = ElabComponent (ElaboratedComponent{..})
17341733
}
@@ -1747,14 +1746,11 @@ elaborateInstallPlan
17471746
compOrderLibDependencies = notImpl "compOrderLibDependencies"
17481747

17491748
-- Not supported:
1750-
compExeDependencies :: [a]
17511749
compExeDependencies = []
1752-
1753-
compExeDependencyPaths :: [a]
17541750
compExeDependencyPaths = []
1755-
1756-
compPkgConfigDependencies :: [a]
1757-
compPkgConfigDependencies = []
1751+
compPkgConfigDependencies = []
1752+
compInstantiatedWith = mempty
1753+
compLinkedInstantiatedWith = Map.empty
17581754

17591755
notImpl f =
17601756
error $
@@ -1812,6 +1808,8 @@ elaborateInstallPlan
18121808
, Just paths <- [Map.lookup (ann_id aid') exe_map1]
18131809
, path <- paths
18141810
]
1811+
compInstantiatedWith = Map.empty
1812+
compLinkedInstantiatedWith = Map.empty
18151813
elab_comp = ElaboratedComponent{..}
18161814

18171815
-- 3. Construct a preliminary ElaboratedConfiguredPackage,
@@ -1867,7 +1865,6 @@ elaborateInstallPlan
18671865
{ elabModuleShape = lc_shape lc
18681866
, elabUnitId = abstractUnitId (lc_uid lc)
18691867
, elabComponentId = lc_cid lc
1870-
, elabLinkedInstantiatedWith = Map.fromList (lc_insts lc)
18711868
, elabPkgOrComp =
18721869
ElabComponent $
18731870
elab_comp
@@ -1878,6 +1875,7 @@ elaborateInstallPlan
18781875
(abstractUnitId . ci_id)
18791876
(lc_includes lc ++ lc_sig_includes lc)
18801877
)
1878+
, compLinkedInstantiatedWith = Map.fromList (lc_insts lc)
18811879
}
18821880
}
18831881
elab =
@@ -2031,7 +2029,6 @@ elaborateInstallPlan
20312029
elab0
20322030
{ elabUnitId = newSimpleUnitId pkgInstalledId
20332031
, elabComponentId = pkgInstalledId
2034-
, elabLinkedInstantiatedWith = Map.empty
20352032
, elabPkgOrComp = ElabPackage $ ElaboratedPackage{..}
20362033
, elabModuleShape = modShape
20372034
}
@@ -2128,8 +2125,6 @@ elaborateInstallPlan
21282125
-- These get filled in later
21292126
elabUnitId = error "elaborateSolverToCommon: elabUnitId"
21302127
elabComponentId = error "elaborateSolverToCommon: elabComponentId"
2131-
elabInstantiatedWith = Map.empty
2132-
elabLinkedInstantiatedWith = error "elaborateSolverToCommon: elabLinkedInstantiatedWith"
21332128
elabPkgOrComp = error "elaborateSolverToCommon: elabPkgOrComp"
21342129
elabInstallDirs = error "elaborateSolverToCommon: elabInstallDirs"
21352130
elabModuleShape = error "elaborateSolverToCommon: elabModuleShape"
@@ -2733,7 +2728,6 @@ instantiateInstallPlan storeDirLayout defaultInstallDirs elaboratedShared plan =
27332728
elab0
27342729
{ elabUnitId = uid
27352730
, elabComponentId = cid
2736-
, elabInstantiatedWith = fmap fst insts
27372731
, elabIsCanonical = Map.null (fmap fst insts)
27382732
, elabPkgOrComp =
27392733
ElabComponent
@@ -2745,6 +2739,7 @@ instantiateInstallPlan storeDirLayout defaultInstallDirs elaboratedShared plan =
27452739
unDefUnitId
27462740
(deps ++ concatMap (getDep . fst) (Map.elems insts))
27472741
)
2742+
, compInstantiatedWith = fmap fst insts
27482743
}
27492744
}
27502745
elab =
@@ -2856,8 +2851,8 @@ instantiateInstallPlan storeDirLayout defaultInstallDirs elaboratedShared plan =
28562851

28572852
work = for_ pkgs $ \pkg ->
28582853
case pkg of
2859-
InstallPlan.Configured elab
2860-
| not (Map.null (elabLinkedInstantiatedWith elab)) ->
2854+
InstallPlan.Configured (elab@ElaboratedConfiguredPackage{elabPkgOrComp=ElabComponent comp})
2855+
| not (Map.null (compLinkedInstantiatedWith comp)) ->
28612856
indefiniteUnitId (elabComponentId elab)
28622857
>> return ()
28632858
_ ->
@@ -3939,7 +3934,9 @@ setupHsConfigureFlags
39393934
configProfExe = mempty
39403935
configProf = toFlag $ LBC.withProfExe elabBuildOptions
39413936

3942-
configInstantiateWith = Map.toList elabInstantiatedWith
3937+
configInstantiateWith = case elabPkgOrComp of
3938+
ElabPackage _ -> mempty
3939+
ElabComponent comp -> Map.toList (compInstantiatedWith comp)
39433940

39443941
configDeterministic = mempty -- doesn't matter, configIPID/configCID overridese
39453942
configIPID = case elabPkgOrComp of

cabal-install/src/Distribution/Client/ProjectPlanning/Types.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ data ElaboratedConfiguredPackage = ElaboratedConfiguredPackage
213213
{ elabUnitId :: UnitId
214214
-- ^ The 'UnitId' which uniquely identifies this item in a build plan
215215
, elabComponentId :: ComponentId
216-
, elabInstantiatedWith :: Map ModuleName Module
217-
, elabLinkedInstantiatedWith :: Map ModuleName OpenModule
218216
, elabIsCanonical :: Bool
219217
-- ^ This is true if this is an indefinite package, or this is a
220218
-- package with no signatures. (Notably, it's not true for instantiated
@@ -696,6 +694,8 @@ data ElaboratedComponent = ElaboratedComponent
696694
-- instantiation phase. It's more precise than
697695
-- 'compLibDependencies', and also stores information about internal
698696
-- dependencies.
697+
, compInstantiatedWith :: Map ModuleName Module
698+
, compLinkedInstantiatedWith :: Map ModuleName OpenModule
699699
, compExeDependencies :: [ConfiguredId]
700700
-- ^ The executable dependencies of this component (including
701701
-- internal executables).

0 commit comments

Comments
 (0)