refactor: move library file deps from Includes to per-module in build_cm (#4572)#14030
refactor: move library file deps from Includes to per-module in build_cm (#4572)#14030robinbb wants to merge 3 commits intoocaml:mainfrom
Conversation
fc3f91e to
bd43f2d
Compare
bd43f2d to
c38cdca
Compare
|
@rgrinberg Here is the refactor that I think you were suggesting in PR #14021. It will be easier to read after #14017 is merged. Subsequently, #14021 will be easier to review, once rebased. |
142f3f8 to
a79bb9d
Compare
5b3066a to
21284b3
Compare
4b6e10e to
817fe3f
Compare
|
The problem WAS due to THIS Dune, which is used in the "install deps" phases of some CI runs. So, I must fix the problem. Meanwhile, this PR must convert to draft mode. |
ee0e316 to
676d5aa
Compare
05de02d to
34c14f5
Compare
34c14f5 to
0ad4949
Compare
8c3d290 to
82bf016
Compare
82bf016 to
95b4fce
Compare
…lds (#4572) (#14100) ## Summary - Add baseline tests documenting existing behavior before the refactor that moves `Hidden_deps` from `Includes` to per-module in `build_cm` - `lib-deps-preserved.t`: every non-alias module declares glob deps on its library dependencies' `.cmi` files - `sandbox-lib-deps.t`: sandboxed package builds have dependency libraries' `.cmi` files available when a library depends on another library These tests pass on `main` today and establish a baseline for the refactor in #14030. Ref: #4572 Signed-off-by: Robin Bate Boerop <me@robinbb.com>
…ml#4572) Add test verifying that when a library re-exports a dependency via a module alias (module Impl = Impl), incremental builds correctly recompile consumers when the re-exported library's .cmi changes. Soft changes (implementation only, no .cmi change) can safely skip recompilation due to -opaque. Hard changes (.cmi modified) must trigger recompilation to avoid inconsistent interface assumptions. Reproduction case from @art-w. Signed-off-by: Robin Bate Boerop <me@robinbb.com>
Move Hidden_deps (library file dependencies) out of Includes.make and into per-module computation in build_cm. This is a pure refactor with no behavioral change — all modules still depend on all libraries in the stanza's requires. This separation is necessary for issue ocaml#4572: Includes carries -I flags (which must be shared across all modules) while Hidden_deps can vary per-module. With this refactor, a future change can use ocamldep output to filter Hidden_deps per-module without affecting -I flags. - Includes.make no longer takes ~opaque or bundles Hidden_deps - New deps_of_entries in lib_file_deps.ml handles opaque logic - Alias and Wrapped_compat modules skip library deps (matching their existing Includes.empty behavior) - deps_with_exts removed (sole caller was the old opaque branch) Signed-off-by: Robin Bate Boerop <me@robinbb.com>
…issue ocaml#4572) Add a new function `read_immediate_deps_raw_of` to the ocamldep module that returns raw module names (as Module_name.Set.t) from ocamldep output, without resolving them to Module.t values. This function will be used to determine which external library modules a module actually references, enabling finer-grained dependency tracking where modules are only recompiled when libraries they actually use change. Signed-off-by: Robin Bate Boerop <me@robinbb.com>
95b4fce to
f58b334
Compare
|
@rgrinberg I am closing this PR, as this is a refactoring that serves the branch in PR #14021. However, I am deprecating that PR in favour of PR #14116 which has a more elegant solution than what this branch was heading toward (and it works on CI tests). |
Pure refactor: moves
Hidden_deps(library file dependencies) out ofIncludes.makeand into per-module computation inbuild_cm. No behavioralchange — all modules still depend on all libraries in their stanza's requires.
This separation is prerequisite work for #4572 (finer dependency analysis
between libraries).
Includescarries-Iflags which must be shared acrossall modules in a stanza.
Hidden_depscan vary per-module — once separated,a future change can use
ocamldepoutput to declare only the library depseach module actually needs.
Changes:
Includes.makeno longer takes~opaqueor bundlesHidden_depsdeps_of_entriesinlib_file_deps.mlreplaces the old inline opaquelogic;
deps_with_extsremoved (sole caller was the old opaque branch)build_cmadds alib_cm_depsblock that declares library file depsper-module; alias and wrapped-compat modules skip library deps (matching
their existing
Includes.emptybehavior)Based on #14100, #14031, #14101, and #14103 (merged via merge commits).
Depends on #14017 (merged), #14031, #14100, #14101, and #14103.
Ref: #4572