Skip to content

fix(pkg): reuse the project compiler for dev tools - #16351

Closed
Alizter wants to merge 1 commit into
ocaml:mainfrom
Alizter:dev-tool-compiler-reuse
Closed

Alizter wants to merge 1 commit into
ocaml:mainfrom
Alizter:dev-tool-compiler-reuse

Conversation

@Alizter

@Alizter Alizter commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Description

Reuse the project compiler when building compiler-sensitive dev tools whose
lock directories select the same compiler name and version.

For each such dev tool, this change traverses the dependency closure from the
tool package, replaces the matching compiler node with the project compiler
entry, and recomputes the dependent package digests. Only the rewritten,
reachable closure is merged into the package database.

Motivation

A dev-tool lock directory can retain an older dependency closure after the
project lock directory changes without changing the compiler's name or version.
Previously, Dune merged both digest-keyed closures. This rebuilt a compiler that
was already built for the project and allowed obsolete compiler dependencies
from unrelated dev-tool lock directories into @pkg-install.

The regression coverage was merged in #16350. This fix is also a prerequisite
for #16292.

Testing

  • dune build @check @fmt
  • dune runtest test/blackbox-tests/test-cases/pkg/merlin

@Alizter
Alizter force-pushed the dev-tool-compiler-reuse branch from a426298 to aebe32b Compare September 7, 2026 16:49
Recompute compiler-sensitive dev-tool dependency closures with the project
compiler entry so they refer to its existing build artifacts. Keep only the
rewritten reachable closure when merging package tables.

Signed-off-by: Ali Caglayan <alizter@gmail.com>
@Alizter
Alizter force-pushed the dev-tool-compiler-reuse branch from aebe32b to 0768c51 Compare September 8, 2026 12:25
@Alizter

Alizter commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

This is not going to work in this manner.

@Alizter Alizter closed this Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant