From 67776debe7e8f2d81828caf29d8a7645564e4750 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 11 Apr 2005 08:39:40 +0000 Subject: [PATCH] mcs on Linux doesn't like quotes in /references. I guess it is a platform-depenent command line parsing issue rather than Mono vs MS, so I madi it conditional on the OS. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278126 13f79535-47bb-0310-9956-ffa450edef68 --- .../ant/taskdefs/optional/dotnet/CSharp.java | 4 +--- .../dotnet/DotnetBaseMatchingTask.java | 8 +++++++ .../optional/dotnet/DotnetCompile.java | 22 +++++++++++++++---- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java index 072777eac..5d6f4a30e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java @@ -33,8 +33,6 @@ package org.apache.tools.ant.taskdefs.optional.dotnet; import java.io.File; -import org.apache.tools.ant.taskdefs.condition.Os; - // ==================================================================== /** @@ -160,7 +158,7 @@ public class CSharp extends DotnetCompile { unsafe = false; noconfig = false; definitions = null; - setExecutable(Os.isFamily("windows") ? "csc" : "mcs"); + setExecutable(isWindows ? "csc" : "mcs"); } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetBaseMatchingTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetBaseMatchingTask.java index e31e03243..85e678144 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetBaseMatchingTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetBaseMatchingTask.java @@ -18,6 +18,7 @@ package org.apache.tools.ant.taskdefs.optional.dotnet; import org.apache.tools.ant.taskdefs.MatchingTask; +import org.apache.tools.ant.taskdefs.condition.Os; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.Project; import org.apache.tools.ant.DirectoryScanner; @@ -46,6 +47,13 @@ public class DotnetBaseMatchingTask extends MatchingTask { */ protected File srcDir; + /** + * Are we running on Windows? + * + * @since Ant 1.6.3 + */ + protected static final boolean isWindows = Os.isFamily("windows"); + /** * Overridden because we need to be able to set the srcDir. */ diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java index 4e7ff0cb7..c7c9088de 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java @@ -219,7 +219,11 @@ public abstract class DotnetCompile protected String getReferencesParameter() { //bail on no references if (notEmpty(references)) { - return REFERENCE_OPTION + '\"' + references + '\"'; + if (isWindows) { + return REFERENCE_OPTION + '\"' + references + '\"'; + } else { + return references; + } } else { return null; } @@ -270,7 +274,13 @@ public abstract class DotnetCompile } StringBuffer s = new StringBuffer(REFERENCE_OPTION); - s.append('\"').append(refpath).append('\"'); + if (isWindows) { + s.append('\"'); + } + s.append(refpath); + if (isWindows) { + s.append('\"'); + } return s.toString(); } @@ -903,7 +913,7 @@ public abstract class DotnetCompile if (isFileManagedBinary(file)) { if (!firstEntry) { referenceList.append(getReferenceDelimiter()); - } else { + } else if (isWindows) { referenceList.append('\"'); } referenceList.append(file.toString()); @@ -918,7 +928,11 @@ public abstract class DotnetCompile // a managed binary if (!firstEntry) { //add it all to an argument - command.addArgument(referenceList.toString() + '\"'); + if (isWindows) { + command.addArgument(referenceList.toString() + '\"'); + } else { + command.addArgument(referenceList.toString()); + } } return filesOutOfDate;