diff options
Diffstat (limited to 'Biz/Bild.hs')
-rw-r--r-- | Biz/Bild.hs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs index 0fd5bb4..721da46 100644 --- a/Biz/Bild.hs +++ b/Biz/Bild.hs @@ -125,10 +125,8 @@ import qualified Data.Char as Char import qualified Data.List as List import qualified Data.String as String import qualified Data.Text as Text -import qualified System.Console.Docopt as Docopt import qualified System.Directory as Dir import qualified System.Environment as Env -import qualified System.Exit as Exit import System.FilePath ((</>)) import qualified System.Process as Process import qualified Text.Regex.Applicative as Regex @@ -137,24 +135,24 @@ import qualified Prelude main :: IO () main = Cli.main <| Cli.Plan help move test where - test = Test.group "Biz.Bild" [Test.unit "id" <| 1 @=? 1] + test = Test.group "Biz.Bild" [Test.unit "id" <| 1 @=? (1 :: Integer)] move args = - mapM getNamespace (Docopt.getAllArgs args (Docopt.argument "target")) + mapM getNamespace (Cli.getAllArgs args (Cli.argument "target")) /> catMaybes /> filter isBuildableNs >>= mapM analyze - >>= mapM_ build + >>= mapM_ (build (args `Cli.has` Cli.longOption "test")) -help :: Docopt.Docopt +help :: Cli.Docopt help = - [Docopt.docopt| + [Cli.docopt| bild Usage: - bild <target>... + bild [--test] <target>... Options: - -v, --verbose Show output from underlying compiler + --test Run tests on a target after building. |] type Dep = String @@ -286,8 +284,8 @@ detectGhcCompiler _ content jsSuffix :: String -> Bool jsSuffix = List.isSuffixOf ".js" -build :: Target -> IO () -build target@Target {..} = do +build :: Bool -> Target -> IO () +build andTest target@Target {..} = do root <- Env.getEnv "BIZ_ROOT" case compiler of GhcExe -> do @@ -310,6 +308,9 @@ build target@Target {..} = do "-o", outDir </> out ] + when andTest <| do + putStrLn <| "bild: dev: test: " <> Namespace.toPath namespace + Process.callProcess (outDir </> out) ["test"] GhcLib -> do putStrLn <| "bild: dev: ghc-lib: " <> Namespace.toPath namespace putText <| "bild: dev: bilder: " <> Text.pack builder |