522 |
522 |
523 if (sourceFiles.size() > 0) { |
523 if (sourceFiles.size() > 0) { |
524 String classDir = options.destDir.getAbsolutePath(); |
524 String classDir = options.destDir.getAbsolutePath(); |
525 String classpathString = createClasspathString(); |
525 String classpathString = createClasspathString(); |
526 boolean bootCP = useBootClasspath(EndpointContext.class) || useBootClasspath(JAXBPermission.class); |
526 boolean bootCP = useBootClasspath(EndpointContext.class) || useBootClasspath(JAXBPermission.class); |
527 String[] args = new String[4 + (bootCP ? 1 : 0) + (options.debug ? 1 : 0) |
527 List<String> args = new ArrayList<String>(); |
528 + (options.encoding != null ? 2 : 0) + sourceFiles.size()]; |
528 args.add("-d"); |
529 args[0] = "-d"; |
529 args.add(classDir); |
530 args[1] = classDir; |
530 args.add("-classpath"); |
531 args[2] = "-classpath"; |
531 args.add(classpathString); |
532 args[3] = classpathString; |
|
533 int baseIndex = 4; |
|
534 //javac is not working in osgi as the url starts with a bundle |
532 //javac is not working in osgi as the url starts with a bundle |
535 if (bootCP) { |
533 if (bootCP) { |
536 args[baseIndex++] = "-Xbootclasspath/p:"+JavaCompilerHelper.getJarFile(EndpointContext.class)+File.pathSeparator+JavaCompilerHelper.getJarFile(JAXBPermission.class); |
534 args.add("-Xbootclasspath/p:" |
|
535 + JavaCompilerHelper.getJarFile(EndpointContext.class) |
|
536 + File.pathSeparator |
|
537 + JavaCompilerHelper.getJarFile(JAXBPermission.class)); |
537 } |
538 } |
538 |
539 |
539 if (options.debug) { |
540 if (options.debug) { |
540 args[baseIndex++] = "-g"; |
541 args.add("-g"); |
541 } |
542 } |
542 |
543 |
543 if (options.encoding != null) { |
544 if (options.encoding != null) { |
544 args[baseIndex++] = "-encoding"; |
545 args.add("-encoding"); |
545 args[baseIndex++] = options.encoding; |
546 args.add(options.encoding); |
|
547 } |
|
548 |
|
549 if (options.javacOptions != null) { |
|
550 args.addAll(options.getJavacOptions(args, listener)); |
546 } |
551 } |
547 |
552 |
548 for (int i = 0; i < sourceFiles.size(); ++i) { |
553 for (int i = 0; i < sourceFiles.size(); ++i) { |
549 args[baseIndex + i] = sourceFiles.get(i); |
554 args.add(sourceFiles.get(i)); |
550 } |
555 } |
551 |
556 |
552 listener.message(WscompileMessages.WSIMPORT_COMPILING_CODE()); |
557 listener.message(WscompileMessages.WSIMPORT_COMPILING_CODE()); |
553 if(options.verbose){ |
558 if(options.verbose){ |
554 StringBuilder argstr = new StringBuilder(); |
559 StringBuilder argstr = new StringBuilder(); |
556 argstr.append(arg).append(" "); |
561 argstr.append(arg).append(" "); |
557 } |
562 } |
558 listener.message("javac "+ argstr.toString()); |
563 listener.message("javac "+ argstr.toString()); |
559 } |
564 } |
560 |
565 |
561 return JavaCompilerHelper.compile(args, out, receiver); |
566 return JavaCompilerHelper.compile(args.toArray(new String[args.size()]), out, receiver); |
562 } |
567 } |
563 //there are no files to compile, so return true? |
568 //there are no files to compile, so return true? |
564 return true; |
569 return true; |
565 } |
570 } |
566 |
571 |