| Cabal-1.6.0.3: A framework for packaging Haskell software | Source code | Contents | Index

Distribution.Simple.UserHooks

Portability | portable
Maintainer | cabal-devel@haskell.org

Description

This defines the API that `Setup.hs` scripts can use to customise the way the build works. This module just defines the `UserHooks` type. The predefined sets of hooks that implement the `Simple`, `Make` and `Configure` build systems are defined in Distribution.Simple. The `UserHooks` is a big record of functions. There are 3 for each action, a pre, post and the action itself. There are few other miscellaneous hooks, ones to extend the set of programs and preprocessors and one to override the function used to read the `.cabal` file.

This hooks type is widely agreed to not be the right solution. Partly this is because changes to it usually break custom `Setup.hs` files and yet many internal code changes do require changes to the hooks. For example we cannot pass any extra parameters to most of the functions that implement the various phases because it would involve changing the types of the corresponding hook. At some point it will have to be replaced.

Synopsis

data UserHooks = UserHooks {

runTests :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO ()
readDesc :: IO (Maybe PackageDescription)
hookedPreProcessors :: [PPSuffixHandler]
hookedPrograms :: [Program]
preConf :: Args -> ConfigFlags -> IO HookedBuildInfo
confHook :: (Either GenericPackageDescription PackageDescription, HookedBuildInfo) -> ConfigFlags -> IO LocalBuildInfo
postConf :: Args -> ConfigFlags -> PackageDescription -> LocalBuildInfo -> IO ()
preBuild :: Args -> BuildFlags -> IO HookedBuildInfo
buildHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> BuildFlags -> IO ()
postBuild :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO ()
preMakefile :: Args -> MakefileFlags -> IO HookedBuildInfo
makefileHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> MakefileFlags -> IO ()
postMakefile :: Args -> MakefileFlags -> PackageDescription -> LocalBuildInfo -> IO ()
preClean :: Args -> CleanFlags -> IO HookedBuildInfo
cleanHook :: PackageDescription -> Maybe LocalBuildInfo -> UserHooks -> CleanFlags -> IO ()
postClean :: Args -> CleanFlags -> PackageDescription -> Maybe LocalBuildInfo -> IO ()
preCopy :: Args -> CopyFlags -> IO HookedBuildInfo
copyHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> CopyFlags -> IO ()
postCopy :: Args -> CopyFlags -> PackageDescription -> LocalBuildInfo -> IO ()
preInst :: Args -> InstallFlags -> IO HookedBuildInfo
instHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> InstallFlags -> IO ()
postInst :: Args -> InstallFlags -> PackageDescription -> LocalBuildInfo -> IO ()
preSDist :: Args -> SDistFlags -> IO HookedBuildInfo
sDistHook :: PackageDescription -> Maybe LocalBuildInfo -> UserHooks -> SDistFlags -> IO ()
postSDist :: Args -> SDistFlags -> PackageDescription -> Maybe LocalBuildInfo -> IO ()
preReg :: Args -> RegisterFlags -> IO HookedBuildInfo
regHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> RegisterFlags -> IO ()
postReg :: Args -> RegisterFlags -> PackageDescription -> LocalBuildInfo -> IO ()
preUnreg :: Args -> RegisterFlags -> IO HookedBuildInfo
unregHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> RegisterFlags -> IO ()
postUnreg :: Args -> RegisterFlags -> PackageDescription -> LocalBuildInfo -> IO ()
preHscolour :: Args -> HscolourFlags -> IO HookedBuildInfo
hscolourHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> HscolourFlags -> IO ()
postHscolour :: Args -> HscolourFlags -> PackageDescription -> LocalBuildInfo -> IO ()
preHaddock :: Args -> HaddockFlags -> IO HookedBuildInfo
haddockHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> HaddockFlags -> IO ()
postHaddock :: Args -> HaddockFlags -> PackageDescription -> LocalBuildInfo -> IO ()

}

type Args = [String]
emptyUserHooks :: UserHooks

Documentation

data UserHooks | Source

Hooks allow authors to add specific functionality before and after a command is run, and also to specify additional preprocessors.

- WARNING: The hooks interface is under rather constant flux as we try to understand users needs. Setup files that depend on this interface may break in future releases.

Constructors

UserHooks |

runTests :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO () | Used for `./setup test`
readDesc :: IO (Maybe PackageDescription) | Read the description file
hookedPreProcessors :: [PPSuffixHandler] | Custom preprocessors in addition to and overriding knownSuffixHandlers.
hookedPrograms :: [Program] | These programs are detected at configure time. Arguments for them are added to the configure command.
preConf :: Args -> ConfigFlags -> IO HookedBuildInfo | Hook to run before configure command
confHook :: (Either GenericPackageDescription PackageDescription, HookedBuildInfo) -> ConfigFlags -> IO LocalBuildInfo | Over-ride this hook to get different behavior during configure.
postConf :: Args -> ConfigFlags -> PackageDescription -> LocalBuildInfo -> IO () | Hook to run after configure command
preBuild :: Args -> BuildFlags -> IO HookedBuildInfo | Hook to run before build command. Second arg indicates verbosity level.
buildHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> BuildFlags -> IO () | Over-ride this hook to gbet different behavior during build.
postBuild :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO () | Hook to run after build command. Second arg indicates verbosity level.
preMakefile :: Args -> MakefileFlags -> IO HookedBuildInfo | Hook to run before makefile command. Second arg indicates verbosity level.
makefileHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> MakefileFlags -> IO () | Over-ride this hook to get different behavior during makefile.
postMakefile :: Args -> MakefileFlags -> PackageDescription -> LocalBuildInfo -> IO () | Hook to run after makefile command. Second arg indicates verbosity level.
preClean :: Args -> CleanFlags -> IO HookedBuildInfo | Hook to run before clean command. Second arg indicates verbosity level.
cleanHook :: PackageDescription -> Maybe LocalBuildInfo -> UserHooks -> CleanFlags -> IO () | Over-ride this hook to get different behavior during clean.
postClean :: Args -> CleanFlags -> PackageDescription -> Maybe LocalBuildInfo -> IO () | Hook to run after clean command. Second arg indicates verbosity level.
preCopy :: Args -> CopyFlags -> IO HookedBuildInfo | Hook to run before copy command
copyHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> CopyFlags -> IO () | Over-ride this hook to get different behavior during copy.
postCopy :: Args -> CopyFlags -> PackageDescription -> LocalBuildInfo -> IO () | Hook to run after copy command
preInst :: Args -> InstallFlags -> IO HookedBuildInfo | Hook to run before install command
instHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> InstallFlags -> IO () | Over-ride this hook to get different behavior during install.
postInst :: Args -> InstallFlags -> PackageDescription -> LocalBuildInfo -> IO () | Hook to run after install command. postInst should be run on the target, not on the build machine.
preSDist :: Args -> SDistFlags -> IO HookedBuildInfo | Hook to run before sdist command. Second arg indicates verbosity level.
sDistHook :: PackageDescription -> Maybe LocalBuildInfo -> UserHooks -> SDistFlags -> IO () | Over-ride this hook to get different behavior during sdist.
postSDist :: Args -> SDistFlags -> PackageDescription -> Maybe LocalBuildInfo -> IO () | Hook to run after sdist command. Second arg indicates verbosity level.
preReg :: Args -> RegisterFlags -> IO HookedBuildInfo | Hook to run before register command
regHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> RegisterFlags -> IO () | Over-ride this hook to get different behavior during registration.
postReg :: Args -> RegisterFlags -> PackageDescription -> LocalBuildInfo -> IO () | Hook to run after register command
preUnreg :: Args -> RegisterFlags -> IO HookedBuildInfo | Hook to run before unregister command
unregHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> RegisterFlags -> IO () | Over-ride this hook to get different behavior during registration.
postUnreg :: Args -> RegisterFlags -> PackageDescription -> LocalBuildInfo -> IO () | Hook to run after unregister command
preHscolour :: Args -> HscolourFlags -> IO HookedBuildInfo | Hook to run before hscolour command. Second arg indicates verbosity level.
hscolourHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> HscolourFlags -> IO () | Over-ride this hook to get different behavior during hscolour.
postHscolour :: Args -> HscolourFlags -> PackageDescription -> LocalBuildInfo -> IO () | Hook to run after hscolour command. Second arg indicates verbosity level.
preHaddock :: Args -> HaddockFlags -> IO HookedBuildInfo | Hook to run before haddock command. Second arg indicates verbosity level.
haddockHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> HaddockFlags -> IO () | Over-ride this hook to get different behavior during haddock.
postHaddock :: Args -> HaddockFlags -> PackageDescription -> LocalBuildInfo -> IO () | Hook to run after haddock command. Second arg indicates verbosity level.

type Args = [String] | Source

emptyUserHooks :: UserHooks | Source

Empty `UserHooks` which do nothing.
Produced by Haddock version 2.4.2