Skip to content

Commit

Permalink
fix: load rules under subdir
Browse files Browse the repository at this point in the history
data_only_dirs can also define libraries using (subdir ..)

ps-id: 5af7aeb4-f29b-4338-aa14-fe2d568245be
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg committed Dec 3, 2022
1 parent 8779f66 commit bb02750
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Unreleased
----------

- Allow `$ dune utop` to load libraries defined in data only directories
defined using `(subdir ..)` (#6631, @rgrinberg)

- Format dune files when they are named `dune-file`. This occurs when we enable
the alternative file names project option. (#6566, @rgrinberg)

Expand Down
4 changes: 1 addition & 3 deletions src/dune_rules/utop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ let libs_and_ppx_under_dir sctx ~db ~dir =
| None -> Memo.return ([], [])
| Some dir ->
let+ libs, pps =
Source_tree_map_reduce.map_reduce
dir (* TODO this is wrong under [(subdir ..)] *)
~traverse:{ data_only = false; vendored = true; normal = true }
Source_tree_map_reduce.map_reduce dir ~traverse:Sub_dirs.Status.Set.all
~f:(fun dir ->
let dir =
Path.Build.append_source (Super_context.context sctx).build_dir
Expand Down
6 changes: 1 addition & 5 deletions test/blackbox-tests/test-cases/utop/lib-under-subdir.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,4 @@ dune utop should read libraries in (subdir ..)
> EOF

$ dune utop . -- foo.ml
File "foo.ml", line 1, characters 0-9:
1 | Foolib.hw ()
^^^^^^^^^
Error: Unbound module Foolib
[2]
foolib

0 comments on commit bb02750

Please sign in to comment.