@@ -1613,13 +1613,13 @@ elaborateInstallPlan
1613
1613
buildComponent
1614
1614
(Map. empty, Map. empty, Map. empty)
1615
1615
(map fst src_comps)
1616
- let not_per_component_reasons = why_not_per_component src_comps
1617
- if null not_per_component_reasons
1618
- then return comps
1619
- else do
1620
- checkPerPackageOk comps not_per_component_reasons
1616
+ let whyNotPerComp = why_not_per_component src_comps
1617
+ case NE. nonEmpty whyNotPerComp of
1618
+ Nothing -> return comps
1619
+ Just notPerCompReasons -> do
1620
+ checkPerPackageOk comps notPerCompReasons
1621
1621
return
1622
- [ elaborateSolverToPackage spkg g $
1622
+ [ elaborateSolverToPackage notPerCompReasons spkg g $
1623
1623
comps ++ maybeToList setupComponent
1624
1624
]
1625
1625
Left cns ->
@@ -1633,7 +1633,6 @@ elaborateInstallPlan
1633
1633
why_not_per_component g =
1634
1634
cuz_buildtype ++ cuz_spec ++ cuz_length ++ cuz_flag
1635
1635
where
1636
- cuz reason = [text reason]
1637
1636
-- We have to disable per-component for now with
1638
1637
-- Configure-type scripts in order to prevent parallel
1639
1638
-- invocation of the same `./configure` script.
@@ -1646,28 +1645,29 @@ elaborateInstallPlan
1646
1645
-- Once you've implemented this, swap it for the code below.
1647
1646
cuz_buildtype =
1648
1647
case PD. buildType (elabPkgDescription elab0) of
1649
- PD. Configure -> cuz " build-type is Configure"
1650
- PD. Custom -> cuz " build-type is Custom"
1648
+ PD. Configure -> [CuzBuildType CuzConfigureBuildType ]
1649
+ PD. Custom -> [CuzBuildType CuzCustomBuildType ]
1650
+ PD. Make -> [CuzBuildType CuzMakeBuildType ]
1651
1651
_ -> []
1652
1652
-- cabal-format versions prior to 1.8 have different build-depends semantics
1653
1653
-- for now it's easier to just fallback to legacy-mode when specVersion < 1.8
1654
1654
-- see, https://github.com/haskell/cabal/issues/4121
1655
1655
cuz_spec
1656
1656
| PD. specVersion pd >= CabalSpecV1_8 = []
1657
- | otherwise = cuz " cabal-version is less than 1.8 "
1657
+ | otherwise = [ CuzCabalSpecVersion ]
1658
1658
-- In the odd corner case that a package has no components at all
1659
1659
-- then keep it as a whole package, since otherwise it turns into
1660
1660
-- 0 component graph nodes and effectively vanishes. We want to
1661
1661
-- keep it around at least for error reporting purposes.
1662
1662
cuz_length
1663
1663
| length g > 0 = []
1664
- | otherwise = cuz " there are no buildable components "
1664
+ | otherwise = [ CuzNoBuildableComponents ]
1665
1665
-- For ease of testing, we let per-component builds be toggled
1666
1666
-- at the top level
1667
1667
cuz_flag
1668
1668
| fromFlagOrDefault True (projectConfigPerComponent sharedPackageConfig) =
1669
1669
[]
1670
- | otherwise = cuz " you passed --disable-per-component "
1670
+ | otherwise = [ CuzDisablePerComponent ]
1671
1671
1672
1672
-- \| Sometimes a package may make use of features which are only
1673
1673
-- supported in per-package mode. If this is the case, we should
@@ -1679,7 +1679,7 @@ elaborateInstallPlan
1679
1679
dieProgress $
1680
1680
text " Internal libraries only supported with per-component builds."
1681
1681
$$ text " Per-component builds were disabled because"
1682
- <+> fsep (punctuate comma reasons)
1682
+ <+> fsep (punctuate comma $ map (text . whyNotPerComponent) $ toList reasons)
1683
1683
-- TODO: Maybe exclude Backpack too
1684
1684
1685
1685
elab0 = elaborateSolverToCommon spkg
@@ -1974,11 +1974,13 @@ elaborateInstallPlan
1974
1974
<$> executables
1975
1975
1976
1976
elaborateSolverToPackage
1977
- :: SolverPackage UnresolvedPkgLoc
1977
+ :: NE. NonEmpty NotPerComponentReason
1978
+ -> SolverPackage UnresolvedPkgLoc
1978
1979
-> ComponentsGraph
1979
1980
-> [ElaboratedConfiguredPackage ]
1980
1981
-> ElaboratedConfiguredPackage
1981
1982
elaborateSolverToPackage
1983
+ pkgWhyNotPerComponent
1982
1984
pkg@ ( SolverPackage
1983
1985
(SourcePackage pkgid _gpd _srcloc _descOverride)
1984
1986
_flags
0 commit comments