Skip to content

Enable (implicit_transitive_deps false) only if OCaml version supports -H? #11212

@mbarbin

Description

@mbarbin

Desired Behavior

I recently started using the new (implicit_transitive_deps false) with dune 3.17 and OCaml 5 (is -H from 5.1 or 5.2?), and I like it a lot. Thanks!

One issue I did not foresee, and discovered in CI results is that, for certain repos, the CI matrix checks the build with older ocaml versions, such as 4.14, and because it uses the same dune config files there, things do not work well (this effectively reverts to a world where -H is not well supported).

Dune files have the ability to restrict stanza based on the OCaml version, via the enabled_if construct. I wonder if something similar could be made available in dune-project files.

Example

Something like this, which I would put in my dune-project file maybe?

(implicit_transitive_deps (< %{ocaml_version} 5.2))

Currently doesn't work:

File "dune-project", line 21, characters 1-26:
21 |  (< %{ocaml_version} 5.2))
      ^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Atom expected

Workaround

Maybe I can add a line in the CI script to edit that construct and replace the false by true for older ocaml version. I haven't tried this yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions