Skip to content

Commit

Permalink
Fix mdx stanza with implicit_transitive_deps false
Browse files Browse the repository at this point in the history
Closes #5499

Signed-off-by: Etienne Millon <me@emillon.org>
  • Loading branch information
emillon committed Apr 8, 2022
1 parent cff55b1 commit 29be2ab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 20 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
- `coqdep` now depends only on the filesystem layout of the .v files,
and not on their contents (#5547, helps with #5100, @ejgallego)

- The mdx stanza 0.2 can now be used with `(implicit_transitive_deps false)`
(#5558, fixes #5499, @emillon)

3.0.3 (Unreleased)
------------------

Expand Down
3 changes: 2 additions & 1 deletion src/dune_rules/mdx.ml
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,11 @@ let mdx_prog_gen t ~sctx ~dir ~scope ~expander ~mdx_prog =
let module_ = Module.generated ~src_dir:(Path.build dir) main_module_name in
let modules = Modules.singleton_exe module_ in
let flags = Ocaml_flags.default ~dune_version ~profile:Release in
let lib name = Lib_dep.Direct (loc, Lib_name.of_string name) in
let compile_info =
Lib.DB.resolve_user_written_deps_for_exes (Scope.libs scope)
[ (t.loc, name) ]
(Lib_dep.Direct (loc, Lib_name.of_string "mdx.test") :: t.libraries)
(lib "mdx.test" :: lib "mdx.top" :: t.libraries)
~pps:[] ~dune_version
in
let* cctx =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Building the executable generated by the MDX stanza fails when implicit
transitive dependencies are disabled due to an implicit dependency on the
`mdx.top` library:
Building the executable generated by the MDX stanza works when implicit
transitive dependencies are disabled.

$ cat >dune-project <<EOF
> (lang dune 3.0)
Expand All @@ -13,19 +12,3 @@ transitive dependencies are disabled due to an implicit dependency on the
> EOF

$ dune build
File "mdx_gen.ml-gen", line 28, characters 2-19:
28 | Mdx_top.Directory path) []
^^^^^^^^^^^^^^^^^
Error: Unbound module Mdx_top
[1]

Adding `mdx.top` as an explicit dependency of the stanza fixes the issue:

$ cat >dune <<EOF
> (mdx
> (files markdown_file.md)
> (libraries mdx.top))
> EOF

$ dune build

0 comments on commit 29be2ab

Please sign in to comment.