summaryrefslogtreecommitdiff
path: root/Biz/Bild.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Biz/Bild.hs')
-rw-r--r--Biz/Bild.hs36
1 files changed, 22 insertions, 14 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs
index 2eaf840..007bda8 100644
--- a/Biz/Bild.hs
+++ b/Biz/Bild.hs
@@ -150,9 +150,9 @@ import qualified System.Process as Process
import qualified Text.Regex.Applicative as Regex
main :: IO ()
-main = Cli.main <| Cli.Plan help move test pure
+main = Cli.main <| Cli.Plan help move test_ pure
where
- test =
+ test_ =
Test.group
"Biz.Bild"
[ Test.unit "can bild bild" <| do
@@ -450,8 +450,25 @@ isSuccess :: Exit.ExitCode -> Bool
isSuccess Exit.ExitSuccess = True
isSuccess _ = False
+test :: Bool -> Target -> IO Exit.ExitCode
+test loud Target {..} = case compiler of
+ GhcExe -> do
+ root <- Env.getEnv "BIZ_ROOT"
+ run
+ <| Proc
+ { loud = loud,
+ cmd = root </> bindir </> Maybe.fromJust out,
+ args = ["test"],
+ ns = namespace,
+ onFailure = Log.fail ["test", nschunk namespace] >> Log.br,
+ onSuccess = Log.pass ["test", nschunk namespace] >> Log.br
+ }
+ _ -> do
+ Log.warn ["test", nschunk namespace, "unavailable"] >> Log.br
+ pure Exit.ExitSuccess
+
build :: Bool -> Bool -> Target -> IO Exit.ExitCode
-build andTest loud Target {..} = do
+build andTest loud target@Target {..} = do
root <- Env.getEnv "BIZ_ROOT"
case compiler of
GhcExe -> do
@@ -475,16 +492,7 @@ build andTest loud Target {..} = do
root </> bindir </> Maybe.fromJust out
]
if andTest && isSuccess exitcode
- then
- run
- <| Proc
- { loud = loud,
- cmd = root </> bindir </> Maybe.fromJust out,
- args = ["test"],
- ns = namespace,
- onFailure = Log.fail ["test", nschunk namespace] >> Log.br,
- onSuccess = Log.pass ["test", nschunk namespace] >> Log.br
- }
+ then test loud target
else pure exitcode
GhcLib -> do
Log.info ["bild", "dev", "ghc-lib", nschunk namespace]
@@ -582,7 +590,7 @@ build andTest loud Target {..} = do
namespace
"nix-build"
[ path,
- "-o",
+ "--out-link",
root </> nixdir </> Namespace.toPath namespace,
"--builders",
Text.unpack builder