Open mobileink opened 3 years ago
one way to do this: make adjunct_deps
a label_keyed_string_dict, and list the modules to be opened in the string value. E.g. something like:
adjunct_deps = {
"@opam//pkg:sexplib": "Sexplib Sexplib.Std",
"@opam//pkg:ppx_sexp_conv.runtime-lib": ""
}
This kinda makes sense, since "deps" broadly interpreted covers both pkg/lib deps and module deps. Code depends on module which is included in a pkg.
PPX executables may inject code that induces additional compile-time dependencies. The injected code may also induce the need to add
open
directives. Usually these are added to the source files. But we could treat them the same we we treat adjunct deps: attach them to the ppx_executable rule, and then add-open
params when the executable is used.Example:
ppx_sexp_conv
induces a dependency on libsSexplib
andSexplib.Std
. Instead of addingopen
directives to source files, we can augment the command line for the compile with-open Sexplib -open Sexplib.Std
. I don't know if this is a good idea but it works.What are the pros and cons of supporting this?
For an annotated example, see https://github.com/obazl/dev_obazl/tree/main/demos/ppx/adjunct_deps