ocaml / ocaml/dune

Allow building only dependencies of a target

Open
#7,972 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Desired Behavior

Colleagues of mine have often asked me if there is a way to tell dune to build only the dependencies of some target. This has come up again today in the context of a Coq project, where we have relied on the following hack.

To build all the dependencies of a Coq file (which is useful to then load it into the Coq toplevel), on can use dune coq top --toplevel=true -- dir/file.v. This has the same effect as building all the dependencies for file dir/file.vo, without building dir/file.vo itself.

However, this approach is limited to cases where you want to build the deps for a single file. It would not be reasonable to allow several file parameters to dune coq top, since that does not really make any sense from the point of view for the toplevel.

A better option would be to add a --deps-only argument to dune build, so that one can run, for example, dune build --deps-only dir/file1.vo dir1/file2.vo to build all the dependencies of dir/file1.vo and dir/file2.vo.

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 at the dune build command and compare its target handling with dune coq top --toplevel=true. Trace how multiple targets and their dependency closure are processed. Done means a --deps-only option builds dependencies for targets such as dir/file1.vo and dir1/file2.vo without building those targets themselves.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.