bodewig 2004/07/28 06:46:37
Modified: src/etc/testcases/taskdefs/optional WsdlToDotnet.xml
src/main/org/apache/tools/ant/taskdefs/optional/dotnet
WsdlToDotnet.java
Log:
<wsdltodotnet> should now work with Mono 1.0 as well
Revision Changes Path
1.6 +4 -4 ant/src/etc/testcases/taskdefs/optional/WsdlToDotnet.xml
Index: WsdlToDotnet.xml
===================================================================
RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/optional/WsdlToDotnet.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- WsdlToDotnet.xml 23 Sep 2003 06:29:20 -0000 1.5
+++ WsdlToDotnet.xml 28 Jul 2004 13:46:36 -0000 1.6
@@ -40,6 +40,7 @@
<echo> wsdl.found=${wsdl.found}</echo>
<condition property="csc.found">
<or>
+ <available file="mcs" filepath="${env.PATH}" />
<available file="csc" filepath="${env.PATH}" />
<available file="csc.exe" filepath="${env.PATH}" />
<available file="csc.exe" filepath="${env.Path}" />
@@ -57,7 +58,6 @@
<condition property="dotnetapps.found">
<and>
<isset property="csc.found"/>
- <isset property="vbc.found"/>
<isset property="wsdl.found"/>
</and>
</condition>
@@ -142,7 +142,7 @@
- <target name="testLocalWsdlVB" depends="init">
+ <target name="testLocalWsdlVB" depends="init" if="vbc.found">
<wsdltodotnet destFile="${out.vbc}"
language="VB"
srcFile="${local.wsdl}"
@@ -160,7 +160,7 @@
</target>
<target name="testLocalWsdlServerVB"
- depends="init" >
+ depends="init" if="vbc.found">
<wsdltodotnet destFile="${out.vbc}"
language="VB"
srcFile="${local.wsdl}"
@@ -179,7 +179,7 @@
<fail unless="app.created">No app created</fail>
</target>
- <target name="testInvalidExtraOpsVB" depends="init" if="vbc.found">
+ <target name="testInvalidExtraOpsVB" depends="init">
<wsdltodotnet destFile="${out.vbc}"
language="VB"
srcFile="${local.wsdl}"
1.22 +38 -8
ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WsdlToDotnet.java
Index: WsdlToDotnet.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WsdlToDotnet.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- WsdlToDotnet.java 9 Mar 2004 16:48:18 -0000 1.21
+++ WsdlToDotnet.java 28 Jul 2004 13:46:37 -0000 1.22
@@ -19,6 +19,8 @@
import java.io.File;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.condition.Os;
+import org.apache.tools.ant.util.FileUtils;
/**
* Converts a WSDL file or URL resource into a .NET language.
@@ -57,7 +59,7 @@
/**
* name of source file
*/
- private File srcFile = null;
+ private String srcFileName = null;
/**
* language; defaults to C#
@@ -85,6 +87,11 @@
protected String extraOptions = null;
/**
+ * @since Ant 1.7
+ */
+ private boolean isMono = !Os.isFamily("windows");
+
+ /**
* Name of the file to generate. Required
* @param destFile filename
*/
@@ -106,8 +113,13 @@
* The local WSDL file to parse; either url or srcFile is required.
* @param srcFile name of WSDL file
*/
- public void setSrcFile(File srcFile) {
- this.srcFile = srcFile;
+ public void setSrcFile(String srcFileName) {
+ if (new File(srcFileName).isAbsolute()) {
+ srcFileName = FileUtils.newFileUtils()
+ .removeLeadingPath(getProject().getBaseDir(),
+ new File(srcFileName));;
+ }
+ this.srcFileName = srcFileName;
}
/**
@@ -158,6 +170,17 @@
}
/**
+ * Explicitly override the Mono auto-detection.
+ *
+ * <p>Defaults to false on Windows and true on any other platform.</p>
+ *
+ * @since Ant 1.7
+ */
+ public void setMono(boolean b) {
+ isMono = b;
+ }
+
+ /**
* validation code
* @throws BuildException if validation failed
*/
@@ -170,15 +193,16 @@
throw new BuildException(
"destination file is a directory");
}
- if (url != null && srcFile != null) {
+ if (url != null && srcFileName != null) {
throw new BuildException(
"you can not specify both a source file and a URL");
}
- if (url == null && srcFile == null) {
+ if (url == null && srcFileName == null) {
throw new BuildException(
"you must specify either a source file or a URL");
}
- if (srcFile != null) {
+ if (srcFileName != null) {
+ File srcFile = getProject().resolveFile(srcFileName);
if (!srcFile.exists()) {
throw new BuildException(
"source file does not exist");
@@ -213,8 +237,14 @@
//set source and rebuild options
boolean rebuild = true;
- if (srcFile != null) {
- command.addArgument(srcFile.toString());
+ if (srcFileName != null) {
+ File srcFile = getProject().resolveFile(srcFileName);
+ if (isMono) {
+ // Mono 1.0's wsdl doesn't deal with absolute paths
+ command.addArgument(srcFileName);
+ } else {
+ command.addArgument(srcFile.toString());
+ }
//rebuild unless the dest file is newer than the source file
if (srcFile.exists() && destFile.exists()
&& srcFile.lastModified() <= destFile.lastModified()) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]