From 5f1c551ee82d53c16ddba04aa1fac2390648f060 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Wed, 3 Aug 2016 02:39:38 -0700 Subject: [PATCH] showComponentTarget remove dependence on ElaboratedPackage. Signed-off-by: Edward Z. Yang --- .../Distribution/Client/ProjectOrchestration.hs | 2 +- cabal-install/Distribution/Client/ProjectPlanning.hs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cabal-install/Distribution/Client/ProjectOrchestration.hs b/cabal-install/Distribution/Client/ProjectOrchestration.hs index ec9312f4ba1..7e94468aa4b 100644 --- a/cabal-install/Distribution/Client/ProjectOrchestration.hs +++ b/cabal-install/Distribution/Client/ProjectOrchestration.hs @@ -470,7 +470,7 @@ printPlan verbosity showTargets pkg | null (pkgBuildTargets pkg) = "" | otherwise - = " (" ++ unwords [ showComponentTarget pkg t | t <- pkgBuildTargets pkg ] + = " (" ++ unwords [ showComponentTarget (packageId pkg) t | t <- pkgBuildTargets pkg ] ++ ")" -- TODO: [code cleanup] this should be a proper function in a proper place diff --git a/cabal-install/Distribution/Client/ProjectPlanning.hs b/cabal-install/Distribution/Client/ProjectPlanning.hs index 0547008dc64..3092893c1e2 100644 --- a/cabal-install/Distribution/Client/ProjectPlanning.hs +++ b/cabal-install/Distribution/Client/ProjectPlanning.hs @@ -2174,7 +2174,7 @@ setupHsConfigureArgs :: ElaboratedConfiguredPackage -> [String] setupHsConfigureArgs (ElabPackage _pkg) = [] setupHsConfigureArgs (ElabComponent comp) = - [showComponentTarget pkg (ComponentTarget cname WholeComponent)] + [showComponentTarget (packageId pkg) (ComponentTarget cname WholeComponent)] where pkg = elabComponentPackage comp cname = fromMaybe (error "setupHsConfigureArgs: trying to configure setup") @@ -2198,16 +2198,16 @@ setupHsBuildFlags _ _ verbosity builddir = setupHsBuildArgs :: ElaboratedConfiguredPackage -> [String] -setupHsBuildArgs (ElabPackage pkg) = map (showComponentTarget pkg) (pkgBuildTargets pkg) +setupHsBuildArgs (ElabPackage pkg) = map (showComponentTarget (packageId pkg)) (pkgBuildTargets pkg) setupHsBuildArgs (ElabComponent _comp) = [] -showComponentTarget :: ElaboratedPackage -> ComponentTarget -> String -showComponentTarget pkg = +showComponentTarget :: PackageId -> ComponentTarget -> String +showComponentTarget pkgid = showBuildTarget . toBuildTarget where showBuildTarget t = - Cabal.showBuildTarget (qlBuildTarget t) (packageId pkg) t + Cabal.showBuildTarget (qlBuildTarget t) pkgid t qlBuildTarget Cabal.BuildTargetComponent{} = Cabal.QL2 qlBuildTarget _ = Cabal.QL3 @@ -2237,7 +2237,7 @@ setupHsReplFlags _ _ verbosity builddir = setupHsReplArgs :: ElaboratedConfiguredPackage -> [String] setupHsReplArgs (ElabPackage pkg) = - maybe [] (\t -> [showComponentTarget pkg t]) (pkgReplTarget pkg) + maybe [] (\t -> [showComponentTarget (packageId pkg) t]) (pkgReplTarget pkg) --TODO: should be able to give multiple modules in one component setupHsReplArgs (ElabComponent _comp) = error "setupHsReplArgs: didn't implement me yet"