use of com.redhat.ceylon.compiler.java.tools.CeyloncFileManager in project ceylon-compiler by ceylon.
the class CompilerTests method getCompilerTask.
protected CeyloncTaskImpl getCompilerTask(List<String> initialOptions, DiagnosticListener<? super FileObject> diagnosticListener, List<String> modules, String... sourcePaths) {
java.util.List<File> sourceFiles = new ArrayList<File>(sourcePaths.length);
for (String file : sourcePaths) {
sourceFiles.add(new File(getPackagePath(), file));
}
CeyloncTool runCompiler = makeCompiler();
CeyloncFileManager runFileManager = makeFileManager(runCompiler, diagnosticListener);
// make sure the destination repo exists
new File(destDir).mkdirs();
List<String> options = new LinkedList<String>();
options.addAll(initialOptions);
if (!options.contains("-src"))
options.addAll(Arrays.asList("-src", getSourcePath()));
if (!options.contains("-cacherep"))
options.addAll(Arrays.asList("-cacherep", getCachePath()));
if (!options.contains("-cp"))
options.addAll(Arrays.asList("-cp", getClassPathAsPath()));
boolean hasVerbose = false;
for (String option : options) {
if (option.startsWith("-verbose")) {
hasVerbose = true;
break;
}
}
if (!hasVerbose)
options.add("-verbose:ast,code");
Iterable<? extends JavaFileObject> compilationUnits1 = runFileManager.getJavaFileObjectsFromFiles(sourceFiles);
return runCompiler.getTask(null, runFileManager, diagnosticListener, options, modules, compilationUnits1);
}
Aggregations