ocaml / ocaml/dune

watch mode: don't kill ongoing actions if unrelated parts of the build change

Open
#7,191 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

It is possible at the moment to have a long-living executable —say, a web application server— handled by dune build watcher, so the exe is started as part of a dune action, and restarted when needed. More details can be seen in https://github.com/ocaml/dune/issues/7110.

One limitation though, is that dune will kill the long-living action every time a dependency changes in the build. Say we have this dune config:

(rule
 (alias melange_and_run_api_server)
 (deps
  (alias ./melange)
  (alias ./api_server))
 (action
  (echo "Building melange and running api server")))

(rule
 (alias api_server)
 (deps
  (:api_server server.bc))
 (action
  (run %{api_server})))

It would be ideal if the action in api_server could be left running when nothing in its dependency tree has changed.

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 issue #7110 and the watch-mode behavior described here, then reproduce the example with the melange_and_run_api_server and api_server aliases. Trace how dependency changes cause long-running actions to stop. Done means an unrelated dependency change no longer kills the ongoing action, while changes in its own dependency tree still restart it.

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.