summaryrefslogtreecommitdiff
path: root/Biz
diff options
context:
space:
mode:
Diffstat (limited to 'Biz')
-rw-r--r--Biz/Bild.hs44
1 files changed, 16 insertions, 28 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs
index ea5875f..07a4fee 100644
--- a/Biz/Bild.hs
+++ b/Biz/Bild.hs
@@ -223,8 +223,7 @@ instance Aeson.ToJSON Out where
data Compiler
= Copy
| Gcc
- | GhcLib
- | GhcExe
+ | Ghc
| Guile
| NixBuild
| Rustc
@@ -236,8 +235,7 @@ instance Aeson.ToJSON Compiler where
Aeson.String <. \case
Copy -> "cp"
Gcc -> "gcc"
- GhcLib -> "ghc"
- GhcExe -> "ghc"
+ Ghc -> "ghc"
Guile -> "guile"
NixBuild -> "nix-build"
Rustc -> "rustc"
@@ -420,7 +418,7 @@ analyze hmap ns = case Map.lookup ns hmap of
</ pure
Target
{ builder = Local <| user,
- compiler = detectGhcCompiler out,
+ compiler = Ghc,
compilerFlags =
map
Text.pack
@@ -592,14 +590,6 @@ ghcPkgFindModule acc m = do
/> Set.fromList
/> Set.union acc
--- | Some rules for detecting the how to compile a ghc module. If there is an
--- out, then we know it's some Exe, otherwise it's a Lib.
-detectGhcCompiler :: Out -> Compiler
-detectGhcCompiler = \case
- Bin _ -> GhcExe
- Lib _ -> GhcLib
- None -> GhcLib
-
isFailure :: Exit.ExitCode -> Bool
isFailure (Exit.ExitFailure _) = True
isFailure Exit.ExitSuccess = False
@@ -610,7 +600,7 @@ isSuccess _ = False
test :: Bool -> Target -> IO Exit.ExitCode
test loud Target {..} = case compiler of
- GhcExe -> do
+ Ghc -> do
root <- Env.getEnv "BIZ_ROOT"
run
<| Proc
@@ -624,7 +614,7 @@ test loud Target {..} = case compiler of
_ ->
Log.warn ["test", nschunk namespace, "unavailable"]
>> Log.br
- >> pure Exit.ExitSuccess
+ >> pure (Exit.ExitFailure 1)
build :: Bool -> Bool -> Analysis -> IO [Exit.ExitCode]
build andTest loud analysis = do
@@ -638,19 +628,17 @@ build andTest loud analysis = do
label = case out of
Bin _ -> "bin"
_ -> "lib"
- GhcExe -> do
- Log.info ["bild", "dev", "ghc-exe", nschunk namespace]
- exitcode <- proc loud namespace "ghc" compilerFlags
- if andTest && isSuccess exitcode
- then test loud target
- else pure exitcode
- GhcLib -> do
- Log.info ["bild", "dev", "ghc-lib", nschunk namespace]
- proc
- loud
- namespace
- "ghc"
- compilerFlags
+ Ghc -> case out of
+ None -> pure Exit.ExitSuccess
+ Bin _ -> do
+ Log.info ["bild", "dev", "ghc-exe", nschunk namespace]
+ exitcode <- proc loud namespace "ghc" compilerFlags
+ if andTest && isSuccess exitcode
+ then test loud target
+ else pure exitcode
+ Lib _ -> do
+ Log.info ["bild", "dev", "ghc-lib", nschunk namespace]
+ proc loud namespace "ghc" compilerFlags
Guile -> do
Log.info ["bild", "dev", "guile", nschunk namespace]
_ <- proc loud namespace "guild" compilerFlags