Skip to content

Several driver fixes - #1461

Open
jonludlam wants to merge 5 commits into
ocaml:masterfrom
jonludlam:several-driver-fixes
Open

Several driver fixes#1461
jonludlam wants to merge 5 commits into
ocaml:masterfrom
jonludlam:several-driver-fixes

Conversation

@jonludlam

Copy link
Copy Markdown
Member

A number of related fixes, mostly to the driver. There's one fix to odoc in the mix too. The commits should be independently reviewable.

@panglesd panglesd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The improvement to the docs is very nice and welcome!

@jonludlam

Copy link
Copy Markdown
Member Author

Let's hold off on merging this just yet - I want to double check the changes to the docs.

@jonludlam
jonludlam force-pushed the several-driver-fixes branch from 3ee017b to 42da53b Compare July 17, 2026 16:53
jonludlam and others added 5 commits July 17, 2026 17:59
read_libraries_from_pkg_defs only looked up the archive under the
[byte]/[native] predicates. ppx derivers such as ppxlib.traverse and
ppxlib.metaquot declare their archive only under the ppx_driver
predicate, so they were dropped here and later re-discovered by the
no-META fallback, which names a library after its .cma file (e.g.
ppxlib_traverse instead of ppxlib.traverse).

Also try the [byte; ppx_driver] and [native; ppx_driver] predicates,
mirroring Ocamlfind.archives which the non-voodoo driver already uses.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Previously the include set passed to `odoc compile`/`compile-impl` was
derived from the compiled library's whole dependency set (every library
it requires). That implies doing the transitive closure over all
libraries' dependencies. In voodoo mode, we only have the META files
for the package being documented, so this isn't possible.

Instead, derive the include set from the unit's actual per-module
dependencies. Each dependency carries the interface hash of the module
it refers to; look that hash up among the units being compiled plus the
partials of already-compiled dependencies, and take the directory of the
providing unit. This is more precise (far fewer `-I` flags) and doesn't
depend on META completeness.

Applies to both interfaces and implementations; `impl_extra` now carries
the implementation's dependency list. In the non-voodoo driver, where
the library-level set was already complete, source-link output is
byte-for-byte identical.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Compute the link phase's -I search path per library -- the union of its
units' dependency cones, the same directories the compiler used -- rather
than a package-wide set. -L and -P remain package-wide and unvarying (the
reference scope). Because a library's -I holds only its own cone, alternative
implementations of a virtual library never share a search path, so no
sibling-exclusion special-case is needed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Document, in driver.mld and the author-facing odoc_for_authors.mld, the
reference-scope convention for opam-installed packages: the per-package
-P/-L reference scope, the per-unit -I include path, and the
odoc-config.sexp stanzas. Also capture the broader driver guidance learned
from building the odd driver -- the compile/link include model,
virtual-library handling, and what a driver should compile.
@jonludlam
jonludlam force-pushed the several-driver-fixes branch from 42da53b to 6de44e2 Compare July 17, 2026 17:01
@jonludlam

Copy link
Copy Markdown
Member Author

OK, I've updated the docs some more. This should be ready for review now.

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.

2 participants