use of org.eclipse.ceylon.compiler.typechecker.io.cmr.impl.LeakingLogger in project ceylon by eclipse.
the class Main method main.
/**
* Files that are not under a proper module structure are
* placed under a <nomodule> module.
*/
public static void main(String[] args) throws Exception {
if (args.length == 0) {
System.err.println("Usage Main <directoryNames>");
System.exit(-1);
return;
}
RepositoryManager repositoryManager = CeylonUtils.repoManager().systemRepo("../dist/dist/repo").logger(new LeakingLogger()).buildManager();
String verbose = System.getProperties().getProperty("verbose");
// ClosableVirtualFile latestZippedLanguageSourceFile =
// MainHelper.getLatestZippedLanguageSourceFile();
TypeCheckerBuilder tcb = new TypeCheckerBuilder().setRepositoryManager(repositoryManager).verbose("true".equals(verbose)).statistics(true);
// .addSrcDirectory(latestZippedLanguageSourceFile);
for (String path : args) {
tcb.addSrcDirectory(new File(path));
}
tcb.getTypeChecker().process();
// latestZippedLanguageSourceFile.close();
}
use of org.eclipse.ceylon.compiler.typechecker.io.cmr.impl.LeakingLogger in project ceylon by eclipse.
the class MainForLanguage method main.
/**
* Files that are not under a proper module structure are
* placed under a <nomodule> module.
*/
public static void main(String[] args) throws Exception {
ClosableVirtualFile latestZippedLanguageSourceFile = MainHelper.getLatestZippedLanguageSourceFile();
RepositoryManager repositoryManager = CeylonUtils.repoManager().systemRepo("../dist/dist/repo").logger(new LeakingLogger()).buildManager();
TypeChecker typeChecker = new TypeCheckerBuilder().verbose(false).addSrcDirectory(latestZippedLanguageSourceFile).setRepositoryManager(repositoryManager).getTypeChecker();
typeChecker.process();
latestZippedLanguageSourceFile.close();
if (typeChecker.getErrors() > 0) {
System.exit(1);
}
}
use of org.eclipse.ceylon.compiler.typechecker.io.cmr.impl.LeakingLogger in project ceylon by eclipse.
the class MainForTest method main.
/**
* Files that are not under a proper module structure are
* placed under a <nomodule> module.
*/
public static void main(String[] args) throws Exception {
long start = System.nanoTime();
RepositoryManager repositoryManager = CeylonUtils.repoManager().systemRepo("../dist/dist/repo").outRepo("test/modules").logger(new LeakingLogger()).buildManager();
TypeChecker typeChecker = new TypeCheckerBuilder().statistics(true).verbose(false).addSrcDirectory(new File("test/main")).setRepositoryManager(repositoryManager).getTypeChecker();
typeChecker.process();
int errors = typeChecker.getErrors();
Tree.CompilationUnit compilationUnit = typeChecker.getPhasedUnitFromRelativePath("ceylon/language/Object.ceylon").getCompilationUnit();
if (compilationUnit == null) {
throw new RuntimeException("Failed to pass getCompilationUnitFromRelativePath for files in .src");
}
compilationUnit = typeChecker.getPhasedUnitFromRelativePath("capture/Capture.ceylon").getCompilationUnit();
if (compilationUnit == null) {
throw new RuntimeException("Failed to pass getCompilationUnitFromRelativePath for files in real src dir");
}
compilationUnit = typeChecker.getPhasedUnitFromRelativePath("org/eclipse/sample/multisource/Boo.ceylon").getCompilationUnit();
Module module = compilationUnit.getUnit().getPackage().getModule();
if (!"org.eclipse.sample.multisource".equals(module.getNameAsString())) {
throw new RuntimeException("Unable to extract module name");
}
if (!"0.2".equals(module.getVersion())) {
throw new RuntimeException("Unable to extract module version");
}
typeChecker = new TypeCheckerBuilder().verbose(false).addSrcDirectory(new File("test/main/capture")).setRepositoryManager(repositoryManager).getTypeChecker();
typeChecker.process();
errors += typeChecker.getErrors();
compilationUnit = typeChecker.getPhasedUnitFromRelativePath("Capture.ceylon").getCompilationUnit();
if (compilationUnit == null) {
throw new RuntimeException("Failed to pass getCompilationUnitFromRelativePath for top level files (no package) in real src dir");
}
typeChecker = new TypeCheckerBuilder().verbose(false).addSrcDirectory(new File("test/moduledep1")).addSrcDirectory(new File("test/moduledep2")).addSrcDirectory(new File("test/moduletest")).addSrcDirectory(new File("test/restricted")).setRepositoryManager(repositoryManager).getTypeChecker();
typeChecker.process();
errors += typeChecker.getErrors();
ClosableVirtualFile latestZippedLanguageSourceFile = MainHelper.getLatestZippedLanguageSourceFile();
typeChecker = new TypeCheckerBuilder().verbose(false).addSrcDirectory(latestZippedLanguageSourceFile).setRepositoryManager(repositoryManager).getTypeChecker();
typeChecker.process();
errors += typeChecker.getErrors();
latestZippedLanguageSourceFile.close();
System.out.println("Tests took " + ((System.nanoTime() - start) / 1000000) + " ms");
if (errors > 0) {
System.exit(1);
}
}
Aggregations