From f0741c61bd82ec0f94edcfa8d950f349eac86c33 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Sat, 2 May 2020 01:55:55 +0200 Subject: Ignore setup components from plan.json in readUnitInfo Cabal includes the Setup.hs executable as a component in plan.json, however there isn't a target to build it directly so we just ignore it for not when reading unit info. --- lib/Distribution/Helper.hs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Distribution/Helper.hs b/lib/Distribution/Helper.hs index 3c5007d..428afd1 100644 --- a/lib/Distribution/Helper.hs +++ b/lib/Distribution/Helper.hs @@ -503,7 +503,7 @@ buildProjectTarget qe mu stage = do Just Unit{uImpl} -> concat [ if uiV2OnlyDependencies uImpl then ["--only-dependencies"] else [] - , uiV2Components uImpl + , map snd $ filter ((/= ChSetupHsName) . fst) $ uiV2Components uImpl ] case qeProjLoc of ProjLocV2File {plCabalProjectFile} -> @@ -630,6 +630,19 @@ readProjInfo qe pc pcm pi = withVerbosity $ do -- the global pkg-db. readUnitInfo :: Helper pt -> Unit pt -> UnitModTimes -> IO UnitInfo +readUnitInfo helper u@Unit{uImpl=ui@UnitImplV2{uiV2Components}} umt + | ChSetupHsName `elem` map fst uiV2Components = do + let unit' = u { + uImpl = ui + { uiV2Components = filter ((/= ChSetupHsName) . fst) uiV2Components + } + } + -- TODO: Add a synthetic UnitInfo for the setup executable. Cabal + -- doesn't allow building it via a target on the cmdline and it + -- doesn't really exist as far as setup-config is concerned but + -- plan.json has the dependency versions for custom-setup so we + -- should be able to represet that as a UnitInfo. + readUnitInfo helper unit' umt readUnitInfo helper unit@Unit {uUnitId=uiUnitId} uiModTimes = do res <- runHelper helper unit [ "package-id" -- cgit v1.2.3