summaryrefslogtreecommitdiff
path: root/Biz/Bild.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2023-09-21 22:30:17 -0400
committerBen Sima <ben@bsima.me>2023-10-03 21:33:37 -0400
commit4226cbd8020253b010fb44d395db12efe68e1272 (patch)
tree4ee121a0cf26098b1cec1feed24c2cdd8e036562 /Biz/Bild.hs
parentdbdf4da2576f889544a33ce0bad4b8a5ff3eca87 (diff)
Rename BIZ_ROOT to CODEROOT
BIZ_ROOT was too specific. CODEROOT allows for other (non-biz) projects to live in the root of the repo. I didn't want to call it GIT_ROOT because maybe someday I won't want to use git. But I'll never not use code.
Diffstat (limited to 'Biz/Bild.hs')
-rw-r--r--Biz/Bild.hs28
1 files changed, 14 insertions, 14 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs
index 1e0422a..c1dfefd 100644
--- a/Biz/Bild.hs
+++ b/Biz/Bild.hs
@@ -163,7 +163,7 @@ main = Cli.Plan help move test_ pure |> Cli.main
test_bildBild :: Test.Tree
test_bildBild =
Test.unit "can bild bild" <| do
- root <- Env.getEnv "BIZ_ROOT"
+ root <- Env.getEnv "CODEROOT"
path <- Dir.makeAbsolute "Biz/Bild.hs"
case Namespace.fromPath root path of
Nothing -> Test.assertFailure "can't find ns for bild"
@@ -179,7 +179,7 @@ test_bildBild =
test_bildExamples :: Test.Tree
test_bildExamples =
Test.unit "can bild examples" <| do
- Env.getEnv "BIZ_ROOT" +> \root ->
+ Env.getEnv "CODEROOT" +> \root ->
["c", "hs", "lisp", "rs"]
|> map ("Biz/Bild/Example." <>)
|> traverse Dir.makeAbsolute
@@ -194,7 +194,7 @@ test_bildExamples =
move :: Cli.Arguments -> IO ()
move args =
IO.hSetBuffering stdout IO.NoBuffering
- >> Env.getEnv "BIZ_ROOT" +> \root ->
+ >> Env.getEnv "CODEROOT" +> \root ->
Cli.getAllArgs args (Cli.argument "target")
|> filter (not <. Namespace.isCab)
|> filterM Dir.doesFileExist
@@ -226,7 +226,7 @@ move args =
| args `Cli.has` Cli.longOption "json" =
Log.wipe >> putJSON targets >> pure [Exit.ExitSuccess]
| otherwise = do
- root <- Env.getEnv "BIZ_ROOT"
+ root <- Env.getEnv "CODEROOT"
createHier root
build isTest isLoud targets
isTest = args `Cli.has` Cli.longOption "test"
@@ -331,7 +331,7 @@ data Target = Target
-- | Use this to just get a target to play with at the repl.
dev_getTarget :: FilePath -> IO Target
dev_getTarget fp = do
- root <- Env.getEnv "BIZ_ROOT"
+ root <- Env.getEnv "CODEROOT"
path <- Dir.makeAbsolute fp
Namespace.fromPath root path
|> \case
@@ -446,7 +446,7 @@ analyze hmap ns = case Map.lookup ns hmap of
analyzeOne :: Namespace -> IO (Maybe Target)
analyzeOne namespace@(Namespace _ ext) = do
let path = Namespace.toPath namespace
- root <- Env.getEnv "BIZ_ROOT"
+ root <- Env.getEnv "CODEROOT"
let abspath = root </> path
let quapath = path
user <- Env.getEnv "USER" /> Text.pack
@@ -480,7 +480,7 @@ analyze hmap ns = case Map.lookup ns hmap of
"\"import py_compile;import os;"
<> "py_compile.compile(file='"
<> str quapath
- <> "', cfile=os.getenv('BIZ_ROOT')+'/_/int/"
+ <> "', cfile=os.getenv('CODEROOT')+'/_/int/"
<> str quapath
<> "', doraise=True)\""
],
@@ -531,13 +531,13 @@ analyze hmap ns = case Map.lookup ns hmap of
compilerFlags =
[ "-Werror",
"-threaded",
- "-i$BIZ_ROOT",
+ "-i$CODEROOT",
"-odir",
".",
"-hidir",
".",
"--make",
- "$BIZ_ROOT" </> quapath
+ "$CODEROOT" </> quapath
]
++ case out of
Meta.Bin o ->
@@ -665,7 +665,7 @@ analyze hmap ns = case Map.lookup ns hmap of
Meta.Bin o ->
map
Text.pack
- [ "$BIZ_ROOT" </> path,
+ [ "$CODEROOT" </> path,
"-o",
o
]
@@ -681,7 +681,7 @@ analyze hmap ns = case Map.lookup ns hmap of
detectHaskellImports :: Analysis -> [Text] -> IO (Set Meta.Dep, Set FilePath)
detectHaskellImports hmap contentLines =
- Env.getEnv "BIZ_ROOT" +> \root ->
+ Env.getEnv "CODEROOT" +> \root ->
contentLines
/> Text.unpack
/> Regex.match haskellImports
@@ -774,7 +774,7 @@ isSuccess _ = False
test :: Bool -> Target -> IO (Exit.ExitCode, ByteString)
test loud Target {..} = case compiler of
Ghc -> do
- root <- Env.getEnv "BIZ_ROOT"
+ root <- Env.getEnv "CODEROOT"
run
<| Proc
{ loud = loud,
@@ -791,7 +791,7 @@ test loud Target {..} = case compiler of
build :: Bool -> Bool -> Analysis -> IO [Exit.ExitCode]
build andTest loud analysis =
- Env.getEnv "BIZ_ROOT" +> \root ->
+ Env.getEnv "CODEROOT" +> \root ->
forM (Map.elems analysis) <| \target@Target {..} ->
fst </ case compiler of
CPython -> case out of
@@ -949,7 +949,7 @@ lispRequires =
nixBuild :: Bool -> Target -> IO (Exit.ExitCode, ByteString)
nixBuild loud target@(Target {..}) =
- Env.getEnv "BIZ_ROOT" +> \root ->
+ Env.getEnv "CODEROOT" +> \root ->
instantiate root |> run +> \case
(_, "") -> panic "instantiate did not produce a drv"
(Exit.ExitSuccess, drv) ->