Ejemplo n.º 1
0
  public List compile(CompilerConfiguration config) throws CompilerException {
    File destinationDir = new File(config.getOutputLocation());

    if (!destinationDir.exists()) {
      destinationDir.mkdirs();
    }

    config.setSourceFiles(null);

    String[] sourceFiles = CSharpCompiler.getSourceFiles(config);

    if (sourceFiles.length == 0) {
      return Collections.EMPTY_LIST;
    }

    System.out.println(
        "Compiling "
            + sourceFiles.length
            + " "
            + "source file"
            + (sourceFiles.length == 1 ? "" : "s")
            + " to "
            + destinationDir.getAbsolutePath());

    String[] args = buildCompilerArguments(config, sourceFiles);

    List messages;

    if (config.isFork()) {
      messages =
          compileOutOfProcess(
              config.getWorkingDirectory(),
              config.getBuildDirectory(),
              findExecutable(config),
              args);
    } else {
      throw new CompilerException("This compiler doesn't support in-process compilation.");
    }

    return messages;
  }
Ejemplo n.º 2
0
 public String[] createCommandLine(CompilerConfiguration config) throws CompilerException {
   return buildCompilerArguments(config, CSharpCompiler.getSourceFiles(config));
 }