Distribution.Simple.BuildTarget

Cabal-2.5.0.0: A framework for packaging Haskell software

Copyright | (c) Duncan Coutts 2012
License | BSD-like
Maintainer | duncan@community.haskell.org
Safe Haskell | None
Language | Haskell2010

Distribution.Simple.BuildTarget

Contents

- Main interface
- Build targets
- Parsing user build targets
- Resolving build targets

Description

Handling for user-specified build targets

Synopsis

- readTargetInfos :: Verbosity -> PackageDescription -> LocalBuildInfo -> [String] -> IO [TargetInfo]
- readBuildTargets :: Verbosity -> PackageDescription -> [String] -> IO [BuildTarget]
- data BuildTarget
  - = BuildTargetComponent ComponentName
  - | BuildTargetModule ComponentName ModuleName
  - | BuildTargetFile ComponentName FilePath
- showBuildTarget :: PackageId -> BuildTarget -> String
- data QualLevel
  - = QL1
  - | QL2
  - | QL3
- buildTargetComponentName :: BuildTarget -> ComponentName
- data UserBuildTarget
- readUserBuildTargets :: [String] -> ([UserBuildTargetProblem], [UserBuildTarget])
- showUserBuildTarget :: UserBuildTarget -> String
- data UserBuildTargetProblem = UserBuildTargetUnrecognised String
- reportUserBuildTargetProblems :: Verbosity -> [UserBuildTargetProblem] -> IO ()
- resolveBuildTargets :: PackageDescription -> [(UserBuildTarget, Bool)] -> ([BuildTargetProblem], [BuildTarget])
- data BuildTargetProblem
  - = BuildTargetExpected UserBuildTarget [String] String
  - | BuildTargetNoSuch UserBuildTarget [(String, String)]
  - | BuildTargetAmbiguous UserBuildTarget [(UserBuildTarget, BuildTarget)]
- reportBuildTargetProblems :: Verbosity -> [BuildTargetProblem] -> IO ()

# Main interface

readTargetInfos :: Verbosity -> PackageDescription -> LocalBuildInfo -> [String] -> IO [TargetInfo] Source #

Take a list of `String` build targets, and parse and validate them into actual `TargetInfo`s to be builtregisteredwhatever.

readBuildTargets :: Verbosity -> PackageDescription -> [String] -> IO [BuildTarget] Source #

Read a list of user-supplied build target strings and resolve them to `BuildTarget`s according to a `PackageDescription`. If there are problems with any of the targets e.g. they don't exist or are misformatted, throw an `IOException`.

# Build targets

data BuildTarget Source #

A fully resolved build target.

Constructors

BuildTargetComponent ComponentName | A specific component
BuildTargetModule ComponentName ModuleName | A specific module within a specific component.
BuildTargetFile ComponentName FilePath | A specific file within a specific component.

#### Instances

Instances details

Eq BuildTarget # |
Instance details Defined in Distribution.Simple.BuildTarget Methods (==) :: BuildTarget -> BuildTarget -> Bool # (/=) :: BuildTarget -> BuildTarget -> Bool #
Show BuildTarget # |
Instance details Defined in Distribution.Simple.BuildTarget Methods showsPrec :: Int -> BuildTarget -> ShowS Source # show :: BuildTarget -> String Source # showList :: [BuildTarget] -> ShowS Source #
Generic BuildTarget # |
Instance details Defined in Distribution.Simple.BuildTarget Associated Types type Rep BuildTarget :: Type -> Type Source # Methods from :: BuildTarget -> Rep BuildTarget x Source # to :: Rep BuildTarget x -> BuildTarget Source #
Binary BuildTarget # |
Instance details Defined in Distribution.Simple.BuildTarget Methods put :: BuildTarget -> Put Source # get :: Get BuildTarget Source # putList :: [BuildTarget] -> Put Source #
type Rep BuildTarget # |
Instance details Defined in Distribution.Simple.BuildTarget type Rep BuildTarget = D1 ('MetaData "BuildTarget" "Distribution.Simple.BuildTarget" "Cabal-2.5.0.0" 'False) (C1 ('MetaCons "BuildTargetComponent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ComponentName)) :+: (C1 ('MetaCons "BuildTargetModule" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ComponentName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ModuleName)) :+: C1 ('MetaCons "BuildTargetFile" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ComponentName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath))))

showBuildTarget :: PackageId -> BuildTarget -> String Source #

Unambiguously render a `BuildTarget`, so that it can be parsed in all situations.

data QualLevel Source #

Constructors

QL1 |
QL2 |
QL3 |

#### Instances

Instances details

Enum QualLevel # |
Instance details Defined in Distribution.Simple.BuildTarget Methods succ :: QualLevel -> QualLevel Source # pred :: QualLevel -> QualLevel Source # toEnum :: Int -> QualLevel Source # fromEnum :: QualLevel -> Int Source # enumFrom :: QualLevel -> [QualLevel] Source # enumFromThen :: QualLevel -> QualLevel -> [QualLevel] Source # enumFromTo :: QualLevel -> QualLevel -> [QualLevel] Source # enumFromThenTo :: QualLevel -> QualLevel -> QualLevel -> [QualLevel] Source #
Show QualLevel # |
Instance details Defined in Distribution.Simple.BuildTarget Methods showsPrec :: Int -> QualLevel -> ShowS Source # show :: QualLevel -> String Source # showList :: [QualLevel] -> ShowS Source #

buildTargetComponentName :: BuildTarget -> ComponentName Source #

# Parsing user build targets

data UserBuildTarget Source #

Various ways that a user may specify a build target.

#### Instances

Instances details

Eq UserBuildTarget # |
Instance details Defined in Distribution.Simple.BuildTarget Methods (==) :: UserBuildTarget -> UserBuildTarget -> Bool # (/=) :: UserBuildTarget -> UserBuildTarget -> Bool #
Ord UserBuildTarget # |
Instance details Defined in Distribution.Simple.BuildTarget Methods compare :: UserBuildTarget -> UserBuildTarget -> Ordering # (<) :: UserBuildTarget -> UserBuildTarget -> Bool # (<=) :: UserBuildTarget -> UserBuildTarget -> Bool # (>) :: UserBuildTarget -> UserBuildTarget -> Bool # (>=) :: UserBuildTarget -> UserBuildTarget -> Bool # max :: UserBuildTarget -> UserBuildTarget -> UserBuildTarget # min :: UserBuildTarget -> UserBuildTarget -> UserBuildTarget #
Show UserBuildTarget # |
Instance details Defined in Distribution.Simple.BuildTarget Methods showsPrec :: Int -> UserBuildTarget -> ShowS Source # show :: UserBuildTarget -> String Source # showList :: [UserBuildTarget] -> ShowS Source #

readUserBuildTargets :: [String] -> ([UserBuildTargetProblem], [UserBuildTarget]) Source #

showUserBuildTarget :: UserBuildTarget -> String Source #

data UserBuildTargetProblem Source #

Constructors

UserBuildTargetUnrecognised String |

#### Instances

Instances details

Show UserBuildTargetProblem # |
Instance details Defined in Distribution.Simple.BuildTarget Methods showsPrec :: Int -> UserBuildTargetProblem -> ShowS Source # show :: UserBuildTargetProblem -> String Source # showList :: [UserBuildTargetProblem] -> ShowS Source #

reportUserBuildTargetProblems :: Verbosity -> [UserBuildTargetProblem] -> IO () Source #

# Resolving build targets

resolveBuildTargets :: PackageDescription -> [(UserBuildTarget, Bool)] -> ([BuildTargetProblem], [BuildTarget]) Source #

Given a bunch of user-specified targets, try to resolve what it is they refer to.

data BuildTargetProblem Source #

Constructors

BuildTargetExpected UserBuildTarget [String] String | expected thing (actually got)
BuildTargetNoSuch UserBuildTarget [(String, String)] | (no such thing, actually got)
BuildTargetAmbiguous UserBuildTarget [(UserBuildTarget, BuildTarget)] |

#### Instances

Instances details

Show BuildTargetProblem # |
Instance details Defined in Distribution.Simple.BuildTarget Methods showsPrec :: Int -> BuildTargetProblem -> ShowS Source # show :: BuildTargetProblem -> String Source # showList :: [BuildTargetProblem] -> ShowS Source #

reportBuildTargetProblems :: Verbosity -> [BuildTargetProblem] -> IO () Source #