Skip to content

Commit

Permalink
Tweaks to plan.json format
Browse files Browse the repository at this point in the history
- New "exe-depends" field
- Dropped "depends" when it's a package; you can use
  "components" to get the information

Signed-off-by: Edward Z. Yang <[email protected]>
  • Loading branch information
ezyang committed Aug 21, 2016
1 parent 10a9c4a commit 4a9f11e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions cabal-install/Distribution/Client/ProjectPlanOutput.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,23 @@ encodePlanAsJson elaboratedInstallPlan _elaboratedSharedConfig =
J.object $
[ "type" J..= J.String "configured"
, "id" J..= (jdisplay . installedUnitId) elab
, "depends" J..= map (jdisplay . confInstId) (elabLibDependencies elab)
, "flags" J..= J.object [ fn J..= v
| (PD.FlagName fn,v) <-
elabFlagAssignment elab ]
] ++
case elabPkgOrComp elab of
ElabPackage pkg ->
let components = J.object
[ comp2str c J..= J.object
[ "depends" J..= map (jdisplay . confInstId) v ]
-- NB: does NOT contain non-lib dependencies
| (c,v) <- ComponentDeps.toList (pkgLibDependencies pkg) ]
in ["components" J..= components ]
ElabComponent _ -> []
ElabPackage pkg ->
let components = J.object $
[ comp2str c J..= J.object
[ "depends" J..= map (jdisplay . confInstId) v ]
| (c,v) <- ComponentDeps.toList (pkgLibDependencies pkg) ] ++
[ comp2str c J..= J.object
[ "exe-depends" J..= map (jdisplay . confInstId) v ]
| (c,v) <- ComponentDeps.toList (pkgExeDependencies pkg) ]
in ["components" J..= components]
ElabComponent _ ->
["depends" J..= map (jdisplay . confInstId) (elabLibDependencies elab)
,"exe-depends" J..= map jdisplay (elabExeDependencies elab)]

-- TODO: maybe move this helper to "ComponentDeps" module?
-- Or maybe define a 'Text' instance?
Expand Down

0 comments on commit 4a9f11e

Please sign in to comment.