[m-rev.] diff: fix bug #235: --restricted-command-line and Java

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Dec 5 03:03:59 AEDT 2011


Branches: main, 11.07

Fix bug #235: support the --restricted-command-line option with the Java
backend.  Its use is necessary on Windows when building the compiler in the
Java grade since otherwise we exceed the command line length limit.
(Building other large programs would presumably be similarly affected.)

compiler/compile_target_code.m:
 	Optionally allow the use of @ files when compiling .java ->
 	.class files.

m4/mercury.m4:
compiler/Mmakefile:
 	We need to quote the argument to the -J option, otherwise
 	it cannot be read from an @ file.

Julien.

Index: compiler/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/Mmakefile,v
retrieving revision 1.112
diff -u -r1.112 Mmakefile
--- compiler/Mmakefile	18 Oct 2011 23:30:50 -0000	1.112
+++ compiler/Mmakefile	4 Dec 2011 15:55:03 -0000
@@ -98,8 +98,8 @@
  # This bumps up the memory when building the compiler if the javac executable
  # accepts the -J-Xmx flag, without bumping up the memory requirements in
  # general.
-ifneq ("$(findstring -J-Xmx,$(JAVACFLAGS))","")
-JAVACFLAGS   += -J-Xmx2048m
+ifneq ("$(findstring -J\"-Xmx,$(JAVACFLAGS))","")
+JAVACFLAGS   += -J\"-Xmx2048m\"
  endif

  #-----------------------------------------------------------------------------#
Index: compiler/compile_target_code.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.178
diff -u -r1.178 compile_target_code.m
--- compiler/compile_target_code.m	8 Nov 2011 02:22:41 -0000	1.178
+++ compiler/compile_target_code.m	4 Dec 2011 12:57:00 -0000
@@ -1048,10 +1048,10 @@
      % 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([JavaCompiler, " ", InclOpt, DirOpts,
-        Target_DebugOpt, JAVAFLAGS, " ", JoinedJavaFiles], Command),
-    invoke_system_command(Globals, ErrorStream, cmd_verbose_commands, Command,
-        Succeeded, !IO).
+    string.append_list([InclOpt, DirOpts,
+        Target_DebugOpt, JAVAFLAGS, " ", JoinedJavaFiles], CommandArgs),
+    invoke_long_system_command(Globals, ErrorStream, cmd_verbose_commands,
+        JavaCompiler, CommandArgs, Succeeded, !IO).

  :- func java_classpath_separator = string.

Index: m4/mercury.m4
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/m4/mercury.m4,v
retrieving revision 1.1
diff -u -r1.1 mercury.m4
--- m4/mercury.m4	8 Nov 2011 02:22:42 -0000	1.1
+++ m4/mercury.m4	4 Dec 2011 15:18:14 -0000
@@ -422,7 +422,7 @@
  AC_CACHE_VAL(mercury_cv_javac_flags_for_heap_size, [
  if test "$mercury_cv_java" = "yes"; then
  	AC_MSG_CHECKING(if the Java compiler accepts the max heap size option)
-	mercury_cv_javac_flags_for_heap_size="-J-Xmx256m"
+	mercury_cv_javac_flags_for_heap_size="-J\"-Xmx256m\""
  	if "$JAVAC" "$mercury_cv_javac_flags_for_heap_size" -version \
                  2> /dev/null
          then

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list