diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2020-05-02 01:55:55 +0200 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2020-05-02 15:44:26 +0200 |
commit | f0741c61bd82ec0f94edcfa8d950f349eac86c33 (patch) | |
tree | aa381f24429d2e5f50a7f07eee6dec06f279aa0b /lib/Distribution/Helper.hs | |
parent | 11a515ed0e887eef081e514b51f29589cf6693ca (diff) |
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.
Diffstat (limited to 'lib/Distribution/Helper.hs')
-rw-r--r-- | lib/Distribution/Helper.hs | 15 |
1 files changed, 14 insertions, 1 deletions
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" |