Skip to content

Manifest: add ?optional

Romain requested to merge nomadic-labs/tezos:romain-manifest-optional into master

Context

In !5945 (merged) I split Tezt into two parts: a JS-compatible common lib tezt.core and a JS-incompatible main lib tezt, and add a third part: a JS-compatible main lib tezt.js. I'd still like the three libs to be distributed under a single package tezt.opam. But I don't want users that do not need tezt.js to have to install js_of_ocaml. The solution is to have js_of_ocaml be an optional dependency and have dune not compile tezt.js when js_of_ocaml is not installed.

This MR adds the possibility to declare optional dune targets. In turn, the dependencies of those optional targets become optional in the opam package. In the case of !5945 (merged), it means that if you run opam install tezt without js_of_ocaml installed, you'll get tezt.core and tezt, but if you run it with js_of_ocaml already installed, or if you install js_of_ocaml later, you'll also get tezt.js.

This feature is unused yet, but you can see an example in !5945 (merged).

Manually testing the MR

Add ~optional: true to some of the targets of the Manifest, run make -C manifest, and check that:

  • the dune file now contains an (optional) stanza;
  • the .opam file turns the dependencies that are only used by the optional target into depopts.

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR

Merge request reports