Author: bodewig
Date: Fri Jul 18 04:52:29 2008
New Revision: 677883
URL: http://svn.apache.org/viewvc?rev=677883&view=rev
Log:
/noconfig causes an error if used inside a response file. PR 34992. Submitted
by Chris Nagy
Modified:
ant/antlibs/dotnet/trunk/changes.xml
ant/antlibs/dotnet/trunk/contributors.xml
ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/NetCommand.java
ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/compile/CSharp.java
ant/antlibs/dotnet/trunk/src/tests/antunit/dotnetexec-test.xml
Modified: ant/antlibs/dotnet/trunk/changes.xml
URL:
http://svn.apache.org/viewvc/ant/antlibs/dotnet/trunk/changes.xml?rev=677883&r1=677882&r2=677883&view=diff
==============================================================================
--- ant/antlibs/dotnet/trunk/changes.xml (original)
+++ ant/antlibs/dotnet/trunk/changes.xml Fri Jul 18 04:52:29 2008
@@ -38,6 +38,9 @@
</properties>
<release version="SVN trunk" date="unpublished">
+ <action type="fix" issue="34992">
+ The /noconfig argument must be used outside of a response file.
+ </action>
<action type="fix">
CSC of .NET 3.5 doesn't support the /incremental argument
anymore, only set /incremental+, but never /incremental-.
Modified: ant/antlibs/dotnet/trunk/contributors.xml
URL:
http://svn.apache.org/viewvc/ant/antlibs/dotnet/trunk/contributors.xml?rev=677883&r1=677882&r2=677883&view=diff
==============================================================================
--- ant/antlibs/dotnet/trunk/contributors.xml (original)
+++ ant/antlibs/dotnet/trunk/contributors.xml Fri Jul 18 04:52:29 2008
@@ -43,6 +43,10 @@
<last>Watson</last>
</name>
<name>
+ <first>Chris</first>
+ <last>Nagy</last>
+ </name>
+ <name>
<first>Conor</first>
<last>MacNeill</last>
</name>
Modified:
ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/NetCommand.java
URL:
http://svn.apache.org/viewvc/ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/NetCommand.java?rev=677883&r1=677882&r2=677883&view=diff
==============================================================================
--- ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/NetCommand.java
(original)
+++ ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/NetCommand.java Fri
Jul 18 04:52:29 2008
@@ -32,7 +32,9 @@
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.io.BufferedOutputStream;
+import java.util.ArrayList;
import java.util.Hashtable;
+import java.util.List;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
@@ -51,7 +53,6 @@
* setting the path to point to the dotnet bin directory; in which case the
* shared code should go in here.
*
- [EMAIL PROTECTED] 0.5
*/
public class NetCommand {
@@ -115,6 +116,13 @@
private int automaticResponseFileThreshold = 64;
/**
+ * List of command line arguments that must appear on the command
+ * line and must not go into a response file.
+ * @since .NET Antlib 1.1
+ */
+ private List argsOnCommandLine = new ArrayList();
+
+ /**
* constructor
*
[EMAIL PROTECTED] title (for logging/errors)
@@ -194,24 +202,45 @@
* add an argument to a command line; do nothing if the arg is null or
* empty string
*
- [EMAIL PROTECTED] argument The feature to be added to the Argument
attribute
+ * <p>The given argument may be added to a response file.</p>
+ *
+ * @param argument The feature to be added to the Argument attribute
*/
public void addArgument(String argument) {
+ addArgument(argument, true);
+ }
+
+ /**
+ * add an argument to a command line; do nothing if the arg is
+ * null or empty string
+ *
+ * @param argument The feature to be added to the Argument attribute
+ * @param mayBeInResponseFile whether the argument is allowed
+ * inside a response file.
+ *
+ * @since .NET Antlib 1.1
+ */
+ public void addArgument(String argument, boolean mayBeInResponseFile) {
if (argument != null && argument.length() != 0) {
commandLine.createArgument().setValue(argument);
+ if (!mayBeInResponseFile) {
+ argsOnCommandLine.add(argument);
+ }
}
}
/**
- * add an argument to a command line; do nothing if the arg is null or
- * empty string
+ * Add multiple arguments to a command line; do nothing for args
+ * that are is null or empty strings
*
- [EMAIL PROTECTED] arguments The features to be added to the Argument
attribute
+ * <p>The given arguments may be added to a response file.</p>
+ *
+ * @param arguments The features to be added to the Argument attribute
*/
public void addArguments(String[] arguments) {
if (arguments != null && arguments.length != 0) {
for (int i = 0; i < arguments.length; i++) {
- addArgument(arguments[i]);
+ addArgument(arguments[i], true);
}
}
}
@@ -220,12 +249,14 @@
* concatenate two strings together and add them as a single argument,
* but only if argument2 is non-null and non-zero length
*
+ * <p>The resulting argument may be added to a response file.</p>
+ *
[EMAIL PROTECTED] argument1 The first argument
[EMAIL PROTECTED] argument2 The second argument
*/
public void addArgument(String argument1, String argument2) {
if (argument2 != null && argument2.length() != 0) {
- commandLine.createArgument().setValue(argument1 + argument2);
+ addArgument(argument1 + argument2, true);
}
}
@@ -351,6 +382,9 @@
PrintWriter out = new PrintWriter(new
BufferedOutputStream(fos));
//start at 1 because element 0 is the executable name
for (int i = 1; i < commands.length; ++i) {
+ if (argsOnCommandLine.contains(commands[i])) {
+ continue;
+ }
if (commands[i].indexOf(" ") > -1) {
String q = commands[i].indexOf("\"") > -1 ? "'" : "\"";
out.print(q);
@@ -366,9 +400,14 @@
throw new BuildException("saving command stream to " +
temporaryCommandFile, ex);
}
- String newCommandLine[] = new String[2];
+ String newCommandLine[] = new String[2 + argsOnCommandLine.size()];
newCommandLine[0] = commands[0];
- newCommandLine[1] = "@" + temporaryCommandFile.getAbsolutePath();
+ if (argsOnCommandLine.size() > 0) {
+ System.arraycopy(argsOnCommandLine.toArray(), 0,
+ newCommandLine, 1, argsOnCommandLine.size());
+ }
+ newCommandLine[newCommandLine.length - 1] =
+ "@" + temporaryCommandFile.getAbsolutePath();
logVerbose(Commandline.describeCommand(newCommandLine));
executable.setCommandline(newCommandLine);
}
Modified:
ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/compile/CSharp.java
URL:
http://svn.apache.org/viewvc/ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/compile/CSharp.java?rev=677883&r1=677882&r2=677883&view=diff
==============================================================================
--- ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/compile/CSharp.java
(original)
+++ ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/compile/CSharp.java
Fri Jul 18 04:52:29 2008
@@ -362,7 +362,7 @@
if (getIncremental()) {
command.addArgument(getIncrementalParameter());
}
- command.addArgument(getNoConfigParameter());
+ command.addArgument(getNoConfigParameter(), false);
command.addArgument(getUnsafeParameter());
}
Modified: ant/antlibs/dotnet/trunk/src/tests/antunit/dotnetexec-test.xml
URL:
http://svn.apache.org/viewvc/ant/antlibs/dotnet/trunk/src/tests/antunit/dotnetexec-test.xml?rev=677883&r1=677882&r2=677883&view=diff
==============================================================================
--- ant/antlibs/dotnet/trunk/src/tests/antunit/dotnetexec-test.xml (original)
+++ ant/antlibs/dotnet/trunk/src/tests/antunit/dotnetexec-test.xml Fri Jul 18
04:52:29 2008
@@ -78,5 +78,13 @@
<dn:dotnetexec executable="${testCSC.exe}" failonerror="true" />
</target>
+ <target name="testCSCNoConfig" depends="validate_csc">
+ <dn:csc noconfig="true" useresponsefile="true"
+ destFile="${testCSC.exe}"
+ targetType="exe">
+ <src dir="${src.dir}" includes="ex*.cs"/>
+ </dn:csc>
+ <au:assertLogContains text="/noconfig" level="verbose"/>
+ </target>
</project>