use of org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon by eclipse.
the class CMRTests method testOverridesCeylonModuleInSourceImport.
@Test
public void testOverridesCeylonModuleInSourceImport() {
setupBinaryModulesForOverridesCeylonModuleTests();
ErrorCollector collector = new ErrorCollector();
CeyloncTaskImpl compilerTask = getCompilerTask(Arrays.asList("-continue", "-src", getPackagePath() + "/modules", "-overrides", getPackagePath() + "modules/overridesCeylonModule/overrides-a-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);
compareErrors(collector.get(Diagnostic.Kind.WARNING), new CompilerError(Kind.WARNING, null, 1, "all-lowercase ASCII module names are recommended"), new CompilerError(Kind.WARNING, null, 2, "project source module import is overridden in module overrides file: 'a/2' overrides 'a/1'"));
assert (modulesRetriever.modules != null);
Module a = modulesRetriever.modules.get("a");
Module b = modulesRetriever.modules.get("b");
Module c = modulesRetriever.modules.get("c");
assert (a != null);
assert (b != null);
assert (c != null);
assertEquals("The version override should not be applied to modules imported in source code", "2", a.getVersion());
assertEquals("The version override should not be applied to modules imported in source code", "2", b.getVersion());
assertEquals("The version override should not be applied to modules imported in source code", "2", c.getVersion());
}
use of org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon by eclipse.
the class CarGenerationTests method testCarResourceMultipleSub.
private long testCarResourceMultipleSub(boolean reverse) throws IOException {
List<String> options = new LinkedList<String>();
options.add("-src");
options.add(getPackagePath() + "resmodules/multiple/source");
if (reverse) {
options.add("-res");
options.add(getPackagePath() + "resmodules/multiple/resource2");
options.add("-res");
options.add(getPackagePath() + "resmodules/multiple/resource");
} else {
options.add("-res");
options.add(getPackagePath() + "resmodules/multiple/resource");
options.add("-res");
options.add(getPackagePath() + "resmodules/multiple/resource2");
}
options.addAll(defaultOptions);
CeyloncTaskImpl task = getCompilerTask(options, null, Arrays.asList("test.multiple"));
Boolean ret = task.call();
assertTrue(ret);
File carFile = getModuleArchive("test.multiple", "1.0");
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry moduleClass = car.getEntry("test/multiple/README.txt");
long result = moduleClass.getSize();
assertNotNull(moduleClass);
moduleClass = car.getEntry("test/multiple/README2.txt");
assertNotNull(moduleClass);
moduleClass = car.getEntry("test/multiple/$module_.class");
assertNotNull(moduleClass);
car.close();
return result;
}
use of org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon by eclipse.
the class CarGenerationTests method testCarWithServicesGreetRecompile.
/**
* Whole module recompilation
*/
@Test
public void testCarWithServicesGreetRecompile() throws IOException {
// first compile the old version
testCarWithServicesGreet();
// then recompile
ErrorCollector ec = new ErrorCollector();
List<String> options = new LinkedList<String>();
options.add("-src");
options.add(getPackagePath() + "services/greet2/source");
options.addAll(defaultOptions);
CeyloncTaskImpl task = getCompilerTask(options, ec, Arrays.asList("services"));
assertTrue(task.call());
File carFile = getModuleArchive("services", "1.0");
assertTrue(carFile.exists());
Map<String, Set<String>> services = MetaInfServices.parseAllServices(carFile);
Set<String> impls = services.get("services.Greeter");
assertNotNull(impls);
assertContains(impls, "services.HelloWorld");
assertContains(impls, "services.Gday");
assertContains(impls, "services.Bonjour");
assertEquals(3, impls.size());
assertEquals(1, services.size());
}
use of org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon by eclipse.
the class CarGenerationTests method testCarResourceRoot.
@Test
public void testCarResourceRoot() throws IOException {
List<String> options = new LinkedList<String>();
options.add("-src");
options.add(getPackagePath() + "resmodules/rootdir/source");
options.add("-res");
options.add(getPackagePath() + "resmodules/rootdir/resource");
options.addAll(defaultOptions);
CeyloncTaskImpl task = getCompilerTask(options, null, Arrays.asList("test.rootdir"));
Boolean ret = task.call();
assertTrue(ret);
File carFile = getModuleArchive("test.rootdir", "1.0");
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry carEntry = car.getEntry("test/rootdir/README.txt");
assertNotNull(carEntry);
carEntry = car.getEntry("rootfile");
assertNotNull(carEntry);
carEntry = car.getEntry("rootdir/rootsubdirfile");
assertNotNull(carEntry);
carEntry = car.getEntry("test/rootdir/$module_.class");
assertNotNull(carEntry);
car.close();
}
use of org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon by eclipse.
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", "org.eclipse.ceylon.compiler.java.test.cmr.modules.sparkframework/1");
}
Aggregations