Skip to content

Commit 2004bb9

Browse files
committed
refactor(cabal-install): reduce scope in ProjectPlanning
1 parent 69b38ad commit 2004bb9

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
@@ -1808,40 +1808,26 @@ elaborateInstallPlan
18081808
, elabPkgOrComp =
18091809
ElabComponent
18101810
( ElaboratedComponent
1811-
{ compSolverName
1812-
, compComponentName
1813-
, compLibDependencies
1814-
, compLinkedLibDependencies
1815-
, compExeDependencies
1816-
, compPkgConfigDependencies
1817-
, compExeDependencyPaths
1818-
, compOrderLibDependencies
1819-
, compInstantiatedWith
1820-
, compLinkedInstantiatedWith
1811+
{ compSolverName = CD.ComponentSetup
1812+
, compComponentName = Nothing
1813+
, compLibDependencies =
1814+
[ (configuredId cid, False)
1815+
| cid <- CD.setupDeps solverPkgLibDeps >>= elaborateLibSolverId mapDep
1816+
]
1817+
, compLinkedLibDependencies = notImpl "compLinkedLibDependencies"
1818+
, compOrderLibDependencies = notImpl "compOrderLibDependencies"
1819+
, -- Not supported:
1820+
compExeDependencies = mempty
1821+
, compExeDependencyPaths = mempty
1822+
, compPkgConfigDependencies = mempty
1823+
, compInstantiatedWith = mempty
1824+
, compLinkedInstantiatedWith = Map.empty
18211825
}
18221826
)
18231827
}
18241828
| otherwise =
18251829
Nothing
18261830
where
1827-
compSolverName = CD.ComponentSetup
1828-
compComponentName = Nothing
1829-
1830-
dep_pkgs = elaborateLibSolverId mapDep =<< CD.setupDeps solverPkgLibDeps
1831-
1832-
compLibDependencies =
1833-
-- MP: No idea what this function does
1834-
map (\cid -> (configuredId cid, False)) dep_pkgs
1835-
compLinkedLibDependencies = notImpl "compLinkedLibDependencies"
1836-
compOrderLibDependencies = notImpl "compOrderLibDependencies"
1837-
1838-
-- Not supported:
1839-
compExeDependencies = []
1840-
compExeDependencyPaths = []
1841-
compPkgConfigDependencies = []
1842-
compInstantiatedWith = mempty
1843-
compLinkedInstantiatedWith = Map.empty
1844-
18451831
notImpl f =
18461832
error $
18471833
"Distribution.Client.ProjectPlanning.setupComponent: "
@@ -1945,13 +1931,14 @@ elaborateInstallPlan
19451931
{ compSolverName
19461932
, compComponentName
19471933
, compLibDependencies
1948-
, compLinkedLibDependencies
19491934
, compExeDependencies
19501935
, compPkgConfigDependencies
19511936
, compExeDependencyPaths
1952-
, compOrderLibDependencies
19531937
, compInstantiatedWith = Map.empty
19541938
, compLinkedInstantiatedWith = Map.empty
1939+
, -- filled later (in step 5)
1940+
compLinkedLibDependencies = error "buildComponent: compLinkedLibDependencies"
1941+
, compOrderLibDependencies = error "buildComponent: compOrderLibDependencies"
19551942
}
19561943

19571944
-- 3. Construct a preliminary ElaboratedConfiguredPackage,
@@ -2043,9 +2030,6 @@ elaborateInstallPlan
20432030

20442031
return ((cc_map', lc_map', exe_map'), elab)
20452032
where
2046-
compLinkedLibDependencies = error "buildComponent: compLinkedLibDependencies"
2047-
compOrderLibDependencies = error "buildComponent: compOrderLibDependencies"
2048-
20492033
cname = Cabal.componentName comp
20502034
compComponentName = Just cname
20512035
compSolverName = CD.componentNameToComponent cname

0 commit comments

Comments
 (0)