diff --git a/src/dune_rules/ocamldep.ml b/src/dune_rules/ocamldep.ml index a4c06c83c7e2..3c07e3d4c2a2 100644 --- a/src/dune_rules/ocamldep.ml +++ b/src/dune_rules/ocamldep.ml @@ -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) ;; diff --git a/test/blackbox-tests/test-cases/melange/unexpected-ocamldep-output.t b/test/blackbox-tests/test-cases/melange/unexpected-ocamldep-output.t index 2cbaf40dd96c..42202ba94f98 100644 --- a/test/blackbox-tests/test-cases/melange/unexpected-ocamldep-output.t +++ b/test/blackbox-tests/test-cases/melange/unexpected-ocamldep-output.t @@ -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]