test: document single-module library recompilation behavior (#4572)#14103
Open
robinbb wants to merge 1 commit intoocaml:mainfrom
Open
test: document single-module library recompilation behavior (#4572)#14103robinbb wants to merge 1 commit intoocaml:mainfrom
robinbb wants to merge 1 commit intoocaml:mainfrom
Conversation
Add baseline test showing that single-module library consumers are recompiled when an unused module in a dependency changes. This happens because dune skips ocamldep for singleton stanzas, preventing future per-module filtering from determining which libraries the module actually references. Signed-off-by: Robin Bate Boerop <me@robinbb.com>
6d8e65b to
76ace5e
Compare
76ace5e to
c66f5d2
Compare
Contributor
Author
|
@rgrinberg Thanks for your comments on #14079. In the end, I think that only this test can merge in isolation, so I closed that PR and made this one. |
rgrinberg
requested changes
Apr 9, 2026
| > EOF | ||
|
|
||
| uses_alpha is recompiled even though it only references Alpha, not Unused. | ||
| This is because dune skips ocamldep for single-module stanzas: |
Member
There was a problem hiding this comment.
This explanation is not clear and possibly incomplete. The executable would still need to be rebuilt regardless of what modules are referenced by main.ml. This is because you still need to relink to produce the final executable and thus maintain all transitive cmx dependencies up to date.
The only thing you can save here perhaps not recompiling dune__exe__Main.cmx.
More details should be produced in the trace events to demonstrate which events you expect to see and which events will be dropped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add baseline test documenting that single-module library consumers are
unnecessarily recompiled when an unused dependency module changes. This
happens because dune skips ocamldep for singleton stanzas, so per-module
filtering cannot determine which libraries the module actually references.
The code change to remove the singleton skip is deferred to the per-module
filtering PR (#14021) where it is actually needed and can be tested
end-to-end.
Ref: #4572
Test plan
dune runtest test/blackbox-tests/test-cases/per-module-lib-deps/single-module-lib.tpasses