Skip to content

feat(pkg): install layouts for package sets - #14373

Merged
Alizter merged 1 commit into
ocaml:mainfrom
Alizter:push-nkmrmtxvyunk
May 26, 2026
Merged

Alizter merged 1 commit into
ocaml:mainfrom
Alizter:push-nkmrmtxvyunk

Conversation

@Alizter

@Alizter Alizter commented Apr 29, 2026 •

Copy link
Copy Markdown
Collaborator

(deps (package ...)) materializes a scoped install layout under _build/install/<context>/.packages/<digest>/ containing only the declared package dependencies. This replaces the old alias-based mechanism where (deps (package foo)) populated the shared _build/install/ staging area, making every package in the workspace discoverable regardless of what was declared.

The layout includes only immediate deps (no transitive closure). Actions should declare what they need explicitly. Environment variables (PATH, OCAMLPATH, CAML_LD_LIBRARY_PATH, OCAMLFIND_IGNORE_DUPS_IN, OCAMLTOP_INCLUDE_PATH, MANPATH) are set from the layout directory and consed onto the directory env via extend_action.

The layout only applies to workspace packages. Lock-dir packages and the site/plugin system are unaffected.

See doc/dev/install-layouts.md for design details.

Related:

Follow-up

  • refactor the env helpers
  • document env propagation in dune generally
  • exhaustively test env propagation
  • extend the staging-env cons to dune utop, dune rocq top, and dune ocaml top/top-module
  • lock-dir packages classify as Build and don't set up layout env vars
  • sandbox PATH non-relocation for layout dirs (Environment Variables aren't relocated to the Sandbox #10294)
  • extract a Digest_key functor to dedupe Install_layout.Key / Bin_layout.Key / Ppx_driver.Key
  • factor the Context.for_host fallback into a single helper
  • missing test for mixed workspace + lock-dir package deps
  • dep expander invoked twice on the (deps (package ...)) path

@Alizter Alizter changed the title chore: convert package-dep.t test to a file test feat(pkg): install layouts for package sets Apr 29, 2026
@Alizter
Alizter force-pushed the push-nkmrmtxvyunk branch from 465d843 to 3dc8980 Compare April 29, 2026 20:34
@Alizter Alizter self-assigned this Apr 29, 2026
@Alizter
Alizter force-pushed the push-nkmrmtxvyunk branch 19 times, most recently from 7abe25a to 2cb8e69 Compare May 2, 2026 02:05
Comment thread src/dune_rules/super_context.ml Resolved
Comment thread src/dune_rules/install_layout.mli Resolved
Comment thread src/dune_rules/gen_rules.ml Resolved
Comment thread src/dune_rules/dep_conf_eval.ml Resolved
@rgrinberg

Copy link
Copy Markdown
Member

Looks like this is on the right track. Why do you bother to preserve the old behavior? Do you think there was a way to reasonably way to depend on it by users?

@Alizter
Alizter force-pushed the push-nkmrmtxvyunk branch 5 times, most recently from e74f6b1 to c00311d Compare May 25, 2026 01:22
Comment thread src/dune_rules/dep_conf_eval.ml Resolved
Comment thread src/install/roots.ml Resolved
`(deps (package ...))` materializes a scoped install layout under
`_build/install/<context>/.packages/<digest>/` containing only the declared
package dependencies. This replaces the old alias-based mechanism where
`(deps (package foo))` populated the shared `_build/install/` staging area,
making every package in the workspace discoverable regardless of what was
declared.

The layout includes only immediate deps (no transitive closure). Actions
should declare what they need explicitly. Environment variables (PATH,
OCAMLPATH, CAML_LD_LIBRARY_PATH, OCAMLFIND_IGNORE_DUPS_IN,
OCAMLTOP_INCLUDE_PATH, MANPATH) are set from the layout directory and
consed onto the directory env via extend_action.

The layout only applies to workspace packages. Lock-dir packages and the
site/plugin system are unaffected.

See doc/dev/install-layouts.md for design details and known limitations.

Signed-off-by: Ali Caglayan <[email protected]>
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