Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,30 @@ jobs:
- run: |
nix develop .#ox-minimal -c ocaml --version
nix develop .#ox-minimal -c make test-ox

utop-dev-tool-test:
name: Test that the utop dev tool can be built and run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: nixbuild/nix-quick-install-action@v34
with:
nix_conf: ${{ env.EXTRA_NIX_CONFIG }}
- uses: nix-community/cache-nix-action@v6
with:
primary-key: |
nix-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-${{ github.job }}-
gc-max-store-size-linux: 2G
- name: Set up a project, install utop as a dev tool, and run it
shell: nix shell -c bash -e {0}
run: |
cd $(mktemp -d)
dune init project foo
cd foo
echo 'let message = "Hello, World!"' > lib/foo.ml
echo 'print_endline Foo.message' > script.ml
dune pkg lock
dune tools install utop
dune utop . script.ml

9 changes: 6 additions & 3 deletions src/dune_rules/pkg_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2418,9 +2418,12 @@ let ocaml_toolchain context =

let all_deps universe =
let* db =
(* Disallow sharing so that the only packages in the DB are the ones from
the universe's respective lock directory. *)
DB.of_ctx (Package_universe.context_name universe) ~allow_sharing:false
match (universe : Package_universe.t) with
| Dependencies ctx ->
(* Disallow sharing so that the only packages in the DB are the ones from
the universe's respective lock directory. *)
DB.of_ctx ctx ~allow_sharing:false
| Dev_tool tool -> DB.of_dev_tool tool >>| fst
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change looks correct to me. However, how does this affect only utop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This function here (all_deps) is used when communicating dependencies outside of Pkg_rules. Mechanisms for traversing the dependency closure entirely within Pkg_rules are unchanged. However building a utop top level with access to the code in the current project requires an OCAMLPATH with all the dependencies of utop, and the function which computes this (Pkg_rules.dev_tool_ocamlpath) finds dependencies using all_deps.

in
Pkg_digest.Map.values db.pkg_digest_table
|> Memo.parallel_map ~f:(fun { DB.Pkg_table.pkg_digest; _ } ->
Expand Down
Loading