-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Multi-context library installation #10507
Comments
This would likely also solve #10362 |
The main thing that I dislike about this proposal is that it mixes low level constructs such as contexts and high level constructs as melange settings. The way things were originally, it made sense to me because contexts were expanded to cover more use cases without adding melange specific features. Now it turns that you need melange specific features anyways. In that case, we could have just started with something custom made for melange and the end result wouldn't have some of the sharp edges of this proposal. What could a custom solution could look like? Well I suppose you could just make libraries built with the melange mode completely have their own sources and compilation artifacts and add conditional source selection for melange (though this would not work for bytecode/native/jsoo modes). |
If I understand correctly, the main addition in the proposal is the However, telling Dune about Melange-specific compilation at the context level feels like the wrong place (maybe this is what @rgrinberg is also expressing) because inside the contexts, one can put a lot of things besides Melange libraries or emit stanzas. This friction can be noticed in rules like:
I assume a bunch of other things would become forbidden that are not mentioned. For example what happens if I enable some I wonder how a proposed solution would look like if we went the "mode => context" path. Meaning, we leave
That issue is mostly the same idea that I described above. |
Context
"Multi-context" or "Universal" libraries refer to libraries sharing the same name, but enabled in different dune build contexts (through
(enabled_if (=%{context_name} ...))
). Support for this was added in ocaml/dune#10307.ocaml/dune#10471 shows that these libraries cannot currently share the same
public_name
.Problem statement
dune install
and passing the--context
flag.--context
flag.Proposed solution
melange.emit
exclusively in their own context.(melange)
field to(context ..)
indune-workspace
and phase out(modes melange)
from the dune configuration(context ..)
field in(library ..)
that adheres to the ordered set language::standard
defines the default context where most libraries live today(context :standard melange other-context)
(context melange)
implies(modes melange)
(context :standard) (modes melange)
becomes forbiddenpublic_name
to coexist iff one lives exclusively in thedefault
context and the other lives exclusively in themelange
contextmelange
artifacts are already installed in their own directory:<lib-root>/<lib-name-segments>/melange
melange
directory mentioned above--context
isn't passed todune install
, automatically install the Melange and default contexts in the same prefixThe following example illustrates how a Melange project could be configured in this proposal:
Alternatives Considered
dune install
commands in the<project>.opam
filedune install
twice(using melange <version>)
is present in thedune-project
fileThe text was updated successfully, but these errors were encountered: