From 4a9f11e66a92dc353b60702bd7be89a6e7e81724 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sat, 20 Aug 2016 23:33:04 -0700 Subject: [PATCH] Tweaks to plan.json format - 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 --- .../Distribution/Client/ProjectPlanOutput.hs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/cabal-install/Distribution/Client/ProjectPlanOutput.hs b/cabal-install/Distribution/Client/ProjectPlanOutput.hs index d51f158b713..2b6f31d50de 100644 --- a/cabal-install/Distribution/Client/ProjectPlanOutput.hs +++ b/cabal-install/Distribution/Client/ProjectPlanOutput.hs @@ -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?