-
Notifications
You must be signed in to change notification settings - Fork 472
feat: per-module inter-library dependency filtering (#4572) #14116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
robinbb
wants to merge
69
commits into
ocaml:main
Choose a base branch
from
robinbb:robinbb-issue-4572-combined-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
438be82
test: opaque profile coverage for inter-library dep tracking
robinbb 94e1fa1
test: scrub implementation-detail references from opaque test prose
robinbb d86f3ef
test: tighten opaque-mli-change rebuild assertions to exact counts
robinbb f45d971
test: clarify [unix] is shipped-with-OCaml, not part of [Stdlib]
robinbb 8645681
test: observational baseline for an unreferenced transitive library dep
robinbb cd5ae67
test: record consumer rebuild count when shadowed dep lib changes
robinbb 6bb9b8c
test: add single-module consumer unreferenced-dep regression guard
robinbb 3d9edc0
test: rewrite as observational baseline with signature-change edit
robinbb 92197dd
test: add sibling-module consumer unreferenced-dep regression guard
robinbb afa02eb
test: rewrite as observational baseline with signature-change edit
robinbb 557845f
test: add baseline observational test for per-module rebuild count
robinbb 11c10ab
test: make consumer multi-module to isolate per-module filter
robinbb f869374
test: narrow subst pattern to avoid matching paths
robinbb b709bd0
test: lower lang version to 3.0
robinbb 468b217
test: lower lang version to 3.0
robinbb 68272fd
test: lower lang version to 3.0
robinbb cad1dd3
feat: use ocamldep for per-module inter-library dependency filtering …
robinbb cb21b93
refactor: remove dead code for per-file unwrapped library deps
robinbb 4db11c9
refactor: extract filtered_lib_deps helper; use in ocamlc_i
robinbb badcad7
refactor: replace close_over with Lib.closure
robinbb e7e689f
refactor: simplify lib_index to use entry_modules for all libraries
robinbb 7fedad7
style: address review nitpicks
robinbb e576fec
fix: use of_string_opt for user-provided -open flag module names
robinbb bcd9613
fix: include Virtual modules in ocamldep reading for filtering
robinbb 36a6513
fix: read both .ml and .mli ocamldep output for filtering
robinbb e8b6f83
refactor: deduplicate build_cm and ocamlc_i lib deps logic
robinbb 7a8d972
refactor: remove redundant Module.has guards in ocamldep reading
robinbb 9e712cb
refactor: memoize library closure
rgrinberg 0379826
refactor: share parsed ocamldep output between readers
robinbb 3627bac
fix: remove leftover Command.Args.empty in build_cm
robinbb 82e9b80
fix: include wrapped_compat modules in library entry modules
robinbb 0e3217b
test: give strict-package-deps.t real library references
robinbb ced04ec
fix: filter single-module consumers with library dependencies (#4572)
robinbb 140d18d
test: update snapshots for single-module stanzas with library deps
robinbb 8cc663b
test: update enabled_if and watching snapshots
robinbb 2e749e6
perf: dedupe and sort Lib_index.filter_libs output
robinbb b22727a
fix: include hidden_requires in lib_index
robinbb 2e51996
perf: memoise filtered-libs computation per module (#4572)
robinbb 93e22b6
test: revert alias-cycle.t promote
robinbb f8671e7
Revert "perf: memoise filtered-libs computation per module (#4572)"
robinbb 2f5e748
test: make alias-cycle.t walk-invariant
robinbb c0e7b3c
Cache parsed ocamldep builders by .d file path
robinbb da9e967
refactor: drop redundant Lib.closure intersection
robinbb 8a5272b
perf: per-module deps within unwrapped libraries (#4572)
robinbb 373b261
test: promote oxcaml library-field-parameters error chain
robinbb 081cfc9
test: promote sibling-unreferenced-lib to post-feature count
robinbb a29893a
test: document transitive-glob limitation
robinbb 7d8bad4
docs: clarify rule-dep mechanics in lib_deps_for_module
robinbb cd06c3d
feat: propagate tight per-module deps across library boundaries
robinbb 4a05216
refactor: tighten helper naming and extract shared patterns
robinbb bb250fd
fix: read cross-library ocamldep output without basename check
robinbb 3602014
refactor: drop [tight_subset], reuse [filter_libs_with_modules]
robinbb 6e3d057
refactor: memoize has_virtual_impl per compilation context
robinbb 619bc11
docs: explain the wrapped-library limitation and sketch follow-ons
robinbb ebd4c0d
docs: spell out "BFS" as "breadth-first walk" or "cross-library walk"
robinbb 55b9436
refactor: address review feedback — clarifying comments, tests, small…
robinbb de6c3fd
test: use [let _ = ...] for consumer references in new cram tests
robinbb e2e3ddf
perf: memoize cctx.lib_index and has_virtual_impl with Memo.Lazy.t
robinbb 92b1929
perf: skip [.ml]-side ocamldep reads when the [.cmi] doesn't carry them
robinbb f0a63d6
fix: drop unreached tight-eligible libraries from compile-rule deps
robinbb 77b0f9c
test: promote opaque-mli-change rebuild counts under this PR's filter
robinbb 40c0042
refactor: encode tight-eligibility in the Lib_index entry shape
robinbb 1279dd4
style: expand wildcard match in skip_lib_deps
robinbb c521d40
fix: synthesise root_module references in the per-module filter
robinbb 2e4da73
test: lock in incremental-rebuild for root_module-aliased deps
robinbb ed948a0
refactor: drop the basename check from ocamldep output parsing
robinbb 3c4bf1c
refactor: make Lib_index.create's no_ocamldep parameter required
robinbb b09de85
refactor: drop module_kind_has_readable_ocamldep predicate
robinbb c73076d
refactor: build lib_index from direct_requires only
robinbb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| - Use `ocamldep` output to filter inter-library dependencies on a | ||
| per-module basis. Eliminates unnecessary recompilations when a | ||
| dependency library changes but the importing module doesn't | ||
| reference it, and, for unwrapped dependency libraries, when the | ||
| importing module references a different module of the same | ||
| library than the one that changed. (#14116, fixes #4572, @robinbb) |
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a suggestion: To facilitate the testing of revdeps, would it be possible for the
-I/-Hflags to use the filtered libraries? Currently the PR only refines the hidden deps but uses the same compiler flags, so a clean build can accidentally succeed (by accessing a file not listed in the hidden deps) while a rebuild might fail. If the-I/-Hflags were restricted, then we would have more chance to catch any error when testing the revdeps build :)It's not necessary because we could also enable sandboxing when testing the revdeps, but this might report issues unrelated to your PR.
(As a bonus, this would improve caching since introducing a new dependency wouldn't require a full rebuild :) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's tempting to do this as part of this same PR. But it's so hard to merge this as-is. I have created a follow-up PR to pursue this. It builds on this PR, obviously. Let's see whether we can develop confidence in this PR, in isolation, after testing. If not, maybe the follow-on PR (and not this one) can give the confidence. For now, I won't do this here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following up on my earlier comment with a more pointed reason for the split:
The two changes have different failure modes. A bug in the dep filter currently produces over- or under-invalidation — recoverable, ultimately self-correcting on a
dune clean. A bug in-I/-Hnarrowing produces compile errors. If they land together and a reverse dependency breaks, we have to bisect across both axes; in series, the same break is unambiguously attributable.So the staging is: get the per-module filter established as the baseline, exercise the revdeps against that, then narrow the compile-time view on top — at which point the filter is independently confirmed and the only thing under test is the visibility tightening. That's strictly more diagnostic information than landing them simultaneously, and it matters most when something does go wrong on a downstream build, which is the situation we want to be quickest at diagnosing.
Your improvement is genuine and shouldn't be lost; the next PR after this one is the right place for it.