Skip to content
Permalink
Browse files
/noconfig causes an error if used inside a response file. PR 34992. S…
…ubmitted by Chris Nagy

git-svn-id: https://svn.apache.org/repos/asf/ant/antlibs/dotnet/trunk@677883 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
bodewig committed Jul 18, 2008
1 parent 298dd65 commit 79108ef2efca0913ef9ca565fd344dcc30c8b660
Showing 5 changed files with 64 additions and 10 deletions.
@@ -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-.
@@ -42,6 +42,10 @@
<first>Brian</first>
<last>Watson</last>
</name>
<name>
<first>Chris</first>
<last>Nagy</last>
</name>
<name>
<first>Conor</first>
<last>MacNeill</last>
@@ -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.
*
*@version 0.5
*/

public class NetCommand {
@@ -114,6 +115,13 @@ public class NetCommand {
*/
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
*
@@ -194,24 +202,45 @@ protected void logError(String msg) {
* 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
* <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
*
*@param 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 @@ public void addArguments(String[] arguments) {
* 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>
*
*@param argument1 The first argument
*@param 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 @@ private void setExecutableCommandLine() {
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 @@ private void setExecutableCommandLine() {
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);
}
@@ -362,7 +362,7 @@ public void addCompilerSpecificOptions(NetCommand command) {
if (getIncremental()) {
command.addArgument(getIncrementalParameter());
}
command.addArgument(getNoConfigParameter());
command.addArgument(getNoConfigParameter(), false);
command.addArgument(getUnsafeParameter());
}

@@ -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>

0 comments on commit 79108ef

Please sign in to comment.