ocaml / ocaml/dune

[question] how to debug apparently-unnecessary rebuilds?

Open
#4,150 21 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I am creating a Gitlab CI script for a project using Dune. This involves caching things and reusing them on following runs. If I ask to cache Dune's _build directory, and start a new CI job without any change to the source, then some of the build will get reused as expected, but some other parts of the build get redone for no clear reason.

Question: is there a way to debug apparently-unnecessary rebuilds? For example it could be a --display option that, for each action that is performed, explains why the action was deemed necessary. Something more low-level would be fine, but preferably this would not require modifying the Dune implementation.

While trying to answer this question I found dune rules (from #265). This is useful, but it shows all dependencies for each rule, and I don't know which of the dependencies are causing the rebuild. How would I go about checking that?

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 with the reported GitLab CI setup, cached _build directory, and dune rules output to understand how dependencies are currently exposed. A complete outcome would identify a practical way to determine which dependency triggers each rebuild, preferably without modifying Dune, but the issue does not name implementation files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
gitlab, ocaml
Domain
build-system, ci-cd
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.