From 5f67d82896a918aef2c70b6974da1fef26183d22 Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Thu, 20 Mar 2014 15:54:10 +0000 Subject: [PATCH] PR#6187: Add a warning when using -plugin-tag(s) without myocamlbuild.ml (Patch by Jacques-Pascal Deplaix) git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14475 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- Changes | 2 ++ ocamlbuild/plugin.ml | 3 +++ ocamlbuild/testsuite/internal.ml | 12 +++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index ddcfcb86d..068d22f1e 100644 --- a/Changes +++ b/Changes @@ -92,6 +92,8 @@ Features wishes: - PR#6064: GADT representation for Bigarray.kind + CAML_BA_CHAR runtime kind - PR#6071: Add a -noinit option to the toplevel (patch by David Sheets) - PR#6166: document -ocamldoc option of ocamlbuild +- PR#6187: ocamlbuild: warn when using -plugin-tag(s) without myocamlbuild.ml + (patch by Jacques-Pascal Deplaix) - PR#6246: allow wilcard _ as for-loop index - ocamllex: user-definable refill action (patch by Frédéric Bour, review by Gabriel Scherer and Luc Maranget) diff --git a/ocamlbuild/plugin.ml b/ocamlbuild/plugin.ml index 6e533bb90..eb831e722 100644 --- a/ocamlbuild/plugin.ml +++ b/ocamlbuild/plugin.ml @@ -248,6 +248,9 @@ module Make(U:sig end) = let rc = sys_command (Command.string_of_command_spec spec) in raise (Exit_silently_with_code rc); end + else if not (sys_file_exists plugin_file) && !Options.plugin_tags <> [] then + eprintf "Warning: option -plugin-tag(s) has no effect \ + in absence of plugin file %S" plugin_file else () end diff --git a/ocamlbuild/testsuite/internal.ml b/ocamlbuild/testsuite/internal.ml index b25594f88..5d3c28840 100644 --- a/ocamlbuild/testsuite/internal.ml +++ b/ocamlbuild/testsuite/internal.ml @@ -239,6 +239,16 @@ let () = test "PluginCompilation3" T.f "myocamlbuild.ml" ~content:"print_endline \"foo\";;"] (* if the plugin were executed we'd get "foo" in failing_msg *) ~failing_msg:"" - ~targets:("main,byte", []) ();; + ~targets:("main.byte", []) ();; + +let () = test "PluginTagsWarning" + ~description:"check that a warning is raised if -plugin-tags \ + is used without a plugin file" + ~options:[`no_ocamlfind; `plugin_tag "use_str"] + ~tree:[T.f "main.ml" ~content:""] + ~matching:[_build [M.f "main.cmo"]] + ~failing_msg:"Warning: option -plugin-tag(s) has no effect \ + in absence of plugin file \"myocamlbuild.ml\"" + ~targets:("main.ml", []) ();; run ~root:"_test_internal";;