use of org.eclipse.ceylon.javax.tools.StandardJavaFileManager in project ceylon by eclipse.
the class BcTests method compileJava.
private CompilationTask compileJava(String... sourcePaths) {
java.util.List<File> sourceFiles = new ArrayList<File>(sourcePaths.length);
for (String file : sourcePaths) {
sourceFiles.add(new File(getPackagePath(), file));
}
JavaCompiler runCompiler = ToolProvider.getSystemJavaCompiler();
assertNotNull("Missing Java compiler, this test is probably being run with a JRE instead of a JDK!", runCompiler);
StandardJavaFileManager runFileManager = runCompiler.getStandardFileManager(null, null, null);
// make sure the destination repo exists
new File(destDir).mkdirs();
List<String> options = new LinkedList<String>();
options.addAll(Arrays.asList("-sourcepath", getSourcePath(), "-d", destDir, "-cp", getClassPathAsPath()));
Iterable<? extends JavaFileObject> compilationUnits1 = runFileManager.getJavaFileObjectsFromFiles(sourceFiles);
return runCompiler.getTask(null, runFileManager, null, options, null, compilationUnits1);
}
Aggregations