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-ffa450edef68master
| @@ -33,8 +33,6 @@ package org.apache.tools.ant.taskdefs.optional.dotnet; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.tools.ant.taskdefs.condition.Os; | |||||
| // ==================================================================== | // ==================================================================== | ||||
| /** | /** | ||||
| @@ -160,7 +158,7 @@ public class CSharp extends DotnetCompile { | |||||
| unsafe = false; | unsafe = false; | ||||
| noconfig = false; | noconfig = false; | ||||
| definitions = null; | definitions = null; | ||||
| setExecutable(Os.isFamily("windows") ? "csc" : "mcs"); | |||||
| setExecutable(isWindows ? "csc" : "mcs"); | |||||
| } | } | ||||
| @@ -18,6 +18,7 @@ | |||||
| package org.apache.tools.ant.taskdefs.optional.dotnet; | package org.apache.tools.ant.taskdefs.optional.dotnet; | ||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | 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.types.FileSet; | ||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| @@ -46,6 +47,13 @@ public class DotnetBaseMatchingTask extends MatchingTask { | |||||
| */ | */ | ||||
| protected File srcDir; | 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. | * Overridden because we need to be able to set the srcDir. | ||||
| */ | */ | ||||
| @@ -219,7 +219,11 @@ public abstract class DotnetCompile | |||||
| protected String getReferencesParameter() { | protected String getReferencesParameter() { | ||||
| //bail on no references | //bail on no references | ||||
| if (notEmpty(references)) { | if (notEmpty(references)) { | ||||
| return REFERENCE_OPTION + '\"' + references + '\"'; | |||||
| if (isWindows) { | |||||
| return REFERENCE_OPTION + '\"' + references + '\"'; | |||||
| } else { | |||||
| return references; | |||||
| } | |||||
| } else { | } else { | ||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -270,7 +274,13 @@ public abstract class DotnetCompile | |||||
| } | } | ||||
| StringBuffer s = new StringBuffer(REFERENCE_OPTION); | 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(); | return s.toString(); | ||||
| } | } | ||||
| @@ -903,7 +913,7 @@ public abstract class DotnetCompile | |||||
| if (isFileManagedBinary(file)) { | if (isFileManagedBinary(file)) { | ||||
| if (!firstEntry) { | if (!firstEntry) { | ||||
| referenceList.append(getReferenceDelimiter()); | referenceList.append(getReferenceDelimiter()); | ||||
| } else { | |||||
| } else if (isWindows) { | |||||
| referenceList.append('\"'); | referenceList.append('\"'); | ||||
| } | } | ||||
| referenceList.append(file.toString()); | referenceList.append(file.toString()); | ||||
| @@ -918,7 +928,11 @@ public abstract class DotnetCompile | |||||
| // a managed binary | // a managed binary | ||||
| if (!firstEntry) { | if (!firstEntry) { | ||||
| //add it all to an argument | //add it all to an argument | ||||
| command.addArgument(referenceList.toString() + '\"'); | |||||
| if (isWindows) { | |||||
| command.addArgument(referenceList.toString() + '\"'); | |||||
| } else { | |||||
| command.addArgument(referenceList.toString()); | |||||
| } | |||||
| } | } | ||||
| return filesOutOfDate; | return filesOutOfDate; | ||||