buildwrapper-0.9.0: A library and an executable that provide an easy API for a Haskell IDE

Copyright(c) JP Moresmau 2011
LicenseBSD3
Maintainerjpmoresmau@gmail.com
Stabilitybeta
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Language.Haskell.BuildWrapper.Cabal

Description

Cabal operations: configure, build, retrieve information from build info, parse errors and warnings

Synopsis

Documentation

getCabalLibraryVersion :: String Source

get the version of the cabal library

getFilesToCopy :: BuildWrapper (OpResult [FilePath]) Source

get all files to copy to temp folder

cabalV :: BuildWrapper Verbosity Source

get cabal verbose level

cabalBuild Source

Arguments

:: Bool

do we want output (True) or just compilation without linking?

-> WhichCabal

use original cabal or temp cabal file

-> BuildWrapper (OpResult BuildResult) 

run cabal build

cabalBuild' Source

Arguments

:: Bool

can we rerun configure again

-> Bool

do we want output (True) or just compilation without linking?

-> WhichCabal

use original cabal or temp cabal file

-> BuildWrapper (OpResult BuildResult) 

run cabal build

targetFile :: String Source

the file where we save the targets

cabalConfigure Source

Arguments

:: WhichCabal

use original cabal or temp cabal file

-> BuildWrapper (OpResult (Maybe [Target]))

return the build info on success, or Nothing on failure

run cabal configure

getCabalFile Source

Arguments

:: WhichCabal

use original cabal or temp cabal file

-> BuildWrapper FilePath 

get the full path to the cabal file

getPackageName :: BuildWrapper String Source

get package name from cabal file

cabalInit Source

Arguments

:: WhichCabal

use original cabal or temp cabal file

-> BuildWrapper (OpResult (Maybe [Target])) 

get Cabal build info, running configure if needed

withCabal Source

Arguments

:: WhichCabal

use original cabal or temp cabal file

-> ([Target] -> BuildWrapper a)

action to run if we get a build info

-> BuildWrapper (OpResult (Maybe a))

the result of the action, or Nothing if we could get Cabal info

run a action with the cabal build info

parseCabalMessages Source

Arguments

:: FilePath

cabal file

-> FilePath

path to cabal executable

-> String

error output

-> [BWNote] 

parse cabal error messages and transform them in notre

setupExe Source

Arguments

:: FilePath

path to cabal executable

-> FilePath 

get the setup exe file name

fromCabalDevExe Source

Arguments

:: FilePath

path to cabal executable

-> FilePath 

get cabal executable from cabal-dev

dropPrefixes :: [String] -> String -> Maybe String Source

drop all potential prefixes from the given string

stripPrefixIfNeeded :: String -> String -> Maybe String -> Maybe String Source

stop prefix if the given string starts by it

addCurrent :: Maybe (BWNote, [String]) -> [BWNote] -> [BWNote] Source

add a note with a potential additional message

cabalErrorLine Source

Arguments

:: FilePath

cabal file

-> FilePath

path to cabal executable

-> String

line

-> Bool

first error?

-> Maybe (BWNote, [String]) 

parse a Cabal error line

parseBuildMessages Source

Arguments

:: FilePath

cabal file

-> FilePath

path to cabal executable

-> FilePath

the dist directory

-> String

the build output

-> [BWNote] 

parse messages from build

validLoc Source

Arguments

:: FilePath

the cabal file

-> FilePath

the dist dir

-> FilePath 
-> FilePath 

get a valid path

readInt :: String -> Int -> Int Source

read an integer and return a default value if not readable

tryReadList :: Read a => String -> [a] Source

read a list and return the empty list if not readable

makeNote Source

Arguments

:: BWNote

original note

-> [String]

message lines

-> BWNote 

add a message to the note

getBuiltPath Source

Arguments

:: String

the message line

-> Maybe FilePath

the path if we could parse it

get the path of a file getting compiled

data CabalBuildInfo Source

the cabal build info for a specific component

Constructors

CabalBuildInfo 

Fields

cbiTarget :: Target

the target

cbiBuildFolder :: FilePath

the folder to build that component into

cbiIsLibrary :: Bool

is the component the library

cbiModulePaths :: [(Maybe ModuleName, FilePath)]

the module name and corresponding source file for each contained Haskell module

cbiComponent :: CabalComponent

the component handle

canonicalizeBuildInfo :: CabalBuildInfo -> BuildWrapper CabalBuildInfo Source

canonicalize the paths in the build info

onModulePathsM Source

Arguments

:: Monad a 
=> ([(Maybe ModuleName, FilePath)] -> a [(Maybe ModuleName, FilePath)])

the function to apply

-> CabalBuildInfo

the original build info

-> a CabalBuildInfo

the result

apply a function on the build info modules and paths, in a monad

onModulePaths Source

Arguments

:: ([(Maybe ModuleName, FilePath)] -> [(Maybe ModuleName, FilePath)])

the function to apply

-> CabalBuildInfo

the original build info

-> CabalBuildInfo

the result

apply a function on the build info modules and paths

getBuildInfo Source

Arguments

:: FilePath

the source file

-> Maybe String

the cabal component to use, or Nothing if not specified

-> BuildWrapper (OpResult (Maybe ([Target], CabalBuildInfo))) 

get the build info for a given source file if a source file is in several component, get the first one

setOptions Source

Arguments

:: FilePath

dist directory

-> Maybe FilePath

path to GHC if explicitely specified

-> [Target]

targets to set options onto

-> IO [Target] 

set the GHC options on targets

fileGhcOptions Source

Arguments

:: CabalBuildInfo

the cabal info

-> BuildWrapper [String]

the module name and the options to pass GHC

get GHC options for a file

fileCppOptions Source

Arguments

:: CabalBuildInfo

the cabal info

-> [String]

the list of CPP options

get CPP options for a file

cabalExtensions Source

Arguments

:: CabalBuildInfo

the cabal info

-> (ModuleName, [String])

the module name and cabal extensions

get the cabal extensions

getSourceDirs Source

Arguments

:: Target

the build info

-> [FilePath]

the source paths, guaranteed non null

get the source directory from a build info

getAllFiles Source

Arguments

:: [Target]

the build info

-> BuildWrapper [CabalBuildInfo] 

get all components, referencing all the files found in the source folders

getBuildDir :: FilePath -> Target -> FilePath Source

get build dir for a target

getReferencedFiles :: [Target] -> BuildWrapper [CabalBuildInfo] Source

get all components, referencing only the files explicitely indicated in the cabal file

stringToModuleName :: String -> Maybe ModuleName Source

parse a string into a module name

moduleToString :: ModuleName -> String Source

convert a ModuleName to a String

cabalComponents :: BuildWrapper (OpResult [CabalComponent]) Source

get all components in the Cabal file

cabalDependencies Source

Arguments

:: Maybe FilePath

the path to the cabal-dev sandbox if any

-> BuildWrapper (OpResult [(FilePath, [CabalPackage])])

the result is an array of tuples: the path to the package database, the list of packages in that db that the Cabal file references

get all the dependencies in the cabal file

dependencies Source

Arguments

:: [Target]

the cabal description

-> [(FilePath, [InstalledPackageInfo])]

the installed packages, by package database location

-> [(FilePath, [CabalPackage])]

the referenced packages, by package database location

get all dependencies from the package description and the list of installed packages

cabalComponentsFromDescription Source

Arguments

:: [Target]

the package description

-> [CabalComponent] 

get all components from the package description

cabalComponentsDependencies Source

Arguments

:: [Target]

the package description

-> Map CabalComponent [(String, Maybe Version)] 

get dependencies for all stanzas

cabalComponentFromTarget :: Target -> CabalComponent Source

convert a dynamic cabla target into a CabalComponent

cabalComponentFromLibrary :: Target -> CabalComponent Source

transform a library target into a CabalComponent

cabalComponentFromExecutable :: Target -> CabalComponent Source

transform an executable target into a CabalComponent

cabalComponentFromTestSuite :: Target -> CabalComponent Source

transform a test suite target into a CabalComponent

cabalComponentFromBenchmark :: Target -> CabalComponent Source

transform a benchmark target into a CabalComponent