Skip to content

Commit 6382802

Browse files
authored
Merge pull request #12747 from gridbugs/dune-utop-fix
Fix dependencies of utop dev tool
1 parent 194210a commit 6382802

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

.github/workflows/workflow.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,3 +388,30 @@ jobs:
388388
- run: |
389389
nix develop .#ox-minimal -c ocaml --version
390390
nix develop .#ox-minimal -c make test-ox
391+
392+
utop-dev-tool-test:
393+
name: Test that the utop dev tool can be built and run
394+
runs-on: ubuntu-latest
395+
steps:
396+
- uses: actions/checkout@v5
397+
- uses: nixbuild/nix-quick-install-action@v34
398+
with:
399+
nix_conf: ${{ env.EXTRA_NIX_CONFIG }}
400+
- uses: nix-community/cache-nix-action@v6
401+
with:
402+
primary-key: |
403+
nix-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
404+
restore-prefixes-first-match: nix-${{ runner.os }}-${{ github.job }}-
405+
gc-max-store-size-linux: 2G
406+
- name: Set up a project, install utop as a dev tool, and run it
407+
shell: nix shell -c bash -e {0}
408+
run: |
409+
cd $(mktemp -d)
410+
dune init project foo
411+
cd foo
412+
echo 'let message = "Hello, World!"' > lib/foo.ml
413+
echo 'print_endline Foo.message' > script.ml
414+
dune pkg lock
415+
dune tools install utop
416+
dune utop . script.ml
417+

src/dune_rules/pkg_rules.ml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,9 +2418,12 @@ let ocaml_toolchain context =
24182418

24192419
let all_deps universe =
24202420
let* db =
2421-
(* Disallow sharing so that the only packages in the DB are the ones from
2422-
the universe's respective lock directory. *)
2423-
DB.of_ctx (Package_universe.context_name universe) ~allow_sharing:false
2421+
match (universe : Package_universe.t) with
2422+
| Dependencies ctx ->
2423+
(* Disallow sharing so that the only packages in the DB are the ones from
2424+
the universe's respective lock directory. *)
2425+
DB.of_ctx ctx ~allow_sharing:false
2426+
| Dev_tool tool -> DB.of_dev_tool tool >>| fst
24242427
in
24252428
Pkg_digest.Map.values db.pkg_digest_table
24262429
|> Memo.parallel_map ~f:(fun { DB.Pkg_table.pkg_digest; _ } ->

0 commit comments

Comments
 (0)