You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(* Assume this exists *)moduleGen : sigvalv : ?doc:string -> ?meta:B0_meta.t -> prog:B0_unit.t-> Fpath.t -> B0_unit.tvalfile : u : B0_srscs.selend(* Compile this with Metaocaml. A metaocaml program that prints out regular ocaml code *)let meta_gen =B0_ocaml.exe "meta_gen"~srcs:[ `File (Fpath.v "some/source/file.ml")]
let gen_file =Gen.v ~prog:meta_gen Fpath.(v "gen_file.ml")
(* Compile this with normal Ocaml *)let mylib =B0_ocaml.libname "mylib"let mylib_lib =B0_ocaml.lib mylib ~srcs:[ Gen.file gen_file ]
Implementation
Based on my current understanding of how things work, this could be implemented in a few ways:
Add an ~env argument to B0_ocaml.{lib,exe} They would then be responsible for passing those along to the tool spawns. The type should probably be something like (B0_build.t -> string String.Map.t) so that a tool spawn can generate the environment, such as a call to opam env
Add an env key to the meta that gets passed to B0_ocaml.lib and B0_ocaml.exe. Again, B0_ocaml.{lib,exe} would be responsible for looking up that value and passing it to the tool spaws
Add a wrapper around B0_unit.t to build that unit with a set of env vars. I'm not entirely clear how or if this would work, I need to look more that the unit definition/registration code.
Probably some mechanism with B00_ocaml. From what I can tell, its only possible to mess with the environment from inside a (B0_build.t -> ...), and theres no mechanism to do that with the high level B0_ocaml.{lib,exe}
Or this is already possible and I completely missed it.
If you like any of these I could take a stab at implementing and submitting a pr.
The text was updated successfully, but these errors were encountered:
Usecase
Implementation
Based on my current understanding of how things work, this could be implemented in a few ways:
~env
argument toB0_ocaml.{lib,exe}
They would then be responsible for passing those along to the tool spawns. The type should probably be something like(B0_build.t -> string String.Map.t)
so that a tool spawn can generate the environment, such as a call toopam env
env
key to the meta that gets passed to B0_ocaml.lib and B0_ocaml.exe. Again,B0_ocaml.{lib,exe}
would be responsible for looking up that value and passing it to the tool spawsB0_unit.t
to build that unit with a set of env vars. I'm not entirely clear how or if this would work, I need to look more that the unit definition/registration code.(B0_build.t -> ...)
, and theres no mechanism to do that with the high levelB0_ocaml.{lib,exe}
Or this is already possible and I completely missed it.
If you like any of these I could take a stab at implementing and submitting a pr.
The text was updated successfully, but these errors were encountered: