-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A simple, forward build system. -- -- Dib is a simple, forward build system consisting of a library and a -- driver application. Build scripts are written in Haskell instead of a -- bespoke language. @package dib @version 0.5.0 -- | Module containing utility functions and common functionality. module Dib.Util -- | Given a directory, returns the list of subdirectories. getSubDirectories :: FilePath -> IO [FilePath] -- | Module exposing the Stage type and related type wrappers, along -- with a convenience emptyStage. module Dib.Stage -- | Type describing a build stage. Takes a name, an -- InputTransformer, DepScanner, additional dependencies, -- and the builder function. data Stage Stage :: Text -> InputTransformer -> DepScanner -> [Text] -> StageFunc -> Stage -- | Type wrapper for functions transforming a list of SrcTransforms -- into a list of SrcTransforms suitable for passing into the -- DepScanner. type InputTransformer = [SrcTransform] -> [SrcTransform] -- | Type wrapper for a function that takes a SrcTransform and -- produces a SrcTransform with dependencies included in the -- input. type DepScanner = SrcTransform -> IO SrcTransform -- | Type wrapper for a function that given a SrcTransform, produces -- either a SrcTransform containing the output files in the input, -- or an error. type StageFunc = SrcTransform -> IO (Either SrcTransform Text) -- | A stage that does nothing and just passes the SrcTransforms -- through. emptyStage :: Stage -- | C dependency scanner. Runs a stripped-down pre-processor to scan for -- include files (recursively). module Dib.Scanners.CDepScanner -- | Takes in a list of include directories, extra dependencies, a -- SrcTransform, and returns a new SrcTransform with the -- dependencies injected into the source side. cDepScanner :: [FilePath] -> SrcTransform -> IO SrcTransform instance Control.Monad.State.Class.MonadState Dib.Scanners.CDepScanner.ParseState Dib.Scanners.CDepScanner.DepGatherer instance Control.Monad.IO.Class.MonadIO Dib.Scanners.CDepScanner.DepGatherer instance GHC.Base.Monad Dib.Scanners.CDepScanner.DepGatherer instance GHC.Base.Applicative Dib.Scanners.CDepScanner.DepGatherer instance GHC.Base.Functor Dib.Scanners.CDepScanner.DepGatherer instance GHC.Show.Show Dib.Scanners.CDepScanner.ParseState instance GHC.Show.Show Dib.Scanners.CDepScanner.Dependency instance GHC.Classes.Eq Dib.Scanners.CDepScanner.Dependency instance GHC.Classes.Ord Dib.Scanners.CDepScanner.Dependency -- | Module that exposes all of the various GatherStrategy types and -- functions for dealing with them. module Dib.Gatherers -- | Gatherer that will return exactly one file. data SingleFileGatherer -- | Gatherer that will return all files in a given directory (but -- not its subdirectories) that pass the filter. data DirectoryGatherer -- | Gatherer that will return all files in a given directory tree -- that pass the filter. data FileTreeGatherer -- | Existential data type for wrapping GatherStrategys so they can -- be used as a uniform type. data Gatherer -- | Gatherer that will run a command and return an empty list. -- Useful for making clean Targets. Use sparingly. data CommandGatherer -- | Convenience function to turn a GatherStrategy into a -- Gatherer. wrapGatherStrategy :: GatherStrategy s => s -> Gatherer -- | Runs a list of Gatherers and returns the concatenation of their -- output. runGatherers :: [Gatherer] -> IO [Text] -- | Constructs a Gatherer that returns a single file. makeSingleFileGatherer :: Text -> Gatherer -- | Constructs a Gatherer that returns all files in a directory -- (but not its subdirectories) that match a given filter. makeDirectoryGatherer :: Text -> FilterFunc -> Gatherer -- | Constructs a Gatherer that returns all files in a directory -- tree that match a given filter. makeFileTreeGatherer :: Text -> FilterFunc -> Gatherer -- | Constructs a Gatherer that runs an arbitrary IO action. makeCommandGatherer :: IO () -> Gatherer -- | Filter function that returns all files. matchAll :: FilterFunc -- | Filter function that returns files with a given extension. matchExtension :: Text -> FilterFunc -- | Filter function that returns files with a given extension that don't -- match exclusion rules. matchExtensionExcluded :: Text -> [Text -> Bool] -> FilterFunc -- | Filter function that returns files that match any of a list of -- extensions. matchExtensions :: [Text] -> FilterFunc -- | Filter function that returns files that match any of a list of -- extensions, but don't match the exclusion rules. matchExtensionsExcluded :: [Text] -> [Text -> Bool] -> FilterFunc instance Dib.Types.GatherStrategy Dib.Types.SingleFileGatherer instance Dib.Types.GatherStrategy Dib.Types.DirectoryGatherer instance Dib.Types.GatherStrategy Dib.Types.FileTreeGatherer instance Dib.Types.GatherStrategy Dib.Types.CommandGatherer -- | Module that exposes the Target data type and a handful of -- convenience functions for dealing with Targets. module Dib.Target -- | Describes a build target. Takes a name, checksum function, list of -- dependencies, list of Stages, and a list of Gatherers. data Target Target :: Text -> ChecksumFunc -> [Target] -> [Stage] -> [Gatherer] -> Target -- | Adds a dependency on another Target. addDependency :: Target -> Target -> Target -- | Adds a dependency on a list of Targets. addDependencies :: Target -> [Target] -> Target -- | Gets dependencies of a Target. getDependencies :: Target -> [Target] -- | Makes a Target that doesn't build anything but can be used as a -- meta Target, i.e. the "all" target in make. makePhonyTarget :: Text -> [Target] -> Target -- | Makes a Target that runs an arbitrary IO action. makeCommandTarget :: Text -> [Target] -> IO () -> Target -- | Computes a checksum from the direct dependencies of a target targetDepChecksum :: Target -> Word32 -- | A builder for C/C++ code. module Dib.Builders.C -- | The record type that is used to pass configuration info for the C -- builder. data CTargetInfo CTargetInfo :: Text -> Text -> Text -> BuildLocation -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> [Text] -> [Text] -> [Text] -> [Text] -> Bool -> CTargetInfo -- | The data type for specifying where built files end up. data BuildLocation -- | Specifies that object files will end up adjacent to their source files -- and the executable will be in the same directory as the dib.hs file. InPlace :: BuildLocation -- | Specifies that the object files and executable will go in a certain -- directory. BuildDir :: Text -> BuildLocation -- | Specifies that the object files will go in the first directory and the -- executable in the second directory. ObjAndBinDirs :: Text -> Text -> BuildLocation -- | Given a CTargetInfo, produces a Target makeCTarget :: CTargetInfo -> Target -- | Given a CTargetInfo, produces a Target that will clean -- the project. makeCleanTarget :: CTargetInfo -> Target -- | Given a CTargetInfo, will make the directories required to -- build the project. makeBuildDirs :: CTargetInfo -> IO () -- | An empty configuration. emptyConfig :: CTargetInfo -- | A default configuration for gcc. defaultGCCConfig :: CTargetInfo -- | A default configuration for g++. defaultGXXConfig :: CTargetInfo -- | A default configuration for clang. defaultClangConfig :: CTargetInfo -- | A trivial builder that copies a directory tree from one location to -- another. module Dib.Builders.Copy -- | The makeCopyTarget function makes a target that copies a -- directory tree. It takes a name, a source directory, destination -- directory, and gather filter. makeCopyTarget :: Text -> Text -> Text -> FilterFunc -> [Text] -> Target -- | The Simple builder allows you to execute a OneToOne -- trasformation given a function that generates a command line from the -- source and target files. module Dib.Builders.Simple -- | The makeSimpleTarget function generates a target. It takes a -- name, source directory, destination directory, destination extension, -- gather filter, and a function to build the command line. makeSimpleTarget :: Text -> Text -> Text -> Text -> FilterFunc -> [Text] -> (String -> String -> String) -> Target -- |
-- module Main where -- import Dib -- -- targets = [] -- main = dib targets ---- -- A build script is expected to declare the available Targets and -- then pass them to the dib function. Only the top-level -- Targets need to be passed to dib; it will scrape out the -- dependencies from there. The first Target in the list is the -- default Target to build if the dib executable is called with no -- arguments. -- --