Cabal-3.14.0.0: A framework for packaging Haskell software
Safe HaskellNone
LanguageHaskell2010

Distribution.Simple.SetupHooks.Internal

Description

Internal implementation module. Users of build-type: Hooks should import Distribution.Simple.SetupHooks instead.

Synopsis

The setup hooks datatype

data SetupHooks Source #

Hooks into the cabal build phases.

Usage:

  • In your .cabal file, declare build-type: Hooks (with a cabal-version greater than or equal to 3.14),
  • In your .cabal file, include a custom-setup stanza which declares the dependencies of your SetupHooks module; this will usually contain a dependency on the Cabal-hooks package.
  • Provide a SetupHooks.hs module next to your .cabal file; it must export setupHooks :: SetupHooks.

Constructors

SetupHooks 

Fields

Instances

Instances details
Monoid SetupHooks Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Semigroup SetupHooks Source #

SetupHooks can be combined monoidally. This is useful to combine setup hooks defined by another package with your own package-specific hooks.

Warning: this Semigroup instance is not commutative.

Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Configure hooks

noConfigureHooks :: ConfigureHooks Source #

Empty configure phase hooks.

Per-package configure hooks

data PreConfPackageInputs Source #

Inputs to the package-wide pre-configure step.

Constructors

PreConfPackageInputs 

Fields

Instances

Instances details
Structured PreConfPackageInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Binary PreConfPackageInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Generic PreConfPackageInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Associated Types

type Rep PreConfPackageInputs 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PreConfPackageInputs = D1 ('MetaData "PreConfPackageInputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "PreConfPackageInputs" 'PrefixI 'True) ((S1 ('MetaSel ('Just "configFlags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ConfigFlags) :*: S1 ('MetaSel ('Just "localBuildConfig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalBuildConfig)) :*: (S1 ('MetaSel ('Just "compiler") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Compiler) :*: S1 ('MetaSel ('Just "platform") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Platform))))
Show PreConfPackageInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PreConfPackageInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PreConfPackageInputs = D1 ('MetaData "PreConfPackageInputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "PreConfPackageInputs" 'PrefixI 'True) ((S1 ('MetaSel ('Just "configFlags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ConfigFlags) :*: S1 ('MetaSel ('Just "localBuildConfig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalBuildConfig)) :*: (S1 ('MetaSel ('Just "compiler") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Compiler) :*: S1 ('MetaSel ('Just "platform") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Platform))))

data PreConfPackageOutputs Source #

Outputs of the package-wide pre-configure step.

Prefer using noPreConfPackageOutputs and overriding the fields you care about, to avoid depending on implementation details of this datatype.

Instances

Instances details
Structured PreConfPackageOutputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Binary PreConfPackageOutputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Generic PreConfPackageOutputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Associated Types

type Rep PreConfPackageOutputs 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PreConfPackageOutputs = D1 ('MetaData "PreConfPackageOutputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "PreConfPackageOutputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "buildOptions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuildOptions) :*: S1 ('MetaSel ('Just "extraConfiguredProgs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ConfiguredProgs)))
Show PreConfPackageOutputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PreConfPackageOutputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PreConfPackageOutputs = D1 ('MetaData "PreConfPackageOutputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "PreConfPackageOutputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "buildOptions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuildOptions) :*: S1 ('MetaSel ('Just "extraConfiguredProgs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ConfiguredProgs)))

noPreConfPackageOutputs :: PreConfPackageInputs -> PreConfPackageOutputs Source #

Use this smart constructor to declare an empty set of changes by the package-wide pre-configure hook, and override the fields you care about.

Use this rather than PreConfPackageOutputs to avoid relying on internal implementation details of the latter.

data PostConfPackageInputs Source #

Inputs to the package-wide post-configure step.

Instances

Instances details
Structured PostConfPackageInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Binary PostConfPackageInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Generic PostConfPackageInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Associated Types

type Rep PostConfPackageInputs 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PostConfPackageInputs = D1 ('MetaData "PostConfPackageInputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "PostConfPackageInputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "localBuildConfig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalBuildConfig) :*: S1 ('MetaSel ('Just "packageBuildDescr") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageBuildDescr)))
Show PostConfPackageInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PostConfPackageInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PostConfPackageInputs = D1 ('MetaData "PostConfPackageInputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "PostConfPackageInputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "localBuildConfig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalBuildConfig) :*: S1 ('MetaSel ('Just "packageBuildDescr") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageBuildDescr)))

type PostConfPackageHook = PostConfPackageInputs -> IO () Source #

Package-wide post-configure step.

Perform side effects. Last opportunity for any package-wide logic; any subsequent hooks work per-component.

Per-component configure hooks

data PreConfComponentInputs Source #

Inputs to the per-component pre-configure step.

Instances

Instances details
Structured PreConfComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Binary PreConfComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Generic PreConfComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Associated Types

type Rep PreConfComponentInputs 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PreConfComponentInputs = D1 ('MetaData "PreConfComponentInputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "PreConfComponentInputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "localBuildConfig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalBuildConfig) :*: (S1 ('MetaSel ('Just "packageBuildDescr") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageBuildDescr) :*: S1 ('MetaSel ('Just "component") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Component))))
Show PreConfComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PreConfComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PreConfComponentInputs = D1 ('MetaData "PreConfComponentInputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "PreConfComponentInputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "localBuildConfig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalBuildConfig) :*: (S1 ('MetaSel ('Just "packageBuildDescr") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageBuildDescr) :*: S1 ('MetaSel ('Just "component") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Component))))

data PreConfComponentOutputs Source #

Outputs of the per-component pre-configure step.

Prefer using noPreComponentOutputs and overriding the fields you care about, to avoid depending on implementation details of this datatype.

Instances

Instances details
Structured PreConfComponentOutputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Binary PreConfComponentOutputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Generic PreConfComponentOutputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Associated Types

type Rep PreConfComponentOutputs 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PreConfComponentOutputs = D1 ('MetaData "PreConfComponentOutputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "PreConfComponentOutputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "componentDiff") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ComponentDiff)))
Show PreConfComponentOutputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PreConfComponentOutputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PreConfComponentOutputs = D1 ('MetaData "PreConfComponentOutputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "PreConfComponentOutputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "componentDiff") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ComponentDiff)))

noPreConfComponentOutputs :: PreConfComponentInputs -> PreConfComponentOutputs Source #

Use this smart constructor to declare an empty set of changes by a per-component pre-configure hook, and override the fields you care about.

Use this rather than PreConfComponentOutputs to avoid relying on internal implementation details of the latter.

type PreConfComponentHook = PreConfComponentInputs -> IO PreConfComponentOutputs Source #

Per-component pre-configure step.

For each component of the package, this hook can perform side effects, and return a diff to the passed in component, e.g. to declare additional autogenerated modules.

Build hooks

data BuildHooks Source #

Build-time hooks.

Constructors

BuildHooks 

Fields

noBuildHooks :: BuildHooks Source #

Empty build hooks.

data BuildingWhat Source #

What kind of build phase are we doing/hooking into?

Is this a normal build, or is it perhaps for running an interactive session or Haddock?

Constructors

BuildNormal BuildFlags

A normal build.

BuildRepl ReplFlags

Build steps for an interactive session.

BuildHaddock HaddockFlags

Build steps for generating documentation.

BuildHscolour HscolourFlags

Build steps for Hscolour.

Instances

Instances details
Structured BuildingWhat Source # 
Instance details

Defined in Distribution.Simple.Setup

Binary BuildingWhat Source # 
Instance details

Defined in Distribution.Simple.Setup

Methods

put :: BuildingWhat -> Put #

get :: Get BuildingWhat #

putList :: [BuildingWhat] -> Put #

Generic BuildingWhat Source # 
Instance details

Defined in Distribution.Simple.Setup

Show BuildingWhat Source # 
Instance details

Defined in Distribution.Simple.Setup

type Rep BuildingWhat Source # 
Instance details

Defined in Distribution.Simple.Setup

Pre-build rules

data PreBuildComponentInputs Source #

Constructors

PreBuildComponentInputs 

Fields

Instances

Instances details
Structured PreBuildComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Binary PreBuildComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Generic PreBuildComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Associated Types

type Rep PreBuildComponentInputs 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PreBuildComponentInputs = D1 ('MetaData "PreBuildComponentInputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "PreBuildComponentInputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "buildingWhat") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuildingWhat) :*: (S1 ('MetaSel ('Just "localBuildInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalBuildInfo) :*: S1 ('MetaSel ('Just "targetInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TargetInfo))))
Show PreBuildComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PreBuildComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PreBuildComponentInputs = D1 ('MetaData "PreBuildComponentInputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "PreBuildComponentInputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "buildingWhat") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuildingWhat) :*: (S1 ('MetaSel ('Just "localBuildInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalBuildInfo) :*: S1 ('MetaSel ('Just "targetInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TargetInfo))))

Post-build hook

data PostBuildComponentInputs Source #

Instances

Instances details
Structured PostBuildComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Binary PostBuildComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Generic PostBuildComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Associated Types

type Rep PostBuildComponentInputs 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PostBuildComponentInputs = D1 ('MetaData "PostBuildComponentInputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "PostBuildComponentInputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "buildFlags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuildFlags) :*: (S1 ('MetaSel ('Just "localBuildInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalBuildInfo) :*: S1 ('MetaSel ('Just "targetInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TargetInfo))))
Show PostBuildComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PostBuildComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep PostBuildComponentInputs = D1 ('MetaData "PostBuildComponentInputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "PostBuildComponentInputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "buildFlags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuildFlags) :*: (S1 ('MetaSel ('Just "localBuildInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalBuildInfo) :*: S1 ('MetaSel ('Just "targetInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TargetInfo))))

Install hooks

noInstallHooks :: InstallHooks Source #

Empty copy/install hooks.

data InstallComponentInputs Source #

Instances

Instances details
Structured InstallComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Binary InstallComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Generic InstallComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

Associated Types

type Rep InstallComponentInputs 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep InstallComponentInputs = D1 ('MetaData "InstallComponentInputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "InstallComponentInputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "copyFlags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CopyFlags) :*: (S1 ('MetaSel ('Just "localBuildInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalBuildInfo) :*: S1 ('MetaSel ('Just "targetInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TargetInfo))))
Show InstallComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep InstallComponentInputs Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Internal

type Rep InstallComponentInputs = D1 ('MetaData "InstallComponentInputs" "Distribution.Simple.SetupHooks.Internal" "Cabal-3.14.0.0-7eed" 'False) (C1 ('MetaCons "InstallComponentInputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "copyFlags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CopyFlags) :*: (S1 ('MetaSel ('Just "localBuildInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalBuildInfo) :*: S1 ('MetaSel ('Just "targetInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TargetInfo))))

type InstallComponentHook = InstallComponentInputs -> IO () Source #

A per-component install hook, which can only perform side effects (e.g. copying files).

Internals

Per-component hook utilities

Executing build rules

executeRules :: Verbosity -> LocalBuildInfo -> TargetInfo -> Map RuleId Rule -> IO () Source #

Run all pre-build rules.

This function should only be called internally within Cabal, as it is used to implement the (legacy) Setup.hs interface. The build tool (e.g. cabal-install or hls) should instead go through the separate hooks executable, which allows us to only rerun the out-of-date rules (instead of running all of these rules at once).

HookedBuildInfo compatibility code