@@ -1435,7 +1435,8 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
1435
1435
compExeDependencyPaths =
1436
1436
[ (annotatedIdToConfiguredId aid', path)
1437
1437
| aid' <- cc_exe_deps cc0
1438
- , Just path <- [Map. lookup (ann_id aid') exe_map1]]
1438
+ , Just paths <- [Map. lookup (ann_id aid') exe_map1]
1439
+ , path <- paths ]
1439
1440
elab_comp = ElaboratedComponent {.. }
1440
1441
1441
1442
-- 3. Construct a preliminary ElaboratedConfiguredPackage,
@@ -1520,10 +1521,10 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
1520
1521
external_exe_dep_sids ++ external_lib_dep_sids
1521
1522
1522
1523
external_exe_map = Map. fromList $
1523
- [ (getComponentId pkg, path )
1524
+ [ (getComponentId pkg, paths )
1524
1525
| pkg <- external_exe_dep_pkgs
1525
- , Just path <- [planPackageExePath pkg] ]
1526
- exe_map1 = Map. union external_exe_map exe_map
1526
+ , let paths = planPackageExePaths pkg ]
1527
+ exe_map1 = Map. union external_exe_map $ fmap ( \ x -> [x]) exe_map
1527
1528
1528
1529
external_lib_cc_map = Map. fromListWith Map. union
1529
1530
$ map mkCCMapping external_lib_dep_pkgs
@@ -1583,24 +1584,35 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
1583
1584
-> SolverId -> [ElaboratedPlanPackage ]
1584
1585
elaborateLibSolverId mapDep = filter (matchPlanPkg (== CLibName )) . mapDep
1585
1586
1586
- -- | Given an 'ElaboratedPlanPackage', return the path to where the
1587
- -- executable that this package represents would be installed.
1588
- planPackageExePath :: ElaboratedPlanPackage -> Maybe FilePath
1589
- planPackageExePath =
1587
+ -- | Given an 'ElaboratedPlanPackage', return the paths to where the
1588
+ -- executables that this package represents would be installed.
1589
+ -- The only case where multiple paths can be returned is the inplace
1590
+ -- monolithic package one, since there can be multiple exes and each one
1591
+ -- has its own directory.
1592
+ planPackageExePaths :: ElaboratedPlanPackage -> [FilePath ]
1593
+ planPackageExePaths =
1590
1594
-- Pre-existing executables are assumed to be in PATH
1591
1595
-- already. In fact, this should be impossible.
1592
- InstallPlan. foldPlanPackage (const Nothing ) $ \ elab -> Just $
1593
- binDirectoryFor
1594
- distDirLayout
1595
- elaboratedSharedConfig
1596
- elab $
1597
- case elabPkgOrComp elab of
1598
- ElabPackage _ -> " "
1599
- ElabComponent comp ->
1600
- case fmap Cabal. componentNameString
1601
- (compComponentName comp) of
1602
- Just (Just n) -> display n
1603
- _ -> " "
1596
+ InstallPlan. foldPlanPackage (const [] ) $ \ elab ->
1597
+ let
1598
+ executables :: [FilePath ]
1599
+ executables =
1600
+ case elabPkgOrComp elab of
1601
+ -- Monolithic mode: all exes of the package
1602
+ ElabPackage _ -> unUnqualComponentName . PD. exeName
1603
+ <$> PD. executables (elabPkgDescription elab)
1604
+ -- Per-component mode: just the selected exe
1605
+ ElabComponent comp ->
1606
+ case fmap Cabal. componentNameString
1607
+ (compComponentName comp) of
1608
+ Just (Just n) -> [display n]
1609
+ _ -> [" " ]
1610
+ in
1611
+ binDirectoryFor
1612
+ distDirLayout
1613
+ elaboratedSharedConfig
1614
+ elab
1615
+ <$> executables
1604
1616
1605
1617
elaborateSolverToPackage :: SolverPackage UnresolvedPkgLoc
1606
1618
-> ComponentsGraph
0 commit comments