Skip to content

Enable running two builds in separate terminals (a.k.a. dune monitor) #7308

@jchavarri

Description

@jchavarri

#6360 disabled multiple build commands running concurrently.

However, as dune expands its scope and supports more tools, the case for running dune build with two or more apps in separate terminals gains strength.

For the particular use case I can speak of, at Ahrefs we have a web server written in native OCaml, and a frontend built with Melange. It is desirable to track the build status of both apps on separate terminals to not mix errors, and also because each environment might have different binaries that are executed on a successful build (e.g. the web server binary is relaunched after every build succeeds, same for webpack or other JS bundlers on the Melange side).

@rgrinberg suggested to have a new subcommand monitor that would help mirror the output of a running dune process. Then, add to dune build the ability to delegate a job, and then attach dune monitor until the job is finished.

I wonder, would it be possible to solve this problem without adding a new subcommand? I.e. when dune build sees that another dune process is already running, it can request it to build some target, and get the output back. Essentially making the lock system transparent for users.

Another idea to sidestep the new subcommand would be to make the lock system more granular, and instead of locking the whole tree, lock the specific folders that the current build is targeting. Not sure if this is possible though 🤔

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions