src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsimportTool.java

Tue, 06 Mar 2012 16:09:35 -0800

author
ohair
date
Tue, 06 Mar 2012 16:09:35 -0800
changeset 286
f50545b5e2f1
child 368
0989ad8c0860
permissions
-rw-r--r--

7150322: Stop using drop source bundles in jaxws
Reviewed-by: darcy, ohrstrom

ohair@286 1 /*
ohair@286 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
ohair@286 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ohair@286 4 *
ohair@286 5 * This code is free software; you can redistribute it and/or modify it
ohair@286 6 * under the terms of the GNU General Public License version 2 only, as
ohair@286 7 * published by the Free Software Foundation. Oracle designates this
ohair@286 8 * particular file as subject to the "Classpath" exception as provided
ohair@286 9 * by Oracle in the LICENSE file that accompanied this code.
ohair@286 10 *
ohair@286 11 * This code is distributed in the hope that it will be useful, but WITHOUT
ohair@286 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@286 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@286 14 * version 2 for more details (a copy is included in the LICENSE file that
ohair@286 15 * accompanied this code).
ohair@286 16 *
ohair@286 17 * You should have received a copy of the GNU General Public License version
ohair@286 18 * 2 along with this work; if not, write to the Free Software Foundation,
ohair@286 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@286 20 *
ohair@286 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@286 22 * or visit www.oracle.com if you need additional information or have any
ohair@286 23 * questions.
ohair@286 24 */
ohair@286 25
ohair@286 26 package com.sun.tools.internal.ws.wscompile;
ohair@286 27
ohair@286 28 import com.sun.codemodel.internal.CodeWriter;
ohair@286 29 import com.sun.codemodel.internal.writer.ProgressCodeWriter;
ohair@286 30 import com.sun.tools.internal.ws.ToolVersion;
ohair@286 31 import com.sun.tools.internal.ws.api.TJavaGeneratorExtension;
ohair@286 32 import com.sun.tools.internal.ws.processor.generator.CustomExceptionGenerator;
ohair@286 33 import com.sun.tools.internal.ws.processor.generator.GeneratorBase;
ohair@286 34 import com.sun.tools.internal.ws.processor.generator.SeiGenerator;
ohair@286 35 import com.sun.tools.internal.ws.processor.generator.ServiceGenerator;
ohair@286 36 import com.sun.tools.internal.ws.processor.generator.JwsImplGenerator;
ohair@286 37 import com.sun.tools.internal.ws.processor.model.Model;
ohair@286 38 import com.sun.tools.internal.ws.processor.modeler.wsdl.ConsoleErrorReporter;
ohair@286 39 import com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler;
ohair@286 40 import com.sun.tools.internal.ws.processor.util.DirectoryUtil;
ohair@286 41 import com.sun.tools.internal.ws.resources.WscompileMessages;
ohair@286 42 import com.sun.tools.internal.ws.resources.WsdlMessages;
ohair@286 43 import com.sun.tools.internal.ws.util.WSDLFetcher;
ohair@286 44 import com.sun.tools.internal.ws.wsdl.parser.MetadataFinder;
ohair@286 45 import com.sun.tools.internal.ws.wsdl.parser.WSDLInternalizationLogic;
ohair@286 46 import com.sun.tools.internal.xjc.util.NullStream;
ohair@286 47 import com.sun.xml.internal.ws.api.server.Container;
ohair@286 48 import com.sun.xml.internal.ws.util.ServiceFinder;
ohair@286 49 import com.sun.istack.internal.tools.ParallelWorldClassLoader;
ohair@286 50 import org.xml.sax.EntityResolver;
ohair@286 51 import org.xml.sax.SAXParseException;
ohair@286 52
ohair@286 53 import javax.xml.bind.JAXBPermission;
ohair@286 54 import javax.xml.stream.*;
ohair@286 55 import javax.xml.ws.EndpointContext;
ohair@286 56 import java.io.*;
ohair@286 57 import java.util.*;
ohair@286 58 import java.net.Authenticator;
ohair@286 59 import java.util.jar.JarEntry;
ohair@286 60 import java.util.jar.JarOutputStream;
ohair@286 61 import org.xml.sax.SAXException;
ohair@286 62
ohair@286 63 /**
ohair@286 64 * @author Vivek Pandey
ohair@286 65 */
ohair@286 66 public class WsimportTool {
ohair@286 67 private static final String WSIMPORT = "wsimport";
ohair@286 68 private final PrintStream out;
ohair@286 69 private final Container container;
ohair@286 70
ohair@286 71 /**
ohair@286 72 * Wsimport specific options
ohair@286 73 */
ohair@286 74 protected WsimportOptions options = new WsimportOptions();
ohair@286 75
ohair@286 76 public WsimportTool(OutputStream out) {
ohair@286 77 this(out, null);
ohair@286 78 }
ohair@286 79
ohair@286 80 public WsimportTool(OutputStream logStream, Container container) {
ohair@286 81 this.out = (logStream instanceof PrintStream)?(PrintStream)logStream:new PrintStream(logStream);
ohair@286 82 this.container = container;
ohair@286 83 }
ohair@286 84
ohair@286 85 protected class Listener extends WsimportListener {
ohair@286 86 ConsoleErrorReporter cer = new ConsoleErrorReporter(out == null ? new PrintStream(new NullStream()) : out);
ohair@286 87
ohair@286 88 @Override
ohair@286 89 public void generatedFile(String fileName) {
ohair@286 90 message(fileName);
ohair@286 91 }
ohair@286 92
ohair@286 93 @Override
ohair@286 94 public void message(String msg) {
ohair@286 95 out.println(msg);
ohair@286 96 }
ohair@286 97
ohair@286 98 @Override
ohair@286 99 public void error(SAXParseException exception) {
ohair@286 100 cer.error(exception);
ohair@286 101 }
ohair@286 102
ohair@286 103 @Override
ohair@286 104 public void fatalError(SAXParseException exception) {
ohair@286 105 cer.fatalError(exception);
ohair@286 106 }
ohair@286 107
ohair@286 108 @Override
ohair@286 109 public void warning(SAXParseException exception) {
ohair@286 110 cer.warning(exception);
ohair@286 111 }
ohair@286 112
ohair@286 113 @Override
ohair@286 114 public void debug(SAXParseException exception) {
ohair@286 115 cer.debug(exception);
ohair@286 116 }
ohair@286 117
ohair@286 118 @Override
ohair@286 119 public void info(SAXParseException exception) {
ohair@286 120 cer.info(exception);
ohair@286 121 }
ohair@286 122
ohair@286 123 public void enableDebugging(){
ohair@286 124 cer.enableDebugging();
ohair@286 125 }
ohair@286 126 }
ohair@286 127
ohair@286 128 protected class Receiver extends ErrorReceiverFilter {
ohair@286 129
ohair@286 130 private Listener listener;
ohair@286 131
ohair@286 132 public Receiver(Listener listener) {
ohair@286 133 super(listener);
ohair@286 134 this.listener = listener;
ohair@286 135 }
ohair@286 136
ohair@286 137 public void info(SAXParseException exception) {
ohair@286 138 if (options.verbose)
ohair@286 139 super.info(exception);
ohair@286 140 }
ohair@286 141
ohair@286 142 public void warning(SAXParseException exception) {
ohair@286 143 if (!options.quiet)
ohair@286 144 super.warning(exception);
ohair@286 145 }
ohair@286 146
ohair@286 147 @Override
ohair@286 148 public void pollAbort() throws AbortException {
ohair@286 149 if (listener.isCanceled())
ohair@286 150 throw new AbortException();
ohair@286 151 }
ohair@286 152
ohair@286 153 @Override
ohair@286 154 public void debug(SAXParseException exception){
ohair@286 155 if(options.debugMode){
ohair@286 156 listener.debug(exception);
ohair@286 157 }
ohair@286 158 }
ohair@286 159 }
ohair@286 160
ohair@286 161 public boolean run(String[] args) {
ohair@286 162 Listener listener = new Listener();
ohair@286 163 Receiver receiver = new Receiver(listener);
ohair@286 164 return run(args, listener, receiver);
ohair@286 165 }
ohair@286 166
ohair@286 167 protected boolean run(String[] args, Listener listener,
ohair@286 168 Receiver receiver) {
ohair@286 169 for (String arg : args) {
ohair@286 170 if (arg.equals("-version")) {
ohair@286 171 listener.message(
ohair@286 172 WscompileMessages.WSIMPORT_VERSION(ToolVersion.VERSION.MAJOR_VERSION));
ohair@286 173 return true;
ohair@286 174 }
ohair@286 175 if (arg.equals("-fullversion")) {
ohair@286 176 listener.message(
ohair@286 177 WscompileMessages.WSIMPORT_FULLVERSION(ToolVersion.VERSION.toString()));
ohair@286 178 return true;
ohair@286 179 }
ohair@286 180 }
ohair@286 181
ohair@286 182 Authenticator orig = null;
ohair@286 183 try {
ohair@286 184 parseArguments(args, listener, receiver);
ohair@286 185
ohair@286 186 try {
ohair@286 187 orig = DefaultAuthenticator.getCurrentAuthenticator();
ohair@286 188
ohair@286 189 Model wsdlModel = buildWsdlModel(listener, receiver);
ohair@286 190 if (wsdlModel == null)
ohair@286 191 return false;
ohair@286 192
ohair@286 193 if (!generateCode(listener, receiver, wsdlModel, true))
ohair@286 194 return false;
ohair@286 195
ohair@286 196 /* Not so fast!
ohair@286 197 } catch(AbortException e){
ohair@286 198 //error might have been reported
ohair@286 199 *
ohair@286 200 */
ohair@286 201 }catch (IOException e) {
ohair@286 202 receiver.error(e);
ohair@286 203 return false;
ohair@286 204 }catch (XMLStreamException e) {
ohair@286 205 receiver.error(e);
ohair@286 206 return false;
ohair@286 207 }
ohair@286 208 if (!options.nocompile){
ohair@286 209 if(!compileGeneratedClasses(receiver, listener)){
ohair@286 210 listener.message(WscompileMessages.WSCOMPILE_COMPILATION_FAILED());
ohair@286 211 return false;
ohair@286 212 }
ohair@286 213 }
ohair@286 214 try {
ohair@286 215 if (options.clientjar != null) {
ohair@286 216 //add all the generated class files to the list of generated files
ohair@286 217 addClassesToGeneratedFiles();
ohair@286 218 jarArtifacts(listener);
ohair@286 219
ohair@286 220 }
ohair@286 221 } catch (IOException e) {
ohair@286 222 receiver.error(e);
ohair@286 223 return false;
ohair@286 224 }
ohair@286 225
ohair@286 226 } catch (Options.WeAreDone done) {
ohair@286 227 usage(done.getOptions());
ohair@286 228 } catch (BadCommandLineException e) {
ohair@286 229 if (e.getMessage() != null) {
ohair@286 230 System.out.println(e.getMessage());
ohair@286 231 System.out.println();
ohair@286 232 }
ohair@286 233 usage(e.getOptions());
ohair@286 234 return false;
ohair@286 235 } finally{
ohair@286 236 deleteGeneratedFiles();
ohair@286 237 if (!options.disableAuthenticator) {
ohair@286 238 Authenticator.setDefault(orig);
ohair@286 239 }
ohair@286 240 }
ohair@286 241 if(receiver.hadError()) {
ohair@286 242 return false;
ohair@286 243 }
ohair@286 244 return true;
ohair@286 245 }
ohair@286 246
ohair@286 247 private void deleteGeneratedFiles() {
ohair@286 248 Set<File> trackedRootPackages = new HashSet<File>();
ohair@286 249
ohair@286 250 if (options.clientjar != null) {
ohair@286 251 //remove all non-java artifacts as they will packaged in jar.
ohair@286 252 Iterable<File> generatedFiles = options.getGeneratedFiles();
ohair@286 253 synchronized (generatedFiles) {
ohair@286 254 for (File file : generatedFiles) {
ohair@286 255 if (!file.getName().endsWith(".java")) {
ohair@286 256 file.delete();
ohair@286 257 trackedRootPackages.add(file.getParentFile());
ohair@286 258
ohair@286 259 }
ohair@286 260
ohair@286 261 }
ohair@286 262 }
ohair@286 263 //remove empty package dirs
ohair@286 264 for(File pkg:trackedRootPackages) {
ohair@286 265
ohair@286 266 while(pkg.list() != null && pkg.list().length ==0 && !pkg.equals(options.destDir)) {
ohair@286 267 File parentPkg = pkg.getParentFile();
ohair@286 268 pkg.delete();
ohair@286 269 pkg = parentPkg;
ohair@286 270 }
ohair@286 271 }
ohair@286 272 }
ohair@286 273 if(!options.keep) {
ohair@286 274 options.removeGeneratedFiles();
ohair@286 275 }
ohair@286 276
ohair@286 277 }
ohair@286 278
ohair@286 279 private void addClassesToGeneratedFiles() throws IOException {
ohair@286 280 Iterable<File> generatedFiles = options.getGeneratedFiles();
ohair@286 281 final List<File> trackedClassFiles = new ArrayList<File>();
ohair@286 282 for(File f: generatedFiles) {
ohair@286 283 if(f.getName().endsWith(".java")) {
ohair@286 284 String relativeDir = DirectoryUtil.getRelativePathfromCommonBase(f.getParentFile(),options.sourceDir);
ohair@286 285 final String className = f.getName().substring(0,f.getName().indexOf(".java"));
ohair@286 286 File classDir = new File(options.destDir,relativeDir);
ohair@286 287 if(classDir.exists()) {
ohair@286 288 classDir.listFiles(new FilenameFilter() {
ohair@286 289
ohair@286 290 public boolean accept(File dir, String name) {
ohair@286 291 if(name.equals(className+".class") || (name.startsWith(className+"$") && name.endsWith(".class"))) {
ohair@286 292 trackedClassFiles.add(new File(dir,name));
ohair@286 293 return true;
ohair@286 294 }
ohair@286 295 return false;
ohair@286 296 }
ohair@286 297 });
ohair@286 298 }
ohair@286 299 }
ohair@286 300 }
ohair@286 301 for(File f: trackedClassFiles) {
ohair@286 302 options.addGeneratedFile(f);
ohair@286 303 }
ohair@286 304 }
ohair@286 305
ohair@286 306 private void jarArtifacts(WsimportListener listener) throws IOException {
ohair@286 307 File zipFile = new File(options.clientjar);
ohair@286 308 if(!zipFile.isAbsolute()) {
ohair@286 309 zipFile = new File(options.destDir, options.clientjar);
ohair@286 310 }
ohair@286 311
ohair@286 312 if (zipFile.exists()) {
ohair@286 313 //TODO
ohair@286 314 }
ohair@286 315 FileOutputStream fos = null;
ohair@286 316 if( !options.quiet )
ohair@286 317 listener.message(WscompileMessages.WSIMPORT_ARCHIVING_ARTIFACTS(zipFile));
ohair@286 318
ohair@286 319
ohair@286 320 fos = new FileOutputStream(zipFile);
ohair@286 321 JarOutputStream jos = new JarOutputStream(fos);
ohair@286 322
ohair@286 323 String base = options.destDir.getCanonicalPath();
ohair@286 324 for(File f: options.getGeneratedFiles()) {
ohair@286 325 //exclude packaging the java files in the jar
ohair@286 326 if(f.getName().endsWith(".java")) {
ohair@286 327 continue;
ohair@286 328 }
ohair@286 329 if(options.verbose) {
ohair@286 330 listener.message(WscompileMessages.WSIMPORT_ARCHIVE_ARTIFACT(f, options.clientjar));
ohair@286 331 }
ohair@286 332 String entry = f.getCanonicalPath().substring(base.length()+1);
ohair@286 333 BufferedInputStream bis = new BufferedInputStream(
ohair@286 334 new FileInputStream(f));
ohair@286 335 JarEntry jarEntry = new JarEntry(entry);
ohair@286 336 jos.putNextEntry(jarEntry);
ohair@286 337 int bytesRead;
ohair@286 338 byte[] buffer = new byte[1024];
ohair@286 339 while ((bytesRead = bis.read(buffer)) != -1) {
ohair@286 340 jos.write(buffer, 0, bytesRead);
ohair@286 341 }
ohair@286 342 bis.close();
ohair@286 343
ohair@286 344 }
ohair@286 345
ohair@286 346 jos.close();
ohair@286 347
ohair@286 348 }
ohair@286 349
ohair@286 350 protected void parseArguments(String[] args, Listener listener,
ohair@286 351 Receiver receiver) throws BadCommandLineException {
ohair@286 352 options.parseArguments(args);
ohair@286 353 options.validate();
ohair@286 354 if (options.debugMode)
ohair@286 355 listener.enableDebugging();
ohair@286 356 options.parseBindings(receiver);
ohair@286 357 }
ohair@286 358
ohair@286 359 protected Model buildWsdlModel(Listener listener,
ohair@286 360 Receiver receiver) throws BadCommandLineException, XMLStreamException, IOException {
ohair@286 361 if( !options.quiet )
ohair@286 362 listener.message(WscompileMessages.WSIMPORT_PARSING_WSDL());
ohair@286 363
ohair@286 364 //set auth info
ohair@286 365 //if(options.authFile != null)
ohair@286 366 if (!options.disableAuthenticator) {
ohair@286 367 Authenticator.setDefault(new DefaultAuthenticator(receiver, options.authFile));
ohair@286 368 }
ohair@286 369
ohair@286 370 MetadataFinder forest = new MetadataFinder(new WSDLInternalizationLogic(), options, receiver);
ohair@286 371 forest.parseWSDL();
ohair@286 372 if (forest.isMexMetadata)
ohair@286 373 receiver.reset();
ohair@286 374
ohair@286 375 WSDLModeler wsdlModeler = new WSDLModeler(options, receiver,forest);
ohair@286 376 Model wsdlModel = wsdlModeler.buildModel();
ohair@286 377 if (wsdlModel == null) {
ohair@286 378 listener.message(WsdlMessages.PARSING_PARSE_FAILED());
ohair@286 379 }
ohair@286 380
ohair@286 381 if(options.clientjar != null) {
ohair@286 382 if( !options.quiet )
ohair@286 383 listener.message(WscompileMessages.WSIMPORT_FETCHING_METADATA());
ohair@286 384 options.wsdlLocation = new WSDLFetcher(options,listener).fetchWsdls(forest);
ohair@286 385 }
ohair@286 386
ohair@286 387 return wsdlModel;
ohair@286 388 }
ohair@286 389
ohair@286 390 protected boolean generateCode(Listener listener, Receiver receiver,
ohair@286 391 Model wsdlModel, boolean generateService)
ohair@286 392 throws IOException {
ohair@286 393 //generated code
ohair@286 394 if( !options.quiet )
ohair@286 395 listener.message(WscompileMessages.WSIMPORT_GENERATING_CODE());
ohair@286 396
ohair@286 397 TJavaGeneratorExtension[] genExtn = ServiceFinder.find(TJavaGeneratorExtension.class).toArray();
ohair@286 398 CustomExceptionGenerator.generate(wsdlModel, options, receiver);
ohair@286 399 SeiGenerator.generate(wsdlModel, options, receiver, genExtn);
ohair@286 400 if(receiver.hadError()){
ohair@286 401 throw new AbortException();
ohair@286 402 }
ohair@286 403 if (generateService)
ohair@286 404 {
ohair@286 405 ServiceGenerator.generate(wsdlModel, options, receiver);
ohair@286 406 }
ohair@286 407 for (GeneratorBase g : ServiceFinder.find(GeneratorBase.class)) {
ohair@286 408 g.init(wsdlModel, options, receiver);
ohair@286 409 g.doGeneration();
ohair@286 410 }
ohair@286 411
ohair@286 412 List<String> implFiles = null;
ohair@286 413 if (options.isGenerateJWS) {
ohair@286 414 implFiles = JwsImplGenerator.generate(wsdlModel, options, receiver);
ohair@286 415 }
ohair@286 416
ohair@286 417 for (Plugin plugin: options.activePlugins) {
ohair@286 418 try {
ohair@286 419 plugin.run(wsdlModel, options, receiver);
ohair@286 420 } catch (SAXException sex) {
ohair@286 421 // fatal error. error should have been reported
ohair@286 422 return false;
ohair@286 423 }
ohair@286 424 }
ohair@286 425
ohair@286 426 CodeWriter cw;
ohair@286 427 if (options.filer != null) {
ohair@286 428 cw = new FilerCodeWriter(options.sourceDir, options);
ohair@286 429 } else {
ohair@286 430 cw = new WSCodeWriter(options.sourceDir, options);
ohair@286 431 }
ohair@286 432
ohair@286 433 if (options.verbose)
ohair@286 434 cw = new ProgressCodeWriter(cw, out);
ohair@286 435 options.getCodeModel().build(cw);
ohair@286 436
ohair@286 437 if (options.isGenerateJWS) {
ohair@286 438 //move Impl files to implDestDir
ohair@286 439 return JwsImplGenerator.moveToImplDestDir(implFiles, options, receiver);
ohair@286 440 }
ohair@286 441
ohair@286 442 return true;
ohair@286 443 }
ohair@286 444
ohair@286 445 public void setEntityResolver(EntityResolver resolver){
ohair@286 446 this.options.entityResolver = resolver;
ohair@286 447 }
ohair@286 448
ohair@286 449 /*
ohair@286 450 * To take care of JDK6-JDK6u3, where 2.1 API classes are not there
ohair@286 451 */
ohair@286 452 private static boolean useBootClasspath(Class clazz) {
ohair@286 453 try {
ohair@286 454 ParallelWorldClassLoader.toJarUrl(clazz.getResource('/'+clazz.getName().replace('.','/')+".class"));
ohair@286 455 return true;
ohair@286 456 } catch(Exception e) {
ohair@286 457 return false;
ohair@286 458 }
ohair@286 459 }
ohair@286 460
ohair@286 461 protected boolean compileGeneratedClasses(ErrorReceiver receiver, WsimportListener listener){
ohair@286 462 List<String> sourceFiles = new ArrayList<String>();
ohair@286 463
ohair@286 464 for (File f : options.getGeneratedFiles()) {
ohair@286 465 if (f.exists() && f.getName().endsWith(".java")) {
ohair@286 466 sourceFiles.add(f.getAbsolutePath());
ohair@286 467 }
ohair@286 468 }
ohair@286 469
ohair@286 470 if (sourceFiles.size() > 0) {
ohair@286 471 String classDir = options.destDir.getAbsolutePath();
ohair@286 472 String classpathString = createClasspathString();
ohair@286 473 boolean bootCP = useBootClasspath(EndpointContext.class) || useBootClasspath(JAXBPermission.class);
ohair@286 474 String[] args = new String[4 + (bootCP ? 1 : 0) + (options.debug ? 1 : 0)
ohair@286 475 + (options.encoding != null ? 2 : 0) + sourceFiles.size()];
ohair@286 476 args[0] = "-d";
ohair@286 477 args[1] = classDir;
ohair@286 478 args[2] = "-classpath";
ohair@286 479 args[3] = classpathString;
ohair@286 480 int baseIndex = 4;
ohair@286 481 //javac is not working in osgi as the url starts with a bundle
ohair@286 482 if (bootCP) {
ohair@286 483 args[baseIndex++] = "-Xbootclasspath/p:"+JavaCompilerHelper.getJarFile(EndpointContext.class)+File.pathSeparator+JavaCompilerHelper.getJarFile(JAXBPermission.class);
ohair@286 484 }
ohair@286 485
ohair@286 486 if (options.debug) {
ohair@286 487 args[baseIndex++] = "-g";
ohair@286 488 }
ohair@286 489
ohair@286 490 if (options.encoding != null) {
ohair@286 491 args[baseIndex++] = "-encoding";
ohair@286 492 args[baseIndex++] = options.encoding;
ohair@286 493 }
ohair@286 494
ohair@286 495 for (int i = 0; i < sourceFiles.size(); ++i) {
ohair@286 496 args[baseIndex + i] = sourceFiles.get(i);
ohair@286 497 }
ohair@286 498
ohair@286 499 listener.message(WscompileMessages.WSIMPORT_COMPILING_CODE());
ohair@286 500 if(options.verbose){
ohair@286 501 StringBuffer argstr = new StringBuffer();
ohair@286 502 for(String arg:args){
ohair@286 503 argstr.append(arg).append(" ");
ohair@286 504 }
ohair@286 505 listener.message("javac "+ argstr.toString());
ohair@286 506 }
ohair@286 507
ohair@286 508 return JavaCompilerHelper.compile(args, out, receiver);
ohair@286 509 }
ohair@286 510 //there are no files to compile, so return true?
ohair@286 511 return true;
ohair@286 512 }
ohair@286 513
ohair@286 514 private String createClasspathString() {
ohair@286 515 StringBuilder classpathStr = new StringBuilder(System.getProperty("java.class.path"));
ohair@286 516 for(String s: options.cmdlineJars) {
ohair@286 517 classpathStr.append(File.pathSeparator);
ohair@286 518 classpathStr.append(new File(s).toString());
ohair@286 519 }
ohair@286 520 return classpathStr.toString();
ohair@286 521 }
ohair@286 522
ohair@286 523 protected void usage(Options options) {
ohair@286 524 System.out.println(WscompileMessages.WSIMPORT_HELP(WSIMPORT));
ohair@286 525 System.out.println(WscompileMessages.WSIMPORT_USAGE_EXTENSIONS());
ohair@286 526 System.out.println(WscompileMessages.WSIMPORT_USAGE_EXAMPLES());
ohair@286 527 }
ohair@286 528 }

mercurial