From 4570020ce7a001dfbf0c2bf9b33f9a8c7062fd50 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 18 Dec 2017 20:50:27 +0800 Subject: [PATCH] Fix reason preprocessing and previously failed test --- src/super_context.ml | 5 +- test/blackbox-tests/test-cases/reason/run.t | 67 +++++++++++++++++++-- 2 files changed, 64 insertions(+), 8 deletions(-) diff --git a/src/super_context.ml b/src/super_context.ml index 678b8aa2..ea57a102 100644 --- a/src/super_context.ml +++ b/src/super_context.ml @@ -873,9 +873,8 @@ module PP = struct (Deps.interpret sctx ~scope ~dir preprocessor_deps) in String_map.map modules ~f:(fun (m : Module.t) -> - let m = setup_reason_rules sctx ~dir m in match Preprocess_map.find m.name preprocess with - | No_preprocessing -> m + | No_preprocessing -> setup_reason_rules sctx ~dir m | Action action -> pped_module m ~dir ~f:(fun _kind src dst -> add_rule sctx @@ -894,8 +893,10 @@ module PP = struct ~dep_kind ~targets:(Static [dst]) ~scope)) + |> setup_reason_rules sctx ~dir | Pps { pps; flags } -> let ppx_exe = get_ppx_driver sctx pps ~dir ~dep_kind in + let m = setup_reason_rules sctx ~dir m in pped_module m ~dir ~f:(fun kind src dst -> add_rule sctx (preprocessor_deps diff --git a/test/blackbox-tests/test-cases/reason/run.t b/test/blackbox-tests/test-cases/reason/run.t index 2a6771b2..7ee3ea14 100644 --- a/test/blackbox-tests/test-cases/reason/run.t +++ b/test/blackbox-tests/test-cases/reason/run.t @@ -1,11 +1,9 @@ $ $JBUILDER runtest -j1 --root . refmt bar.re.ml - refmt cppome.re.ml ocamldep pp/reasononlypp.depends.ocamldep-output refmt hello.re.ml refmt pped.re.ml ocamlc rlib.{cmi,cmo,cmt} - refmt cppome.re.mli refmt foo.re.mli refmt hello.re.mli refmt pped.re.mli @@ -13,7 +11,64 @@ ocamlopt rlib.{cmx,o} ocamlopt pp/reasononlypp.{cmx,o} ocamlopt pp/reasononlypp.exe - reasononlypp cppome.re.pp.ml (exit 1) - (cd _build/default && ./pp/reasononlypp.exe cppome.re.ml) > _build/default/cppome.re.pp.ml - cppome.re.ml is not a reason source - [1] + reasononlypp cppome.pp.re + reasononlypp cppome.pp.rei + refmt cppome.pp.re.ml + refmt cppome.pp.re.mli + ocamldep rlib.depends.ocamldep-output + ocamldep rlib.dependsi.ocamldep-output + ocamlc rlib__Bar.{cmi,cmti} + ocamlc rlib__Cppome.{cmi,cmti} + ocamlc rlib__Foo.{cmi,cmti} + ocamlc rlib__Hello.{cmi,cmti} + ocamlc rlib__Pped.{cmi,cmti} + ocamlc rlib__Bar.{cmo,cmt} + ocamlopt rlib__Bar.{cmx,o} + ocamlc rlib__Cppome.{cmo,cmt} + ocamlopt rlib__Cppome.{cmx,o} + ocamlc rlib__Foo.{cmo,cmt} + ocamlopt rlib__Foo.{cmx,o} + ocamlc rlib__Hello.{cmo,cmt} + ocamlopt rlib__Hello.{cmx,o} + ocamlc rlib__Pped.{cmo,cmt} + ocamlopt rlib__Pped.{cmx,o} + ocamlc rlib.cma + ocamlopt rlib.{a,cmxa} + ocamlopt rlib.cmxs + lib: [ + "_build/install/default/lib/rlib/META" {"META"} + "_build/install/default/lib/rlib/opam" {"opam"} + "_build/install/default/lib/rlib/rlib__Bar.cmi" + "_build/install/default/lib/rlib/rlib__Bar.cmx" + "_build/install/default/lib/rlib/rlib__Bar.cmt" + "_build/install/default/lib/rlib/rlib__Bar.cmti" + "_build/install/default/lib/rlib/bar.mli" + "_build/install/default/lib/rlib/rlib__Cppome.cmi" + "_build/install/default/lib/rlib/rlib__Cppome.cmx" + "_build/install/default/lib/rlib/rlib__Cppome.cmt" + "_build/install/default/lib/rlib/rlib__Cppome.cmti" + "_build/install/default/lib/rlib/cppome.rei" + "_build/install/default/lib/rlib/rlib__Foo.cmi" + "_build/install/default/lib/rlib/rlib__Foo.cmx" + "_build/install/default/lib/rlib/rlib__Foo.cmt" + "_build/install/default/lib/rlib/rlib__Foo.cmti" + "_build/install/default/lib/rlib/foo.rei" + "_build/install/default/lib/rlib/rlib__Hello.cmi" + "_build/install/default/lib/rlib/rlib__Hello.cmx" + "_build/install/default/lib/rlib/rlib__Hello.cmt" + "_build/install/default/lib/rlib/rlib__Hello.cmti" + "_build/install/default/lib/rlib/hello.rei" + "_build/install/default/lib/rlib/rlib__Pped.cmi" + "_build/install/default/lib/rlib/rlib__Pped.cmx" + "_build/install/default/lib/rlib/rlib__Pped.cmt" + "_build/install/default/lib/rlib/rlib__Pped.cmti" + "_build/install/default/lib/rlib/pped.rei" + "_build/install/default/lib/rlib/rlib.cmi" + "_build/install/default/lib/rlib/rlib.cmx" + "_build/install/default/lib/rlib/rlib.cmt" + "_build/install/default/lib/rlib/rlib.ml-gen" + "_build/install/default/lib/rlib/rlib.cma" + "_build/install/default/lib/rlib/rlib.cmxa" + "_build/install/default/lib/rlib/rlib.a" + "_build/install/default/lib/rlib/rlib.cmxs" + ]