Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new-install: nonlocal exes #4825

Merged
merged 8 commits into from
Oct 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions cabal-install/Distribution/Client/CmdBench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,6 @@ renderTargetProblem (TargetProblemNoTargets targetSelector) =
++ renderTargetSelector targetSelector ++ "."

_ -> renderTargetProblemNoTargets "benchmark" targetSelector
where
targetSelectorFilter (TargetAllPackages mkfilter) = mkfilter
targetSelectorFilter (TargetPackage _ _ mkfilter) = mkfilter
targetSelectorFilter (TargetComponent _ _ _) = Nothing

renderTargetProblem (TargetProblemComponentNotBenchmark pkgid cname) =
"The bench command is for running benchmarks, but the target '"
Expand Down
16 changes: 14 additions & 2 deletions cabal-install/Distribution/Client/CmdErrorMessages.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Distribution.Client.CmdErrorMessages (

import Distribution.Client.ProjectOrchestration
import Distribution.Client.TargetSelector
( componentKind, showTargetSelector )
( ComponentKindFilter, componentKind, showTargetSelector )

import Distribution.Package
( packageId, packageName )
Expand Down Expand Up @@ -111,6 +111,9 @@ renderTargetSelector (TargetComponent _pkgid cname (FileTarget filename)) =
renderTargetSelector (TargetComponent _pkgid cname (ModuleTarget modname)) =
"the module " ++ display modname ++ " in the " ++ showComponentName cname

renderTargetSelector (TargetPackageName pkgname) =
"the package " ++ display pkgname


renderOptionalStanza :: Plural -> OptionalStanza -> String
renderOptionalStanza Singular TestStanzas = "test suite"
Expand All @@ -124,19 +127,26 @@ optionalStanza (CTestName _) = Just TestStanzas
optionalStanza (CBenchName _) = Just BenchStanzas
optionalStanza _ = Nothing


-- | Does the 'TargetSelector' potentially refer to one package or many?
--
targetSelectorPluralPkgs :: TargetSelector a -> Plural
targetSelectorPluralPkgs (TargetAllPackages _) = Plural
targetSelectorPluralPkgs (TargetPackage _ _ _) = Singular
targetSelectorPluralPkgs (TargetComponent _ _ _) = Singular
targetSelectorPluralPkgs (TargetPackageName _) = Singular

-- | Does the 'TargetSelector' refer to
targetSelectorRefersToPkgs :: TargetSelector a -> Bool
targetSelectorRefersToPkgs (TargetAllPackages mkfilter) = isNothing mkfilter
targetSelectorRefersToPkgs (TargetPackage _ _ mkfilter) = isNothing mkfilter
targetSelectorRefersToPkgs (TargetComponent _ _ _) = False
targetSelectorRefersToPkgs (TargetPackageName _) = True

targetSelectorFilter :: TargetSelector a -> Maybe ComponentKindFilter
targetSelectorFilter (TargetPackage _ _ mkfilter) = mkfilter
targetSelectorFilter (TargetAllPackages mkfilter) = mkfilter
targetSelectorFilter (TargetComponent _ _ _) = Nothing
targetSelectorFilter (TargetPackageName _) = Nothing

renderComponentKind :: Plural -> ComponentKind -> String
renderComponentKind Singular ckind = case ckind of
Expand Down Expand Up @@ -311,6 +321,8 @@ renderTargetProblemNoTargets verb targetSelector =
++ renderComponentKind Plural kfilter
reason ts@TargetComponent{} =
error $ "renderTargetProblemNoTargets: " ++ show ts
reason (TargetPackageName _) =
"it does not contain any components at all"

-----------------------------------------------------------
-- Renderering error messages for CannotPruneDependencies
Expand Down
Loading