From c944d6342291616ab7488ef52508b00e1dc08527 Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Tue, 13 Aug 2013 11:43:12 +0000 Subject: [PATCH] ocamlbuild: really stop compilation after plugin compilation when -just-plugin is called git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13997 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- ocamlbuild/plugin.ml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/ocamlbuild/plugin.ml b/ocamlbuild/plugin.ml index 97500e60c..1258f3d58 100644 --- a/ocamlbuild/plugin.ml +++ b/ocamlbuild/plugin.ml @@ -94,7 +94,11 @@ module Make(U:sig end) = in Shell.chdir !Options.build_dir; Shell.rm_f (plugin^(!Options.exe)); - Command.execute cmd + Command.execute cmd; + if !Options.just_plugin then begin + Log.finish (); + raise Exit_OK; + end; end let execute_plugin_if_needed () = @@ -102,13 +106,14 @@ module Make(U:sig end) = begin rebuild_plugin_if_needed (); Shell.chdir Pathname.pwd; - if not !Options.just_plugin then - let runner = if !Options.native_plugin then N else !Options.ocamlrun in - let argv = List.tl (Array.to_list Sys.argv) in - let spec = S[runner; P(!Options.build_dir/plugin^(!Options.exe)); - A"-no-plugin"; atomize (List.filter (fun s -> s <> "-plugin-option") argv)] in - let () = Log.finish () in - raise (Exit_silently_with_code (sys_command (Command.string_of_command_spec spec))) + let runner = if !Options.native_plugin then N else !Options.ocamlrun in + let argv = List.tl (Array.to_list Sys.argv) in + let passed_argv = List.filter (fun s -> s <> "-plugin-option") argv in + let spec = S[runner; P(!Options.build_dir/plugin^(!Options.exe)); + A"-no-plugin"; atomize passed_argv] in + Log.finish (); + let rc = sys_command (Command.string_of_command_spec spec) in + raise (Exit_silently_with_code rc); end else ()