예제 #1
0
  private void _createStartupCommand(
      final ModuleChunk chunk,
      final ArrayList<String> commandLine,
      @NotNull final String outputPath)
      throws IOException {

    myTempFile = FileUtil.createTempFile("jikes", ".tmp");
    myTempFile.deleteOnExit();

    final List<VirtualFile> files = chunk.getFilesToCompile();
    PrintWriter writer = new PrintWriter(new FileWriter(myTempFile));
    try {
      for (VirtualFile file : files) {
        writer.println(file.getPath());
      }
    } finally {
      writer.close();
    }

    String compilerPath = getCompilerPath();
    LOG.assertTrue(compilerPath != null, "No path to compiler configured");

    commandLine.add(compilerPath);

    //noinspection HardCodedStringLiteral
    commandLine.add("-verbose");
    //noinspection HardCodedStringLiteral
    commandLine.add("-classpath");

    // must include output path to classpath, otherwise javac will compile all dependent files no
    // matter were they compiled before or not
    commandLine.add(
        chunk.getCompilationBootClasspath() + File.pathSeparator + chunk.getCompilationClasspath());

    setupSourceVersion(chunk, commandLine);
    //noinspection HardCodedStringLiteral
    commandLine.add("-sourcepath");
    String sourcePath = chunk.getSourcePath();
    if (sourcePath.length() > 0) {
      commandLine.add(sourcePath);
    } else {
      commandLine.add("\"\"");
    }

    //noinspection HardCodedStringLiteral
    commandLine.add("-d");
    commandLine.add(outputPath.replace('/', File.separatorChar));

    JikesSettings jikesSettings = JikesConfiguration.getSettings(myProject);
    StringTokenizer tokenizer = new StringTokenizer(jikesSettings.getOptionsString(), " ");
    while (tokenizer.hasMoreTokens()) {
      commandLine.add(tokenizer.nextToken());
    }
    commandLine.add("@" + myTempFile.getAbsolutePath());
  }
예제 #2
0
 @NotNull
 public Configurable createConfigurable() {
   return new JikesConfigurable(JikesConfiguration.getSettings(myProject));
 }
예제 #3
0
 private String getCompilerPath() {
   return JikesConfiguration.getSettings(myProject).JIKES_PATH.replace('/', File.separatorChar);
 }