| Method from org.apache.tools.ant.taskdefs.optional.dotnet.WsdlToDotnet Detail: |
public void addSchema(WsdlToDotnet.Schema source) {
schemas.add(source);
}
add a new source schema to the compilation |
public void execute() throws BuildException {
log("This task is deprecated and will be removed in a future version\n"
+ "of Ant. It is now part of the .NET Antlib:\n"
+ "http://ant.apache.org/antlibs/dotnet/index.html",
Project.MSG_WARN);
if (compiler == null) {
compiler = Compiler.createDefaultCompiler();
}
validate();
NetCommand command = new NetCommand(this,
"WSDL",
compiler.getCommand());
command.setFailOnError(failOnError);
//fill in args
compiler.applyExtraArgs(command);
command.addArgument("/nologo");
command.addArgument("/out:" + destFile);
command.addArgument("/language:", language);
if (server) {
command.addArgument("/server");
}
command.addArgument("/namespace:", namespace);
if (protocol != null) {
command.addArgument("/protocol:" + protocol);
}
if (ideErrors) {
command.addArgument("/parsableErrors");
}
command.addArgument(extraOptions);
//set source and rebuild options
boolean rebuild = true;
long destLastModified = -1;
//rebuild unless the dest file is newer than the source file
if (destFile.exists()) {
destLastModified = destFile.lastModified();
rebuild = isRebuildNeeded(wsdl, destLastModified);
}
String path;
//mark for a rebuild if the dest file is newer
path = wsdl.evaluate();
if (!compiler.supportsAbsoluteFiles() && wsdl.getFile() != null) {
// Mono 1.0's wsdl doesn't deal with absolute paths
File f = wsdl.getFile();
command.setDirectory(f.getParentFile());
path = f.getName();
}
command.addArgument(path);
//add in any extra files.
//this is an error in mono, but we do not warn on it as they may fix that outside
//the ant build cycle.
Iterator it = schemas.iterator();
while (it.hasNext()) {
Schema schema = (Schema) it.next();
//mark for a rebuild if we are newer
rebuild |= isRebuildNeeded(schema, destLastModified);
command.addArgument(schema.evaluate());
}
//conditionally compile
if (rebuild) {
command.runCommand();
}
}
do the work by building the command line and then calling it |
public void setCompiler(WsdlToDotnet.Compiler compiler) {
this.compiler = compiler;
}
|
public void setDestFile(File destFile) {
this.destFile = destFile;
}
Name of the file to generate. Required |
public void setExtraOptions(String extraOptions) {
this.extraOptions = extraOptions;
}
Any extra WSDL.EXE options which aren't explicitly
supported by the ant wrapper task; optional |
public void setFailOnError(boolean failOnError) {
this.failOnError = failOnError;
}
Whether or not a failure should halt the build.
Optional - default is true. |
public void setIdeErrors(boolean ideErrors) {
this.ideErrors = ideErrors;
}
Defines wether errors are machine parseable.
Optional, default=true |
public void setLanguage(String language) {
this.language = language;
}
set the language; one of "CS", "JS", or "VB"
optional, default is CS for C# source |
public void setMakeURL(boolean b) {
wsdl.setMakeURL(b);
}
flag to trigger turning a filename into a file:url
ignored for the mono compiler. |
public void setNamespace(String namespace) {
this.namespace = namespace;
}
namespace to place the source in.
optional; default "" |
public void setProtocol(String protocol) {
this.protocol = protocol;
}
what protocol to use. SOAP, SOAP1.2, HttpPost and HttpGet
are the base options. Different version and implementations may.
offer different options. |
public void setServer(boolean server) {
this.server = server;
}
flag to enable server side code generation;
optional, default=false |
public void setSrcFile(File srcFile) {
wsdl.setFile(srcFile);
}
The local WSDL file to parse; either url or srcFile is required. |
public void setUrl(String url) {
wsdl.setUrl(url);
}
Sets the URL to fetch. Fetching is by wsdl.exe; Ant proxy settings
are ignored; either url or srcFile is required. |
protected void validate() throws BuildException {
if (destFile == null) {
throw new BuildException(ERROR_NO_DEST_FILE);
}
if (destFile.isDirectory()) {
throw new BuildException(
ERROR_DEST_FILE_IS_DIR);
}
wsdl.validate();
}
|