ocaml / ocaml/dune

Multi-version configuration files

Open
#3,101 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Currently, the config file in $XDG_CONFIG_HOME/dune/config sets a lower bound on the Dune version useable on one's machine (via the lang stanza):

File "/home/.config/dune/config", line 1, characters 11-14:
1 | (lang dune 2.1)
               ^^^
Error: Version 2.1 of dune is not supported.
Supported versions:
- 1.0 to 1.12
- 2.0

In order to access the latest features (such as the cache), I need to update all projects on my machine in lockstep. I think it would be nice to allow projects to be upgraded independently while allowing access to the newest features. Here's two potential strategies:


Proposal 1 - Multi-version config file

We could make all configuration settings forwards-compatible by adding some sort of conditional stanza:

(for-version 
 (>= 2.1.0)
 (cache enabled))
  • advantages: retains a single source of truth for Dune config.
  • disadvantages: makes it harder to change the config file parser in future, and makes the lang stanza in the config files mostly redundant.

Proposal 2 - Multiple config files

We could have version-specific config files that are read in some sort of preference order, for instance:

$XDG_CONFIG_HOME/dune/config.2.0.1  (* Read by >= 2.0.1 *)
$XDG_CONFIG_HOME/dune/config.1.11.2 (* Read by >= 1.11.2 & < 2.01 *)
$XDG_CONFIG_HOME/dune/config        (* Read by < 1.11.2 *)
  • advantages: logic for parsing the config is the same as before, and retains the same 'lang header' / 'body' parser distinction as the other Dune files.
  • disadvantages: config parameters will likely be duplicated in the files.

Personally, I prefer the second option for not violating my expectations of the lang stanza. I'm happy to implement whatever solution is deemed best.

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 reviewing the configuration file at $XDG_CONFIG_HOME/dune/config and how its lang stanza limits supported Dune versions. Compare the proposed conditional-stanza and version-specific-file approaches, then define how independent project upgrades and access to newer features should work. Done means a decided configuration design that supports multiple Dune versions without requiring all projects to upgrade together.

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.