use of com.redhat.ceylon.compiler.java.test.ErrorCollector 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.test.ErrorCollector in project ceylon-compiler by ceylon.
the class CMRTests method testMdlOsgiManifestDisabled.
@Test
public void testMdlOsgiManifestDisabled() throws IOException {
ErrorCollector c = new ErrorCollector();
List<String> options = new ArrayList<String>(defaultOptions.size() + 1);
options.addAll(defaultOptions);
options.add("-noosgi");
assertCompilesOk(c, getCompilerTask(options, c, "modules/osgi/a/module.ceylon", "modules/osgi/a/package.ceylon", "modules/osgi/a/A.ceylon").call2());
final String moduleName = "com.redhat.ceylon.compiler.java.test.cmr.modules.osgi.a";
final String moduleVersion = "1.1.0";
File carFile = getModuleArchive(moduleName, moduleVersion);
JarFile car = new JarFile(carFile);
ZipEntry manifest = car.getEntry(OsgiManifest.MANIFEST_FILE_NAME);
assertNull(manifest);
car.close();
}
use of com.redhat.ceylon.compiler.java.test.ErrorCollector in project ceylon-compiler by ceylon.
the class CMRTests method testMdlCeylonAetherDuplicateImports.
@Test
public void testMdlCeylonAetherDuplicateImports() throws IOException {
// Try to compile the ceylon module
ErrorCollector collector = new ErrorCollector();
CeyloncTaskImpl ceylonTask = getCompilerTask(Arrays.asList("-out", destDir, "-verbose:cmr"), collector, "modules/ceylonAetherDuplicateImports/module.ceylon", "modules/ceylonAetherDuplicateImports/foo.ceylon");
assertEquals(Boolean.FALSE, ceylonTask.call());
compareErrors(collector.get(Diagnostic.Kind.ERROR), new CompilerError(23, "duplicate module import: 'org.apache.httpcomponents.httpclient'"), new CompilerError(25, "duplicate module import: 'org.apache.httpcomponents:httpclient'"));
}
use of com.redhat.ceylon.compiler.java.test.ErrorCollector in project ceylon-compiler by ceylon.
the class CMRTests method testMdlNoPomManifest.
@Test
public void testMdlNoPomManifest() throws IOException {
ErrorCollector c = new ErrorCollector();
assertCompilesOk(c, getCompilerTask(Arrays.asList("-nopom", "-out", destDir), c, "modules/pom/a/module.ceylon", "modules/pom/b/module.ceylon").call2());
final String moduleName = "com.redhat.ceylon.compiler.java.test.cmr.modules.pom.b";
final String moduleVersion = "1";
File carFile = getModuleArchive(moduleName, moduleVersion);
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry pomFile = car.getEntry("META-INF/maven/com.redhat.ceylon.compiler.java.test.cmr.modules.pom/b/pom.xml");
assertNull(pomFile);
ZipEntry propertiesFile = car.getEntry("META-INF/maven/com.redhat.ceylon.compiler.java.test.cmr.modules.pom/b/pom.properties");
assertNull(propertiesFile);
car.close();
}
use of com.redhat.ceylon.compiler.java.test.ErrorCollector in project ceylon-compiler by ceylon.
the class CMRTests method testMdlMultipleVersionsOnSameCompilation.
@Test
public void testMdlMultipleVersionsOnSameCompilation() {
// Compile module A/1
Boolean result = getCompilerTask(Arrays.asList("-src", getPackagePath() + "/modules/multiversion/a1"), "modules/multiversion/a1/a/module.ceylon", "modules/multiversion/a1/a/package.ceylon", "modules/multiversion/a1/a/A.ceylon").call();
Assert.assertEquals(Boolean.TRUE, result);
ErrorCollector collector = new ErrorCollector();
// Compile module A/2 with B importing A/1
result = getCompilerTask(Arrays.asList("-src", getPackagePath() + "/modules/multiversion/a2" + File.pathSeparator + getPackagePath() + "/modules/multiversion/b"), collector, "modules/multiversion/a2/a/module.ceylon", "modules/multiversion/a2/a/package.ceylon", "modules/multiversion/a2/a/A.ceylon", "modules/multiversion/b/b/module.ceylon", "modules/multiversion/b/b/B.ceylon").call();
Assert.assertEquals(Boolean.FALSE, result);
compareErrors(collector.get(Diagnostic.Kind.ERROR), new CompilerError(20, "source code imports two different versions of module 'a': version '1' and version '2'"));
}
Aggregations