Skip to content

Commit a804e2d

Browse files
committed
refactor(cabal-install): reduce scope in ProjectPlanning
1 parent 14bc45d commit a804e2d

File tree

1 file changed

+17
-33
lines changed

1 file changed

+17
-33
lines changed

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

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,39 +1806,25 @@ elaborateInstallPlan
18061806
, elabComponentId = notImpl "elabComponentId"
18071807
, elabInstallDirs = notImpl "elabInstallDirs"
18081808
, elabPkgOrComp = ElabComponent (ElaboratedComponent
1809-
{ compSolverName
1810-
, compComponentName
1811-
, compLibDependencies
1812-
, compLinkedLibDependencies
1813-
, compExeDependencies
1814-
, compPkgConfigDependencies
1815-
, compExeDependencyPaths
1816-
, compOrderLibDependencies
1817-
, compInstantiatedWith
1818-
, compLinkedInstantiatedWith
1809+
{ compSolverName = CD.ComponentSetup
1810+
, compComponentName = Nothing
1811+
, compLibDependencies =
1812+
[ (configuredId cid, False)
1813+
| cid <- CD.setupDeps solverPkgLibDeps >>= elaborateLibSolverId mapDep
1814+
]
1815+
, compLinkedLibDependencies = notImpl "compLinkedLibDependencies"
1816+
, compOrderLibDependencies = notImpl "compOrderLibDependencies"
1817+
-- Not supported:
1818+
, compExeDependencies = mempty
1819+
, compExeDependencyPaths = mempty
1820+
, compPkgConfigDependencies = mempty
1821+
, compInstantiatedWith = mempty
1822+
, compLinkedInstantiatedWith = Map.empty
18191823
})
18201824
}
18211825
| otherwise =
18221826
Nothing
18231827
where
1824-
compSolverName = CD.ComponentSetup
1825-
compComponentName = Nothing
1826-
1827-
dep_pkgs = elaborateLibSolverId mapDep =<< CD.setupDeps solverPkgLibDeps
1828-
1829-
compLibDependencies =
1830-
-- MP: No idea what this function does
1831-
map (\cid -> (configuredId cid, False)) dep_pkgs
1832-
compLinkedLibDependencies = notImpl "compLinkedLibDependencies"
1833-
compOrderLibDependencies = notImpl "compOrderLibDependencies"
1834-
1835-
-- Not supported:
1836-
compExeDependencies = []
1837-
compExeDependencyPaths = []
1838-
compPkgConfigDependencies = []
1839-
compInstantiatedWith = mempty
1840-
compLinkedInstantiatedWith = Map.empty
1841-
18421828
notImpl f =
18431829
error $
18441830
"Distribution.Client.ProjectPlanning.setupComponent: "
@@ -1939,13 +1925,14 @@ elaborateInstallPlan
19391925
{ compSolverName
19401926
, compComponentName
19411927
, compLibDependencies
1942-
, compLinkedLibDependencies
19431928
, compExeDependencies
19441929
, compPkgConfigDependencies
19451930
, compExeDependencyPaths
1946-
, compOrderLibDependencies
19471931
, compInstantiatedWith = Map.empty
19481932
, compLinkedInstantiatedWith = Map.empty
1933+
-- filled later (in step 5)
1934+
, compLinkedLibDependencies = error "buildComponent: compLinkedLibDependencies"
1935+
, compOrderLibDependencies = error "buildComponent: compOrderLibDependencies"
19491936
}
19501937

19511938
-- 3. Construct a preliminary ElaboratedConfiguredPackage,
@@ -2037,9 +2024,6 @@ elaborateInstallPlan
20372024

20382025
return ((cc_map', lc_map', exe_map'), elab)
20392026
where
2040-
compLinkedLibDependencies = error "buildComponent: compLinkedLibDependencies"
2041-
compOrderLibDependencies = error "buildComponent: compOrderLibDependencies"
2042-
20432027
cname = Cabal.componentName comp
20442028
compComponentName = Just cname
20452029
compSolverName = CD.componentNameToComponent cname

0 commit comments

Comments
 (0)