use of org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon by eclipse.
the class IssuesTests_1500_1999 method testBug1773.
@Test
public void testBug1773() {
ErrorCollector collector = new ErrorCollector();
CeyloncTaskImpl task = getCompilerTask(defaultOptions, collector, "bug17xx/Bug1773.ceylon");
// now compile it all the way
ExitState exitState = task.call2();
Assert.assertEquals(ExitState.CeylonState.ERROR, exitState.ceylonState);
// make sure we only got one, do not trust actualErrors.size() for that since it's a Set so
// two methods with same contents would count as one.
Assert.assertEquals(1, exitState.errorCount);
TreeSet<CompilerError> actualErrors = collector.get(Diagnostic.Kind.ERROR);
compareErrors(actualErrors, new CompilerError(22, "dynamic is not supported on the JVM"));
}
use of org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon by eclipse.
the class MiscTests method compileSDKTests.
private void compileSDKTests(String[] modules, String[] extraModules) {
String sourceDir = "../../ceylon-sdk/test-source";
String depsDir = "../../ceylon-sdk/test-deps";
// don't run this if the SDK is not checked out
File sdkFile = new File(sourceDir);
if (!sdkFile.exists())
return;
java.util.List<String> moduleNames = new ArrayList<String>(modules.length);
for (String module : modules) {
String name = "test.ceylon." + module;
// only add it if it exists
if (new File(sourceDir, name.replace('.', File.separatorChar)).isDirectory())
moduleNames.add(name);
}
for (String module : extraModules) {
moduleNames.add(module);
}
CeyloncTool compiler;
try {
compiler = new CeyloncTool();
} catch (VerifyError e) {
System.err.println("ERROR: Cannot run tests! Did you maybe forget to configure the -Xbootclasspath/p: parameter?");
throw e;
}
ErrorCollector errorCollector = new ErrorCollector();
CeyloncFileManager fileManager = (CeyloncFileManager) compiler.getStandardFileManager(null, null, null);
CeyloncTaskImpl task = (CeyloncTaskImpl) compiler.getTask(null, fileManager, errorCollector, Arrays.asList("-sourcepath", sourceDir, "-sysrep", getSysRepPath(), "-rep", depsDir, "-d", "build/classes-sdk", "-cp", getClassPathAsPath()), moduleNames, null);
Boolean result = task.call();
Assert.assertEquals("Compilation of SDK tests failed:" + errorCollector.getAssertionFailureMessage(), Boolean.TRUE, result);
}
use of org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon by eclipse.
the class CMRTests method compileModuleFromSourceFolder.
private void compileModuleFromSourceFolder(String module, String srcFolder, String outFolder, String... repos) {
List<String> options = new LinkedList<String>();
options.add("-src");
options.add(getPackagePath() + "/modules/" + srcFolder);
if (outFolder != null) {
options.add("-out");
options.add(outFolder);
} else {
options.addAll(defaultOptions);
}
for (String repo : repos) {
options.add("-rep");
options.add(repo);
}
CeyloncTaskImpl task = getCompilerTask(options, null, Arrays.asList(module));
Boolean ret = task.call();
assertTrue(ret);
}
use of org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon by eclipse.
the class CMRTests method testMdlCompilerGeneratesModuleForValidUnits.
@Test
public void testMdlCompilerGeneratesModuleForValidUnits() throws IOException {
CeyloncTaskImpl compilerTask = getCompilerTask("modules/single/module.ceylon", "modules/single/Correct.ceylon", "modules/single/Invalid.ceylon");
Boolean success = compilerTask.call();
assertFalse(success);
File carFile = getModuleArchive("org.eclipse.ceylon.compiler.java.test.cmr.modules.single", "6.6.6");
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry moduleClass = car.getEntry("org/eclipse/ceylon/compiler/java/test/cmr/modules/single/$module_.class");
assertNotNull(moduleClass);
ZipEntry correctClass = car.getEntry("org/eclipse/ceylon/compiler/java/test/cmr/modules/single/Correct.class");
assertNotNull(correctClass);
ZipEntry invalidClass = car.getEntry("org/eclipse/ceylon/compiler/java/test/cmr/modules/single/Invalid.class");
assertNull(invalidClass);
car.close();
}
use of org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon by eclipse.
the class CMRTests method testMdlAetherMissingDependenciesOverride.
@Test
public void testMdlAetherMissingDependenciesOverride() throws IOException {
// Try to compile the ceylon module
CeyloncTaskImpl ceylonTask = getCompilerTask(Arrays.asList("-out", destDir, "-rep", "aether", "-overrides", getPackagePath() + "/modules/bug1100/overrides.xml"), "modules/bug1100/module.ceylon", "modules/bug1100/test.ceylon");
assertEquals("Compilation failed", Boolean.TRUE, ceylonTask.call());
}
Aggregations