use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.
the class CMRTests method testMdlByName.
//
// Modules
@Test
public void testMdlByName() throws IOException {
List<String> options = new LinkedList<String>();
options.add("-src");
options.add(getPackagePath() + "/modules/byName");
options.addAll(defaultOptions);
CeyloncTaskImpl task = getCompilerTask(options, null, Arrays.asList("default", "mod"));
Boolean ret = task.call();
assertTrue(ret);
File carFile = getModuleArchive("default", null);
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry moduleClass = car.getEntry("def/Foo.class");
assertNotNull(moduleClass);
ZipEntry moduleClassDir = car.getEntry("def/");
assertNotNull(moduleClassDir);
assertTrue(moduleClassDir.isDirectory());
car.close();
carFile = getModuleArchive("mod", "1");
assertTrue(carFile.exists());
car = new JarFile(carFile);
moduleClass = car.getEntry("mod/$module_.class");
assertNotNull(moduleClass);
moduleClassDir = car.getEntry("mod/");
assertNotNull(moduleClassDir);
assertTrue(moduleClassDir.isDirectory());
car.close();
}
use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.
the class CMRTests method testMdlAetherDependencyDefault.
@Test
public void testMdlAetherDependencyDefault() throws IOException {
// Try to compile the ceylon module
CeyloncTaskImpl ceylonTask = getCompilerTask(Arrays.asList("-out", destDir, "-rep", "aether", "-verbose:cmr"), (DiagnosticListener<? super FileObject>) null, "modules/aetherdefault/module.ceylon", "modules/aetherdefault/foo.ceylon");
assertEquals(Boolean.TRUE, ceylonTask.call());
// We're assuming a standard Maven configuration here!
File camelJar = new File(System.getProperty("user.home"), ".m2/repository/org/apache/camel/camel-core/2.9.2/camel-core-2.9.2.jar");
assertTrue(camelJar.exists());
}
use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.
the class CMRTests method testOverridesCeylonModuleShareImport.
@Test
public void testOverridesCeylonModuleShareImport() {
setupBinaryModulesForOverridesCeylonModuleTests();
ErrorCollector collector = new ErrorCollector();
CeyloncTaskImpl compilerTask = getCompilerTask(Arrays.asList("-src", getPackagePath() + "/modules", "-overrides", getPackagePath() + "modules/overridesCeylonModule/overrides-share-c-import.xml"), collector, "modules/overridesCeylonModule/module.ceylon");
ModulesRetriever modulesRetriever = new ModulesRetriever(compilerTask.getContext());
compilerTask.setTaskListener(modulesRetriever);
Boolean result = compilerTask.call();
Assert.assertEquals(Boolean.TRUE, result);
Module a = modulesRetriever.modules.get("a");
assert (a != null);
ModuleImport cImport = getModuleImport(a, "c");
assert (cImport != null);
assertEquals("The 'c' module import should be seen as 'exported' after applying the overrides file", true, cImport.isExport());
}
use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.
the class CMRTests method testMdlDependenciesFromMavenWithOverrides.
@Test
public void testMdlDependenciesFromMavenWithOverrides() 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", Arrays.asList("--overrides", getPackagePath() + "/modules/sparkframework/overrides-fix.xml"));
}
use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.
the class CMRTests method testOverridesCeylonModuleVersionAlterdPackageSharing.
@Test
public void testOverridesCeylonModuleVersionAlterdPackageSharing() {
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", "modules/overridesCeylonModule/testImportHiddenPackage.ceylon");
ModulesRetriever modulesRetriever = new ModulesRetriever(compilerTask.getContext());
compilerTask.setTaskListener(modulesRetriever);
Boolean result = compilerTask.call();
Assert.assertEquals(Boolean.FALSE, result);
compareErrors(collector.get(Diagnostic.Kind.ERROR), new CompilerError(2, "imported package is not shared: 'b.hidden'"));
}
Aggregations