[m-rev.] [for review 3/4] Add the --mfilterjavac option to mmc

Paul Bone paul at bone.id.au
Thu Apr 18 22:55:41 AEST 2013


For review by Julien.

Add the --mfilterjavac option to mmc

The new --mfilterjavac option is used to specify a program to filter javac's
output in order to re-write the locations of errors created by Java foreign
code.

compiler/options.m:
    Add the new option.

compiler/compile_target_code.m:
    Handle the new option.
---
 compiler/compile_target_code.m | 16 ++++++++++++----
 compiler/options.m             |  5 ++++-
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/compiler/compile_target_code.m b/compiler/compile_target_code.m
index 1aaf80a..ba8902f 100644
--- a/compiler/compile_target_code.m
+++ b/compiler/compile_target_code.m
@@ -1125,13 +1125,21 @@ compile_java_files(ErrorStream, JavaFiles, Globals, Succeeded, !IO) :-
         DirOpts = ""
     ),
 
+    globals.lookup_string_option(Globals, filterjavac_command, MFilterJavac),
+    ( MFilterJavac = "" ->
+        MaybeMFilterJavac = no
+    ;
+        MaybeMFilterJavac = yes(MFilterJavac)
+    ),
+
     % Be careful with the order here!  Some options may override others.
     % Also be careful that each option is separated by spaces.
     JoinedJavaFiles = string.join_list(" ", JavaFiles),
     string.append_list([InclOpt, DirOpts,
         Target_DebugOpt, JAVAFLAGS, " ", JoinedJavaFiles], CommandArgs),
-    invoke_long_system_command(Globals, ErrorStream, cmd_verbose_commands,
-        JavaCompiler, CommandArgs, Succeeded, !IO).
+    invoke_long_system_command_maybe_filter_output(Globals, ErrorStream,
+        cmd_verbose_commands, JavaCompiler, CommandArgs, MaybeMFilterJavac,
+        Succeeded, !IO).
 
 :- func java_classpath_separator = string.
 
@@ -3514,8 +3522,8 @@ invoke_long_system_command_maybe_filter_output(Globals, ErrorStream, Verbosity,
             ),
 
             FullCmd = Cmd ++ " " ++ at_file_name(Globals, TmpFile),
-            invoke_system_command(Globals, ErrorStream, Verbosity, FullCmd,
-                Succeeded0, !IO),
+            invoke_system_command_maybe_filter_output(Globals, ErrorStream,
+                Verbosity, FullCmd, MaybeProcessOutput, Succeeded0, !IO),
 
             io.remove_file(TmpFile, RemoveResult, !IO),
             (
diff --git a/compiler/options.m b/compiler/options.m
index e9726fa..1cc2553 100644
--- a/compiler/options.m
+++ b/compiler/options.m
@@ -932,6 +932,7 @@
     ;       mkinit_erl_command
     ;       demangle_command
     ;       filtercc_command
+    ;       filterjavac_command
     ;       trace_libs
     ;       thread_libs
     ;       hwloc_libs
@@ -1837,6 +1838,7 @@ option_defaults_2(link_option, [
     mkinit_erl_command                  -   string("mkinit_erl"),
     demangle_command                    -   string("mdemangle"),
     filtercc_command                    -   string("mfiltercc"),
+    filterjavac_command                 -   string("mfilterjavac"),
     trace_libs                          -   string(""),
     thread_libs                         -   string(""),
     hwloc_libs                          -   string(""),
@@ -2808,6 +2810,7 @@ long_option("mkinit-command",       mkinit_command).
 long_option("mkinit-erl-command",   mkinit_erl_command).
 long_option("demangle-command",     demangle_command).
 long_option("filtercc-command",     filtercc_command).
+long_option("filterjavac-command",  filterjavac_command).
 long_option("trace-libs",           trace_libs).
 long_option("thread-libs",          thread_libs).
 long_option("hwloc-libs",           hwloc_libs).
@@ -5693,7 +5696,7 @@ options_help_link -->
         % --create-archive-command-output-flag, --ranlib-command,
         % --ranlib-flags,
         % --mkinit-command, --demangle-command, --filtercc-command,
-        % --trace-libs,
+        % --filterjavac-command --trace-libs,
         % --thread-libs, --shared-libs, --math-lib, --readline-libs,
         % --hwloc-libs, --hwloc-static-libs,
         % --linker-opt-separator,
-- 
1.8.1.3




More information about the reviews mailing list