Skip to content

pkg: add @pkg-source alias - #15629

Draft
Alizter wants to merge 1 commit into
ocaml:mainfrom
Alizter:pkg-source-alias
Draft

pkg: add @pkg-source alias#15629
Alizter wants to merge 1 commit into
ocaml:mainfrom
Alizter:pkg-source-alias

Conversation

@Alizter

@Alizter Alizter commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Package sources are currently fetched as a side effect of building packages. There is no way to fetch every locked package source up front, which makes it difficult to populate Dune's shared cache during a network-enabled phase and then build without network access. This is also useful groundwork for #9983.

Fixes #15628.

Implementation

  • Add a context-level @pkg-source alias alongside @pkg-install.
  • Make the alias depend directly on every fetched package source directory target. Packages without fetched sources, including local directory sources, are skipped because they require no network access.
  • Report the same lock-directory guidance as @pkg-install when package management is inactive.
  • Defer expansion of package build rules until their target is requested. Without this, loading a source directory rule could eagerly build a transitive package while resolving executables for the package build action.
  • Expose pkg-source through dune show aliases.

Tests

  • Verify @pkg-source fails with a useful message without a lock directory.
  • Verify it populates source directories for direct and transitive packages without building either package.
  • Verify the packages are subsequently built by @pkg-install.
  • Update alias enumeration expectations.

Validation performed:

  • dune build @check
  • dune fmt
  • dune runtest test/blackbox-tests/test-cases/pkg/alias-pkg-install.t test/blackbox-tests/test-cases/describe/aliases.t

Signed-off-by: Ali Caglayan <alizter@gmail.com>
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.

add @pkg-source alias to populate package sources

1 participant