sclass JavaCompilation { File srcDir; L libraries; File classesDir; bool verbose = true; L sources; File optionsFile; S compilerOutput; swappable void invokeJavaCompiler() { compilerOutput = invokeEcj_direct(optionsFile); } run { // collect sources sources = findJavaSourceFiles(srcDir); if (sources.isEmpty()) throw new IOException("No sources found"); // compile optionsFile = File.createTempFile("ecj", "", javaxTempDir()); try { if (verbose) print("Compiling " + sources.size() + " source(s) to " + classesDir.getPath()); if (verbose) print("Libraries: " + libraries); S options = "-d " + pqO(classesDir.getPath()); libraries.add(pathToJavaxJar()); writeOptions(sources, libraries, optionsFile, options); classesDir.mkdirs(); invokeJavaCompiler(); } finally { optionsFile.delete(); } } }