esy-issues
esy-issues copied to clipboard
Handle conditionalDependencies
I propose to add conditionalDependencies
(optionalDependencies
name is
already taken by npm and doesn't have the needed mechanics behind it).
The suggestion is to use the same semantics as for peerDependencies
but not
fail if those packages mentioned in conditionalDependencies are absent from
installation.
If package optdep
is listed in conditionalDependencies
for the package pkg
:
-
optdep
is not being installed automatically (same as withpeerDependencies
) for thepkg
- Unlike with peerDependencies it is not an error to have no
optdep
installed at all. - If
optdep
is present in the installation (required by some of packages above) then it's being pulled intopkg
's env.
Fixes #46
I propose pulling this in but not documenting, at least for now. It allows much more lightweight builds for common packages which have different backends — like cohttp
for example. While we can have it now (if we merge this) we can decide on how we might want to see this as a public API.
Yes, I like your plan @andreypopp - please merge when ready.
Hm... actually found a downside of this approach — in Esy's current form it requires an app which depend on lwt to depend on base-unix
and base-thread
. This is what lwt
gets converted to:
...
"esy": {
"build": [
"make setup",
"ocaml setup.ml -configure ... --${base_unix_enable:-disable}-unix --${base_threads_enable:-disable}-preemptive",
"make build",
"make install",
"(opam-installer --prefix=$cur__install || true)"
],
}
...
Not sure how to model that in Esy...
We could probably use ocamlfind
to query if unix
/threads
are installed a set env accordingly. That way we don't need base-*
packages at all in dep graph.
ready for review, @jordwalke
In this PR we model unix
/threads
deps dynamically by querying ocamlfind
for those libs.