diff options
author | Ben Sima <ben@bsima.me> | 2023-10-03 22:22:45 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-10-03 22:22:45 -0400 |
commit | 6107f8178e26ada67e5d5ec60501e24528b3db56 (patch) | |
tree | 6e7d8bc57231b841545c6e3add46eb51c64a5946 /Biz/Bild.hs | |
parent | 4226cbd8020253b010fb44d395db12efe68e1272 (diff) |
Add rundeps feature to bild
This allows me to specify runtime dependencies, not just system or
language deps.
Diffstat (limited to 'Biz/Bild.hs')
-rw-r--r-- | Biz/Bild.hs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs index c1dfefd..d8cdc6f 100644 --- a/Biz/Bild.hs +++ b/Biz/Bild.hs @@ -324,7 +324,9 @@ data Target = Target -- | Flags and arguments passed to 'Compiler' when building compilerFlags :: [Text], -- | Wrapper script (if necessary) - wrapper :: Maybe Text + wrapper :: Maybe Text, + -- | Runtime dependences + rundeps :: Set Meta.Run } deriving (Show, Generic, Aeson.ToJSON) @@ -490,6 +492,7 @@ analyze hmap ns = case Map.lookup ns hmap of out = pout, packageSet = "python.packages", mainModule = Namespace.toModule namespace, + rundeps = prun, .. } |> Just @@ -513,14 +516,15 @@ analyze hmap ns = case Map.lookup ns hmap of outPath = outToPath pout, -- implement detectCImports, then I can fill this out srcs = Set.empty, + rundeps = prun, .. } |> Just |> pure Namespace.Hs -> contentLines - |> Meta.detectOut (Meta.out "--") - |> \out -> + |> Meta.detectAll "--" + |> \Meta.Parsed {..} -> detectHaskellImports hmap contentLines +> \(langdeps, srcs) -> Target { builder = "haskell", @@ -539,7 +543,7 @@ analyze hmap ns = case Map.lookup ns hmap of "--make", "$CODEROOT" </> quapath ] - ++ case out of + ++ case pout of Meta.Bin o -> [ "-main-is", Namespace.toHaskellModule namespace, @@ -549,7 +553,9 @@ analyze hmap ns = case Map.lookup ns hmap of _ -> [] |> map Text.pack, sysdeps = Meta.detect (Meta.sys "--") contentLines, - outPath = outToPath out, + outPath = outToPath pout, + rundeps = prun, + out = pout, .. } |> Just @@ -579,6 +585,7 @@ analyze hmap ns = case Map.lookup ns hmap of outPath = outToPath out, -- add local src imports to detectLispImports, then i can fill this out srcs = Set.empty, + rundeps = Set.empty, .. } Namespace.Nix -> @@ -602,6 +609,7 @@ analyze hmap ns = case Map.lookup ns hmap of packageSet = "", mainModule = Namespace.toModule namespace, builder = "base", + rundeps = Set.empty, .. } |> Just @@ -644,6 +652,7 @@ analyze hmap ns = case Map.lookup ns hmap of |> Text.pack |> Just ), + rundeps = prun, .. } |> Just @@ -674,6 +683,7 @@ analyze hmap ns = case Map.lookup ns hmap of outPath = outToPath pout, -- implement detectRustImports srcs = Set.empty, + rundeps = prun, .. } |> Just |