Skip to content

Commit

Permalink
showComponentTarget remove dependence on ElaboratedPackage.
Browse files Browse the repository at this point in the history
Signed-off-by: Edward Z. Yang <[email protected]>
  • Loading branch information
ezyang committed Aug 5, 2016
1 parent 2c7c917 commit 5f1c551
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cabal-install/Distribution/Client/ProjectOrchestration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions cabal-install/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 5f1c551

Please sign in to comment.