Safe Haskell | None |
---|---|
Language | Haskell2010 |
A module for producing forward-defined build systems, in contrast to standard backwards-defined build systems such as shake. Based around ideas from fabricate. As an example:
import Development.Shake import Development.Shake.Forward import Development.Shake.FilePath main =shakeArgsForward
shakeOptions
$ do contents <-readFileLines
"result.txt"cache
$cmd
"tar -cf result.tar" contents
Compared to backward-defined build systems (such as normal Shake), forward-defined build systems tend to be simpler for simple systems (less boilerplate, more direct style), but more complex for larger build systems (requires explicit parallelism, explicit sharing of build products, no automatic command line targets). As a general approach for writing forward-defined systems:
- Figure out the sequence of system commands that will build your project.
- Write a simple
Action
that builds your project. - Insert
cache
in front of most system commands. - Replace most loops with
forP
, where they can be executed in parallel. - Where Haskell performs real computation, if zero-build performance is insufficient, use
cacheAction
.
All forward-defined systems use AutoDeps
, which requires fsatrace
to be on the $PATH
.
You can obtain fsatrace
from https://github.com/jacereda/fsatrace.
- shakeForward :: ShakeOptions -> Action () -> IO ()
- shakeArgsForward :: ShakeOptions -> Action () -> IO ()
- forwardOptions :: ShakeOptions -> ShakeOptions
- forwardRule :: Action () -> Rules ()
- cache :: (forall r. CmdArguments r => r) -> Action ()
- cacheAction :: String -> Action () -> Action ()
Documentation
shakeForward :: ShakeOptions -> Action () -> IO () Source #
Run a forward-defined build system.
shakeArgsForward :: ShakeOptions -> Action () -> IO () Source #
Run a forward-defined build system, interpreting command-line arguments.
forwardOptions :: ShakeOptions -> ShakeOptions Source #
Given a ShakeOptions
, set the options necessary to execute in forward mode.
forwardRule :: Action () -> Rules () Source #
cache :: (forall r. CmdArguments r => r) -> Action () Source #
Apply caching to an external command.