Distribution.Types.ComponentRequestedSpec

Cabal-2.4.0.1: A framework for packaging Haskell software

Safe Haskell | None
Language | Haskell2010

Distribution.Types.ComponentRequestedSpec

Synopsis

- data ComponentRequestedSpec
  - = ComponentRequestedSpec {
    - testsRequested :: Bool
    - benchmarksRequested :: Bool
    }
  - | OneComponentRequestedSpec ComponentName
- data ComponentDisabledReason
  - = DisabledComponent
  - | DisabledAllTests
  - | DisabledAllBenchmarks
  - | DisabledAllButOne String
- defaultComponentRequestedSpec :: ComponentRequestedSpec
- componentNameRequested :: ComponentRequestedSpec -> ComponentName -> Bool
- componentEnabled :: ComponentRequestedSpec -> Component -> Bool
- componentDisabledReason :: ComponentRequestedSpec -> Component -> Maybe ComponentDisabledReason

# Documentation

# Note: Buildable versus requested versus enabled components

What's the difference between a buildable component (ala `componentBuildable`), a requested component (ala `componentNameRequested`), and an enabled component (ala `componentEnabled`)?

A component is buildable if, after resolving flags and conditionals, there is no `buildable: False` property in it. This is a static property that arises from the Cabal file and the package description flattening; once we have a `PackageDescription` buildability is known.

A component is requested if a user specified, via a the flags and arguments passed to configure, that it should be built. E.g., `--enable-tests` or `--enable-benchmarks` request all tests and benchmarks, if they are provided. What is requested can be read off directly from `ComponentRequestedSpec`. A requested component is not always buildable; e.g., a user may `--enable-tests` but one of the test suites may have `buildable: False`.

A component is enabled if it is BOTH buildable and requested. Once we have a `LocalBuildInfo`, whether or not a component is enabled is known.

Generally speaking, most Cabal API code cares if a component is enabled. (For example, if you want to run a preprocessor on each component prior to building them, you want to run this on each enabled component.)

Note that post-configuration, you will generally not see a non-buildable `Component`. This is because `flattenPD` will drop any such components from `PackageDescription`. See #3858 for an example where this causes problems.

data ComponentRequestedSpec #

Describes what components are enabled by user-interaction. See also this note in Distribution.Types.ComponentRequestedSpec.

Since: Cabal-2.0.0.2

Constructors

ComponentRequestedSpec |
Fields testsRequested :: Bool benchmarksRequested :: Bool
OneComponentRequestedSpec ComponentName |

Instances

Eq ComponentRequestedSpec # |
Instance details Defined in Distribution.Types.ComponentRequestedSpec Methods (==) :: ComponentRequestedSpec -> ComponentRequestedSpec -> Bool # (/=) :: ComponentRequestedSpec -> ComponentRequestedSpec -> Bool #
Read ComponentRequestedSpec # |
Instance details Defined in Distribution.Types.ComponentRequestedSpec Methods readsPrec :: Int -> ReadS ComponentRequestedSpec Source # readList :: ReadS [ComponentRequestedSpec] Source # readPrec :: ReadPrec ComponentRequestedSpec Source # readListPrec :: ReadPrec [ComponentRequestedSpec] Source #
Show ComponentRequestedSpec # |
Instance details Defined in Distribution.Types.ComponentRequestedSpec Methods showsPrec :: Int -> ComponentRequestedSpec -> ShowS Source # show :: ComponentRequestedSpec -> String Source # showList :: [ComponentRequestedSpec] -> ShowS Source #
Generic ComponentRequestedSpec # |
Instance details Defined in Distribution.Types.ComponentRequestedSpec Associated Types type Rep ComponentRequestedSpec :: Type -> Type Source # Methods from :: ComponentRequestedSpec -> Rep ComponentRequestedSpec x Source # to :: Rep ComponentRequestedSpec x -> ComponentRequestedSpec Source #
Binary ComponentRequestedSpec # |
Instance details Defined in Distribution.Types.ComponentRequestedSpec Methods put :: ComponentRequestedSpec -> Put Source # get :: Get ComponentRequestedSpec Source # putList :: [ComponentRequestedSpec] -> Put Source #
type Rep ComponentRequestedSpec # |
Instance details Defined in Distribution.Types.ComponentRequestedSpec type Rep ComponentRequestedSpec = D1 (MetaData "ComponentRequestedSpec" "Distribution.Types.ComponentRequestedSpec" "Cabal-2.4.0.1" False) (C1 (MetaCons "ComponentRequestedSpec" PrefixI True) (S1 (MetaSel (Just "testsRequested") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool) :*: S1 (MetaSel (Just "benchmarksRequested") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) :+: C1 (MetaCons "OneComponentRequestedSpec" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ComponentName)))

data ComponentDisabledReason #

A reason explaining why a component is disabled.

Since: Cabal-2.0.0.2

Constructors

DisabledComponent |
DisabledAllTests |
DisabledAllBenchmarks |
DisabledAllButOne String |

defaultComponentRequestedSpec :: ComponentRequestedSpec #

The default set of enabled components. Historically tests and benchmarks are NOT enabled by default.

Since: Cabal-2.0.0.2

componentNameRequested :: ComponentRequestedSpec -> ComponentName -> Bool #

Is this component name enabled? See also this note in Distribution.Types.ComponentRequestedSpec.

Since: Cabal-2.0.0.2

componentEnabled :: ComponentRequestedSpec -> Component -> Bool #

Is this component enabled? See also this note in Distribution.Types.ComponentRequestedSpec.

Since: Cabal-2.0.0.2

componentDisabledReason :: ComponentRequestedSpec -> Component -> Maybe ComponentDisabledReason #

Is this component disabled, and if so, why?

Since: Cabal-2.0.0.2