module B9.Shake.Actions (b9InvokationAction, buildB9File) where
import Development.Shake
import Development.Shake.FilePath
import B9
b9InvokationAction :: B9Invokation a -> Action (a, Bool)
b9InvokationAction = liftIO . runB9 . defaultB9RunParameters
buildB9File :: FilePath -> FilePath -> [String] -> Action ()
buildB9File b9Root b9File args = do
let f = b9Root </> b9File
need [f]
(_, success) <- b9InvokationAction $ do
modifyInvokationConfig (appendPositionalArguments args)
overrideWorkingDirectory b9Root
runBuildArtifacts [f]
if success then return () else fail $ "ERROR: Build failed: " ++ f