Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Internal implementation module.
Users of build-type: Hooks
should import Distribution.Simple.SetupHooks
instead.
Synopsis
- data SetupHooks = SetupHooks {}
- noSetupHooks :: SetupHooks
- data ConfigureHooks = ConfigureHooks {}
- noConfigureHooks :: ConfigureHooks
- data PreConfPackageInputs = PreConfPackageInputs {
- configFlags :: ConfigFlags
- localBuildConfig :: LocalBuildConfig
- compiler :: Compiler
- platform :: Platform
- data PreConfPackageOutputs = PreConfPackageOutputs {}
- noPreConfPackageOutputs :: PreConfPackageInputs -> PreConfPackageOutputs
- type PreConfPackageHook = PreConfPackageInputs -> IO PreConfPackageOutputs
- data PostConfPackageInputs = PostConfPackageInputs {}
- type PostConfPackageHook = PostConfPackageInputs -> IO ()
- data PreConfComponentInputs = PreConfComponentInputs {}
- data PreConfComponentOutputs = PreConfComponentOutputs {}
- noPreConfComponentOutputs :: PreConfComponentInputs -> PreConfComponentOutputs
- type PreConfComponentHook = PreConfComponentInputs -> IO PreConfComponentOutputs
- newtype ComponentDiff = ComponentDiff {}
- emptyComponentDiff :: ComponentName -> ComponentDiff
- buildInfoComponentDiff :: ComponentName -> BuildInfo -> ComponentDiff
- type LibraryDiff = Library
- type ForeignLibDiff = ForeignLib
- type ExecutableDiff = Executable
- type TestSuiteDiff = TestSuite
- type BenchmarkDiff = Benchmark
- type BuildInfoDiff = BuildInfo
- data BuildHooks = BuildHooks {}
- noBuildHooks :: BuildHooks
- data BuildingWhat
- buildingWhatVerbosity :: BuildingWhat -> Verbosity
- buildingWhatWorkingDir :: BuildingWhat -> Maybe (SymbolicPath CWD (Dir Pkg))
- buildingWhatDistPref :: BuildingWhat -> SymbolicPath Pkg (Dir Dist)
- data PreBuildComponentInputs = PreBuildComponentInputs {}
- type PreBuildComponentRules = Rules PreBuildComponentInputs
- data PostBuildComponentInputs = PostBuildComponentInputs {}
- type PostBuildComponentHook = PostBuildComponentInputs -> IO ()
- data InstallHooks = InstallHooks {}
- noInstallHooks :: InstallHooks
- data InstallComponentInputs = InstallComponentInputs {}
- type InstallComponentHook = InstallComponentInputs -> IO ()
- applyComponentDiffs :: Verbosity -> (Component -> IO (Maybe ComponentDiff)) -> PackageDescription -> IO PackageDescription
- forComponents_ :: PackageDescription -> (Component -> IO ()) -> IO ()
- executeRules :: Verbosity -> LocalBuildInfo -> TargetInfo -> Map RuleId Rule -> IO ()
- hookedBuildInfoComponents :: HookedBuildInfo -> Set ComponentName
- hookedBuildInfoComponentDiff_maybe :: HookedBuildInfo -> ComponentName -> Maybe (IO ComponentDiff)
The setup hooks datatype
data SetupHooks Source #
Hooks into the cabal
build phases.
Usage:
- In your
.cabal
file, declarebuild-type: Hooks
(with acabal-version
greater than or equal to3.14
), - In your
.cabal
file, include acustom-setup
stanza which declares the dependencies of yourSetupHooks
module; this will usually contain a dependency on theCabal-hooks
package. - Provide a
SetupHooks.hs
module next to your.cabal
file; it must exportsetupHooks :: SetupHooks
.
SetupHooks | |
|
Instances
Monoid SetupHooks Source # | |
Defined in Distribution.Simple.SetupHooks.Internal mempty :: SetupHooks # mappend :: SetupHooks -> SetupHooks -> SetupHooks # mconcat :: [SetupHooks] -> SetupHooks # | |
Semigroup SetupHooks Source # |
Warning: this |
Defined in Distribution.Simple.SetupHooks.Internal (<>) :: SetupHooks -> SetupHooks -> SetupHooks # sconcat :: NonEmpty SetupHooks -> SetupHooks # stimes :: Integral b => b -> SetupHooks -> SetupHooks # |
noSetupHooks :: SetupHooks Source #
Empty hooks.
Configure hooks
data ConfigureHooks Source #
Configure-time hooks.
Order of execution:
$sel:preConfPackageHook:ConfigureHooks
,- configure the package,
$sel:postConfPackageHook:ConfigureHooks
,$sel:preConfComponentHook:ConfigureHooks
,- configure the components.
ConfigureHooks | |
|
Instances
Monoid ConfigureHooks Source # | |
Defined in Distribution.Simple.SetupHooks.Internal mappend :: ConfigureHooks -> ConfigureHooks -> ConfigureHooks # mconcat :: [ConfigureHooks] -> ConfigureHooks # | |
Semigroup ConfigureHooks Source # | |
Defined in Distribution.Simple.SetupHooks.Internal (<>) :: ConfigureHooks -> ConfigureHooks -> ConfigureHooks # sconcat :: NonEmpty ConfigureHooks -> ConfigureHooks # stimes :: Integral b => b -> ConfigureHooks -> ConfigureHooks # |
noConfigureHooks :: ConfigureHooks Source #
Empty configure phase hooks.
Per-package configure hooks
data PreConfPackageInputs Source #
Inputs to the package-wide pre-configure step.
PreConfPackageInputs | |
|
Instances
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
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
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
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
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.
newtype ComponentDiff Source #
Instances
Structured ComponentDiff Source # | |
Defined in Distribution.Simple.SetupHooks.Internal structure :: Proxy ComponentDiff -> Structure structureHash' :: Tagged ComponentDiff MD5 | |
Semigroup ComponentDiff Source # | |
Defined in Distribution.Simple.SetupHooks.Internal (<>) :: ComponentDiff -> ComponentDiff -> ComponentDiff # sconcat :: NonEmpty ComponentDiff -> ComponentDiff # stimes :: Integral b => b -> ComponentDiff -> ComponentDiff # | |
Show ComponentDiff Source # | |
Defined in Distribution.Simple.SetupHooks.Internal showsPrec :: Int -> ComponentDiff -> ShowS # show :: ComponentDiff -> String # showList :: [ComponentDiff] -> ShowS # | |
Binary ComponentDiff Source # | |
Defined in Distribution.Simple.SetupHooks.Internal |
buildInfoComponentDiff :: ComponentName -> BuildInfo -> ComponentDiff Source #
type LibraryDiff = Library Source #
type ForeignLibDiff = ForeignLib Source #
type ExecutableDiff = Executable Source #
type TestSuiteDiff = TestSuite Source #
type BenchmarkDiff = Benchmark Source #
type BuildInfoDiff = BuildInfo Source #
Build hooks
data BuildHooks Source #
Build-time hooks.
BuildHooks | |
|
Instances
Monoid BuildHooks Source # | |
Defined in Distribution.Simple.SetupHooks.Internal mempty :: BuildHooks # mappend :: BuildHooks -> BuildHooks -> BuildHooks # mconcat :: [BuildHooks] -> BuildHooks # | |
Semigroup BuildHooks Source # | |
Defined in Distribution.Simple.SetupHooks.Internal (<>) :: BuildHooks -> BuildHooks -> BuildHooks # sconcat :: NonEmpty BuildHooks -> BuildHooks # stimes :: Integral b => b -> BuildHooks -> BuildHooks # |
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?
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
buildingWhatWorkingDir :: BuildingWhat -> Maybe (SymbolicPath CWD (Dir Pkg)) Source #
buildingWhatDistPref :: BuildingWhat -> SymbolicPath Pkg (Dir Dist) Source #
Pre-build rules
data PreBuildComponentInputs Source #
PreBuildComponentInputs | |
|
Instances
Post-build hook
data PostBuildComponentInputs Source #
Instances
type PostBuildComponentHook = PostBuildComponentInputs -> IO () Source #
Install hooks
data InstallHooks Source #
Copy/install hooks.
InstallHooks | |
|
Instances
Monoid InstallHooks Source # | |
Defined in Distribution.Simple.SetupHooks.Internal mempty :: InstallHooks # mappend :: InstallHooks -> InstallHooks -> InstallHooks # mconcat :: [InstallHooks] -> InstallHooks # | |
Semigroup InstallHooks Source # | |
Defined in Distribution.Simple.SetupHooks.Internal (<>) :: InstallHooks -> InstallHooks -> InstallHooks # sconcat :: NonEmpty InstallHooks -> InstallHooks # stimes :: Integral b => b -> InstallHooks -> InstallHooks # |
noInstallHooks :: InstallHooks Source #
Empty copy/install hooks.
data InstallComponentInputs Source #
Instances
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
applyComponentDiffs :: Verbosity -> (Component -> IO (Maybe ComponentDiff)) -> PackageDescription -> IO PackageDescription Source #
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
hookedBuildInfoComponents :: HookedBuildInfo -> Set ComponentName Source #
hookedBuildInfoComponentDiff_maybe :: HookedBuildInfo -> ComponentName -> Maybe (IO ComponentDiff) Source #