ocaml / ocaml/dune

Generalize enabled_if to all stanzas

Open
#4,080 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

proposal
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

As Travis is slowly dying I recently tried to make ppxlib work under ocaml-ci and this lead to interesting discussions with @avsm and @talex5.
ocaml-ci tries to build and run the tests for all ocaml versions your packages are comaptible with which was a problem for ppxlib as the tests weren't all working on older compiler. This used to be worked around by restricting the test on newer versions only in the opam file, which was ignored by ocaml-ci leading to failures on old compiler builds.

We agreed that it would be nicer to have a finer granularity and disable the individual tests rather than this all or none policy.
I embarked on a journey to set up our dune rules so that each test rule would be run conditionally based on the ocaml version, using (enabled_if ...) fields. That worked fairly well (see the following PR on ppxlib) but there are some stanzas that can't be disabled this way, cinaps stanzas for example. In particular, it would especially helpful for us to be able to disable them on arm32 until #4069 is fixed.

If we indeed want to aim at this for our CI, it would require dune to provide a reliable way to conditionally enable stanzas and rules so the CI can always build and test as much as possible on any given arch/ocaml version.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining Dune's existing (enabled_if ...) handling for rules and the stanza types that currently cannot be disabled, especially cinaps stanzas. Review the linked ppxlib PR and issue #4069 for context on conditional builds and arm32. Done means providing a reliable way to conditionally enable all relevant stanzas and rules by OCaml version or architecture.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.