ocaml / ocaml/dune

Add (deps (library x)) to depend on an installed library in rules

Open
#3,418 4 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

Right now, most of the dune constructs are "referentially transparents", e.g. they don't care if the stanzas are referring to objects installed with opam or are which present in the current workspace. This includes most of the library and executable stanzas (with (libraries ...)), variables (e.g. %{lib:...}), etc.

However it doesn't seem possible to do the same thing in rules. (deps (package x)) breaks this: it requires x to be present in the workspace and it will fail with Error: No rule found for alias .x if x is installed with opam.

I understsand that dune doesn't know anything about opam packages, and that requiring an opam package to be installed is a bit weird ; So instead I'm proposing to add a (deps (library x)) stanza instead, with the same semantics as (libraries ..) appearing in libraries/executables. WDYT?

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 comparing (deps (package x)) in rules with the (libraries ...) semantics for library and executable stanzas, reproducing the failure when x is installed with opam rather than present in the workspace. Done means rules can express (deps (library x)) and resolve an installed library with the proposed referentially transparent behavior.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.