ocaml / ocaml/dune

Allow to watch executables as part of `dune build`

Open
#7,110 12 comments 1 reaction 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

Related issue: https://github.com/ocaml/dune/issues/2934.

That issue is scoped to running dune exec in watch mode. This is useful, but there is no information about build process in dune exec. In particular:

  • build progress feedback
  • errors feedback

As well as the long tail of improvements built on top of dune build (integrations with editors, composability of aliases, etc).

Another downside is that if there are code changes that break the exec build, dune exec --watch will restart the last working version of the executable, which can be confusing for users.

The feature would be something closer to what @emillon mentioned here (copying here for easier reading):

(rule
 (alias run)
 (action
  (run ./x.exe args)))

But with one caveat: Dune would not wait for these executables to finish in order to consider that run rule as "done", but rather:

  • consider the rule as "done" as soon as the executable is launched
  • control the executable child process lifecycle based on the build state

In terms of language, it could not reuse run because the semantics are very different. Maybe a new watch field could be added to action?

(rule
 (alias watch)
 (action
  (watch ./x.exe args)))

The rule would only be useful under the dune build --watch scenario. Are there any previous cases in the language in a similar situation?

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 reading related issue #2934 and the linked @emillon comment, then compare the proposed action forms with the existing dune build --watch behavior and action language. Done means an agreed and implemented way to launch and manage executable processes during watch builds, including lifecycle and failure semantics; the issue names no files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.