use of org.eclipse.ceylon.langtools.tools.javac.util.Abort in project ceylon by eclipse.
the class LanguageCompiler method addResources.
private void addResources() throws Abort {
HashSet<String> written = new HashSet<String>();
try {
for (JavaFileObject fo : resourceFileObjects) {
CeyloncFileManager dfm = (CeyloncFileManager) fileManager;
String jarFileName = JarUtils.toPlatformIndependentPath(dfm.getLocation(CeylonLocation.RESOURCE_PATH), fo.getName());
if (!written.contains(jarFileName)) {
dfm.setModule(modelLoader.findModuleForFile(new File(jarFileName)));
FileObject outFile = dfm.getFileForOutput(StandardLocation.CLASS_OUTPUT, "", jarFileName, null);
OutputStream out = outFile.openOutputStream();
try {
InputStream in = new FileInputStream(new File(fo.getName()));
try {
JarUtils.copy(in, out);
} finally {
in.close();
}
} finally {
out.close();
}
written.add(jarFileName);
}
}
} catch (IOException ex) {
throw new Abort(ex);
}
}
use of org.eclipse.ceylon.langtools.tools.javac.util.Abort in project ceylon by eclipse.
the class CeylonEnter method prepareForTypeChecking.
public void prepareForTypeChecking(List<JCCompilationUnit> trees) {
if (hasRun)
throw new RuntimeException("Waaaaa, running twice!!!");
// By now le language module version should be known (as local)
// or we should use the default one.
int numParserErrors = log.nerrors;
// load the standard modules
timer.startTask("loadStandardModules");
compilerDelegate.loadStandardModules(modelLoader);
timer.endTask();
// load the modules we are compiling first
hasRun = true;
// make sure we don't load the files we are compiling from their class files
timer.startTask("setupSourceFileObjects");
compilerDelegate.setupSourceFileObjects(trees, modelLoader);
timer.endTask();
// resolve module dependencies
timer.startTask("verifyModuleDependencyTree");
compilerDelegate.resolveModuleDependencies(phasedUnits);
timer.endTask();
// now load package descriptors
timer.startTask("loadPackageDescriptors");
compilerDelegate.loadPackageDescriptors(modelLoader);
timer.endTask();
// at this point, abort if we had any errors logged due to module descriptors
timer.startTask("collectTreeErrors");
collectTreeErrors(false, false);
timer.endTask();
// check if we abort on errors or not
if (options.get(Option.CEYLONCONTINUE) == null) {
// they can't be re-logged and duplicated later on
if (log.nerrors - numParserErrors > 0)
throw new Abort();
}
}
Aggregations