Package org.tempuri.javac.util

Examples of org.tempuri.javac.util.FileSystemClassFactory


    } else {
        fileList.add(fileName);
    }
      }
  }
  FileSystemClassFactory factory = new FileSystemClassFactoryImpl();
  factory.setBootClassPath(bootClassPath);
  factory.setClassPath(classPath);
  factory.setSourcePath(sourcePath);
  factory.setOutputDir(outputDir);
  JavaCompiler compiler = new JavaCompilerImpl();
  if (sourceVersion != null) {
      compiler.setSourceVersion(sourceVersion);
  }
  if (targetVersion != null) {
      compiler.setTargetVersion(targetVersion);
  }
  compiler.setDebug(debug);
  String[] classNames = new String[fileList.size()];
  int i = 0;
  Iterator iter = fileList.iterator();
  while (iter.hasNext()) {
      String fileName = (String)iter.next();
      classNames[i++] = factory.makeClassName(fileName);
  }
  compiler.compile(classNames,
       factory,
       factory,
       factory,
View Full Code Here


     *
     * @throws Throwable
    */

    public static void main(String[] argv) throws Throwable {
  final FileSystemClassFactory fileSystem =
      new FileSystemClassFactoryImpl();
  List fileList = new LinkedList();
  String bootClassPath = System.getProperty("sun.boot.class.path");
  String classPath = System.getProperty("java.class.path");
  String sourcePath = ".";
  String className = null;
  List args = new LinkedList();
  boolean debug = true;
  String sourceVersion = null;
  String targetVersion = null;
  for (int i = 0; i < argv.length; i++) {
      String arg = argv[i];
      if (className == null && arg.startsWith("-")) {
    if (arg.equals("-sourcepath")) {
        if ((i + 1) < argv.length) {
      sourcePath = argv[++i];
        }
    } else if (arg.equals("-classpath") || arg.equals("-cp")) {
        if ((i + 1) < argv.length) {
      classPath = argv[++i];
        }
    } else if (arg.equals("-bootclasspath")) {
        if ((i + 1) < argv.length) {
      bootClassPath = argv[++i];
        }
    } else if (arg.equals("-source")) {
        if ((i + 1) < argv.length) {
      sourceVersion = argv[++i];
        }
    } else if (arg.equals("-target")) {
        if ((i + 1) < argv.length) {
      targetVersion = argv[++i];
        }
    } else if (arg.startsWith("-g")) {
        debug = !arg.equals("-g:none");
    } else if (arg.equals("-help")) {
        usage();
        return;
    } else {
        unknownOption(arg);
    }
      } else {
    if (className == null) {
        className = argv[i];
    } else {
        args.add(argv[i]);
    }
      }
  }
  if (className == null) {
      usage();
      return;
  }
  fileSystem.setBootClassPath(bootClassPath);
  fileSystem.setClassPath(classPath);
  fileSystem.setSourcePath(sourcePath);
        final JavaCompiler compiler = new JavaCompilerImpl();
  compiler.setDebug(debug);
  if (sourceVersion != null) {
      compiler.setSourceVersion(sourceVersion);
  }
View Full Code Here

TOP

Related Classes of org.tempuri.javac.util.FileSystemClassFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.