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
In a project with both native and Melange libraries, one might want to keep the former in default context, and move all Melange libraries to a different context melange, so that library name collisions can be avoided (see related issue #10222).
To do this, Dune currently requires going through all libraries that include (modes melange), and add (enabled_if (= %{context_name} "melange")).
Besides that, if one wants to properly separate namespaces, all existing OCaml libraries should be annotated with the equivalent (enabled_if (= %{context_name} "default")).
This is quite noisy for projects with tens or hundreds of libraries. Besides, the enabled_if conditions are mostly redundant with the information already available in the library modes field.
I wonder if there could be some setting in such scenarios where a single addition to the dune-project or dune-workspace file could include the (= %{context_name} "xxx") condition to each library, depending on its mode, e.g.:
If the library has (modes melange): adds (enabled_if (= %{context_name} "melange"))
If the library doesn't have (modes melange): adds (enabled_if (= %{context_name} "default"))
If the library has (modes :standard melange): doesn't add any condition (library is available in both contexts)
This setting could be activated through a new stanza (melange_use_mode_as_context true).
In a project with both native and Melange libraries, one might want to keep the former in
default
context, and move all Melange libraries to a different contextmelange
, so that library name collisions can be avoided (see related issue #10222).To do this, Dune currently requires going through all libraries that include
(modes melange)
, and add(enabled_if (= %{context_name} "melange"))
.Besides that, if one wants to properly separate namespaces, all existing OCaml libraries should be annotated with the equivalent
(enabled_if (= %{context_name} "default"))
.This is quite noisy for projects with tens or hundreds of libraries. Besides, the
enabled_if
conditions are mostly redundant with the information already available in the librarymodes
field.I wonder if there could be some setting in such scenarios where a single addition to the
dune-project
ordune-workspace
file could include the(= %{context_name} "xxx")
condition to each library, depending on its mode, e.g.:(modes melange)
: adds(enabled_if (= %{context_name} "melange"))
(modes melange)
: adds(enabled_if (= %{context_name} "default"))
(modes :standard melange)
: doesn't add any condition (library is available in both contexts)This setting could be activated through a new stanza
(melange_use_mode_as_context true)
.cc @anmonteiro @davesnx @andreypopp
The text was updated successfully, but these errors were encountered: