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();
}
}