> An argument file can include javac options and source filenames in > any combination. The arguments within a file can be space-separated > or newline-separated. that means, file names must be quoted if they contain spaces. No idea whether this is true for JDK 1.2 or 1.3 as well (1.1 doesn't support @argfile). PR: 10499 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274533 13f79535-47bb-0310-9956-ffa450edef68master
@@ -109,6 +109,9 @@ Fixed bugs: | |||||
* <replaceregexp> didn't work for multi-byte encodings if byline was false. | * <replaceregexp> didn't work for multi-byte encodings if byline was false. | ||||
Bugzilla Report 19187. | Bugzilla Report 19187. | ||||
* file names that include spaces need to be quoted inside the @argfile | |||||
argument using forked <javac> and JDK 1.4. Bugzilla Report 10499. | |||||
Other changes: | Other changes: | ||||
-------------- | -------------- | ||||
* Six new Clearcase tasks added. | * Six new Clearcase tasks added. | ||||
@@ -398,6 +398,25 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
* system. | * system. | ||||
*/ | */ | ||||
protected int executeExternalCompile(String[] args, int firstFileName) { | protected int executeExternalCompile(String[] args, int firstFileName) { | ||||
return executeExternalCompile(args, firstFileName, false); | |||||
} | |||||
/** | |||||
* Do the compile with the specified arguments. | |||||
* @param args - arguments to pass to process on command line | |||||
* @param firstFileName - index of the first source file in args, | |||||
* if the index is negative, no temporary file will ever be | |||||
* created, but this may hit the command line length limit on your | |||||
* system. | |||||
* @param quoteFilenames - if set to true, filenames containing | |||||
* spaces will be quoted when they appear in the external file. | |||||
* This is necessary when running JDK 1.4's javac and probably | |||||
* others. | |||||
* | |||||
* @since Ant 1.6 | |||||
*/ | |||||
protected int executeExternalCompile(String[] args, int firstFileName, | |||||
boolean quoteFiles) { | |||||
String[] commandArray = null; | String[] commandArray = null; | ||||
File tmpFile = null; | File tmpFile = null; | ||||
@@ -418,7 +437,11 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
tmpFile = fileUtils.createTempFile("files", "", userDir); | tmpFile = fileUtils.createTempFile("files", "", userDir); | ||||
out = new PrintWriter(new FileWriter(tmpFile)); | out = new PrintWriter(new FileWriter(tmpFile)); | ||||
for (int i = firstFileName; i < args.length; i++) { | for (int i = firstFileName; i < args.length; i++) { | ||||
out.println(args[i]); | |||||
if (quoteFiles && args[i].indexOf(" ") > -1) { | |||||
out.println("\"" + args[i] + "\""); | |||||
} else { | |||||
out.println(args[i]); | |||||
} | |||||
} | } | ||||
out.flush(); | out.flush(); | ||||
commandArray = new String[firstFileName + 1]; | commandArray = new String[firstFileName + 1]; | ||||
@@ -1,7 +1,7 @@ | |||||
/* | /* | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* | * | ||||
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights | |||||
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights | |||||
* reserved. | * reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
@@ -79,7 +79,10 @@ public class JavacExternal extends DefaultCompilerAdapter { | |||||
logAndAddFilesToCompile(cmd); | logAndAddFilesToCompile(cmd); | ||||
return | return | ||||
executeExternalCompile(cmd.getCommandline(), firstFileName) == 0; | |||||
executeExternalCompile(cmd.getCommandline(), firstFileName, | |||||
!assumeJava11() && !assumeJava12() | |||||
&& !assumeJava13()) | |||||
== 0; | |||||
} | } | ||||
} | } | ||||