Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: load rules under subdir #6631

Merged
merged 1 commit into from
Dec 6, 2022
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
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
Copy link
Member Author

Choose a reason for hiding this comment

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

This can be made more efficient if anyone cares. We don't need to scan all data_only dirs. Only the ones where the parent declared (subdir ..)

~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