Skip to content

Commit

Permalink
fix: read the processed file in Ocamldep.read_immediate_deps_of
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
  • Loading branch information
anmonteiro committed Mar 22, 2024
1 parent 1a5d52a commit 1fa5da7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
9 changes: 6 additions & 3 deletions src/dune_rules/ocamldep.ml
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,16 @@ let read_deps_of ~obj_dir ~modules ~ml_kind unit =
;;

let read_immediate_deps_of ~obj_dir ~modules ~ml_kind unit =
match Module.source ~ml_kind unit with
match
let ml = Module.ml_source unit in
Module.file ml ~ml_kind
with
| None -> Action_builder.return []
| Some source ->
| Some file ->
let ocamldep_output = Obj_dir.Module.dep obj_dir (Immediate (unit, ml_kind)) in
Action_builder.lines_of (Path.build ocamldep_output)
|> Action_builder.map ~f:(fun lines ->
parse_deps_exn ~file:(Module.File.path source) lines
parse_deps_exn ~file lines
|> parse_module_names ~dir:(Obj_dir.dir obj_dir) ~unit ~modules)
|> Action_builder.memoize (Path.Build.to_string ocamldep_output)
;;
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,4 @@ file after any dialects have run
> let name = "Zoe"
> EOF
$ dune build @mel
Error: ocamldep returned unexpected output for _build/default/lib/foo.myd:
> lib/foo.myd.ml: Bar
-> required by _build/default/output/lib/foo.js
-> required by alias mel
[1]

0 comments on commit 1fa5da7

Please sign in to comment.