From 2e7f881d4cd99900bbe6990de61742184e6ef513 Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Thu, 1 Mar 2018 20:47:08 +0000 Subject: [PATCH] Fix #567 The alias module needs an implementation for non-jbuilder users. --- src/gen_rules.ml | 18 ++++++++---------- test/blackbox-tests/test-cases/intf-only/run.t | 3 ++- .../test-cases/js_of_ocaml/run.t | 6 ++++-- test/blackbox-tests/test-cases/scope-bug/run.t | 3 ++- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/gen_rules.ml b/src/gen_rules.ml index e65ba44c..6354b110 100644 --- a/src/gen_rules.ml +++ b/src/gen_rules.ml @@ -318,18 +318,16 @@ module Gen(P : Install_rules.Params) = struct String_map.mem modules main_module_name) then None else if String_map.mem modules main_module_name then - let file ext = - Some { Module.File. - name = sprintf "%s__%s-gen" lib.name ext - ; syntax = OCaml - } - in - (* The tests don't pass with 4.02 if we don't do that *) - let needs_impl = ctx.version < (4, 03, 0) in + (* This module needs an implementaion for non-jbuilder + users of the library: + + https://github.com/ocaml/dune/issues/567 *) Some { Module.name = main_module_name ^ "__" - ; impl = if needs_impl then file ".ml" else None - ; intf = if not needs_impl then file ".mli" else None + ; intf = None + ; impl = Some { name = sprintf "%s__.ml-gen" lib.name + ; syntax = OCaml + } ; obj_name = lib.name ^ "__" } else diff --git a/test/blackbox-tests/test-cases/intf-only/run.t b/test/blackbox-tests/test-cases/intf-only/run.t index 66cc0d06..ef560448 100644 --- a/test/blackbox-tests/test-cases/intf-only/run.t +++ b/test/blackbox-tests/test-cases/intf-only/run.t @@ -3,8 +3,9 @@ Successes: $ $JBUILDER build --display short --root foo -j1 --debug-dep 2>&1 | grep -v Entering ocamldep test/bar.ml.d ocamldep foo.ml.d - ocamlc .foo.objs/foo__.{cmi,cmti} + ocamlc .foo.objs/foo__.{cmi,cmo,cmt} ocamldep intf.mli.d + ocamlopt .foo.objs/foo__.{cmx,o} ocamlc .foo.objs/foo__Intf.{cmi,cmti} ocamlc .foo.objs/foo.{cmi,cmo,cmt} ocamlopt .foo.objs/foo.{cmx,o} diff --git a/test/blackbox-tests/test-cases/js_of_ocaml/run.t b/test/blackbox-tests/test-cases/js_of_ocaml/run.t index 2109d024..96c4b40a 100644 --- a/test/blackbox-tests/test-cases/js_of_ocaml/run.t +++ b/test/blackbox-tests/test-cases/js_of_ocaml/run.t @@ -1,12 +1,13 @@ $ $JBUILDER build -j1 --display short --root . --dev bin/technologic.bc.js @install lib/x.cma.js lib/x__Y.cmo.js bin/z.cmo.js ocamlc lib/stubs.o ocamlopt .ppx/js_of_ocaml-ppx/ppx.exe - ocamlc lib/.x.objs/x__.{cmi,cmti} + ocamlc lib/.x.objs/x__.{cmi,cmo,cmt} ocamlmklib lib/dllx_stubs.so,lib/libx_stubs.a ppx lib/x.pp.ml ppx lib/y.pp.ml ppx bin/technologic.pp.ml ppx bin/z.pp.ml + ocamlopt lib/.x.objs/x__.{cmx,o} ocamldep lib/x.pp.ml.d ocamldep lib/y.pp.ml.d ocamldep bin/technologic.pp.ml.d @@ -34,8 +35,9 @@ break it fix it $ $JBUILDER build -j1 --display short --root . bin/technologic.bc.js @install - ocamlc lib/.x.objs/x__.{cmi,cmti} + ocamlc lib/.x.objs/x__.{cmi,cmo,cmt} ocamlc lib/.x.objs/x__Y.{cmi,cmo,cmt} + ocamlopt lib/.x.objs/x__.{cmx,o} ocamlc lib/.x.objs/x.{cmi,cmo,cmt} ocamlopt lib/.x.objs/x__Y.{cmx,o} ocamlc lib/x.cma diff --git a/test/blackbox-tests/test-cases/scope-bug/run.t b/test/blackbox-tests/test-cases/scope-bug/run.t index 426eda0c..66b3b909 100644 --- a/test/blackbox-tests/test-cases/scope-bug/run.t +++ b/test/blackbox-tests/test-cases/scope-bug/run.t @@ -1,9 +1,10 @@ $ $JBUILDER build -j1 --display short --root . @install ocamldep alib/alib.ml.d ocamldep alib/main.ml.d - ocamlc alib/.alib.objs/alib__.{cmi,cmti} + ocamlc alib/.alib.objs/alib__.{cmi,cmo,cmt} ocamldep blib/blib.ml.d ocamldep blib/sub/sub.ml.d + ocamlopt alib/.alib.objs/alib__.{cmx,o} ocamlc blib/sub/.sub.objs/sub.{cmi,cmo,cmt} ocamlopt blib/sub/.sub.objs/sub.{cmx,o} ocamlc blib/.blib.objs/blib.{cmi,cmo,cmt}