use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.
the class CMRTests method testMdlDependenciesFromMavenFail.
@Test(expected = AssertionError.class)
public void testMdlDependenciesFromMavenFail() throws Throwable {
Assume.assumeTrue("Runs on JDK8", JDKUtils.jdk == JDKUtils.JDK.JDK8);
CeyloncTaskImpl ceylonTask = getCompilerTask(Arrays.asList("-out", destDir), "modules/sparkframework/module.ceylon", "modules/sparkframework/test.ceylon");
assertEquals("Compilation failed", Boolean.TRUE, ceylonTask.call());
runInJBossModules("run", "com.redhat.ceylon.compiler.java.test.cmr.modules.sparkframework/1");
}
use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.
the class CMRTests method testMdlDependenciesOverrideRemoveDep.
@Test
public void testMdlDependenciesOverrideRemoveDep() throws IOException {
CeyloncTaskImpl ceylonTask = getCompilerTask(Arrays.asList("-out", destDir, "-overrides", getPackagePath() + "/modules/overrides/overridesRemoveJavaBase.xml"), "modules/overrides/module.ceylon", "modules/overrides/test.ceylon");
assertEquals("Compilation failed", Boolean.TRUE, ceylonTask.call());
}
use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.
the class CMRTests method testOverridesCeylonModuleVersionProducesJavaModule.
@Test
public void testOverridesCeylonModuleVersionProducesJavaModule() {
setupBinaryModulesForOverridesCeylonModuleTests();
ErrorCollector collector = new ErrorCollector();
CeyloncTaskImpl compilerTask = getCompilerTask(Arrays.asList("-src", getPackagePath() + "/modules", "-overrides", getPackagePath() + "modules/overridesCeylonModule/overrides-b-version.xml"), collector, "modules/overridesCeylonModule/module.ceylon");
ModulesRetriever modulesRetriever = new ModulesRetriever(compilerTask.getContext());
compilerTask.setTaskListener(modulesRetriever);
Boolean result = compilerTask.call();
Assert.assertEquals(Boolean.TRUE, result);
assert (modulesRetriever.modules != null);
Module b = modulesRetriever.modules.get("b");
assert (b != null);
assertEquals("The Ceylon module 'b' is now seen as a Java module when a version override is applied", false, b.isJava());
}
use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.
the class RecoveryTests method testMissingImport.
@Test
public void testMissingImport() throws IOException {
String subPath = "modules/missingImport";
String srcPath = getPackagePath() + subPath;
List<String> options = new LinkedList<String>();
options.add("-src");
options.add(srcPath);
options.addAll(defaultOptions);
options.add("-continue");
ErrorCollector c = new ErrorCollector();
CeyloncTaskImpl task = getCompilerTask(options, c, Arrays.asList("okmodule"), subPath + "/someok.ceylon");
Boolean ret = task.call();
assertFalse(ret);
TreeSet<CompilerError> actualErrors = c.get(Diagnostic.Kind.ERROR);
compareErrors(actualErrors, new CompilerError(21, "cannot find module artifact notfound-1(.car|.jar)\n \t- dependency tree: okmodule/1.0.0 -> notfound/1"));
File carFile = getModuleArchive("default", null);
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry moduleClass = car.getEntry("foobar_.class");
assertNotNull(moduleClass);
car.close();
carFile = getModuleArchive("okmodule", "1.0.0");
assertFalse(carFile.exists());
}
use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.
the class RecoveryTests method testErrorSameCompilationUnit.
@Test
public void testErrorSameCompilationUnit() throws IOException {
String subPath = "modules/errorInSameCompilationUnit";
String srcPath = getPackagePath() + subPath;
List<String> options = new LinkedList<String>();
options.add("-src");
options.add(srcPath);
options.addAll(defaultOptions);
options.add("-continue");
ErrorCollector c = new ErrorCollector();
CeyloncTaskImpl task = getCompilerTask(options, c, subPath + "/someok.ceylon");
Boolean ret = task.call();
assertFalse(ret);
TreeSet<CompilerError> actualErrors = c.get(Diagnostic.Kind.ERROR);
compareErrors(actualErrors, new CompilerError(23, "type does not exist: 'ERROR'"));
File carFile = getModuleArchive("default", null);
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry moduleClass = car.getEntry("a_.class");
assertNotNull(moduleClass);
car.close();
}
Aggregations