Search in sources :

Example 56 with CeyloncTaskImpl

use of org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon by eclipse.

the class CMRTests method testMdlEndsWithJava.

@Test
public void testMdlEndsWithJava() throws IOException {
    List<String> options = new LinkedList<String>();
    options.add("-src");
    options.add(dir);
    options.addAll(defaultOptions);
    CeyloncTaskImpl task = getCompilerTask(options, null, Arrays.asList("org.eclipse.ceylon.compiler.java.test.cmr.modules.java"));
    Boolean ret = task.call();
    assertTrue(ret);
}
Also used : CeyloncTaskImpl(org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Example 57 with CeyloncTaskImpl

use of org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon by eclipse.

the class CMRTests method testNamespaceImports.

@Test
public void testNamespaceImports() 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/namespaces/foo.ceylon");
    assertEquals(Boolean.TRUE, ceylonTask.call());
}
Also used : CeyloncTaskImpl(org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl) Test(org.junit.Test)

Example 58 with CeyloncTaskImpl

use of org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon by eclipse.

the class CMRTests method testMdlDependenciesNoOverride.

@Test
public void testMdlDependenciesNoOverride() throws IOException {
    CeyloncTaskImpl ceylonTask = getCompilerTask(Arrays.asList("-out", destDir), "modules/overrides/module.ceylon", "modules/overrides/test.ceylon");
    assertEquals("Compilation failed", Boolean.TRUE, ceylonTask.call());
}
Also used : CeyloncTaskImpl(org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl) Test(org.junit.Test)

Example 59 with CeyloncTaskImpl

use of org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon by eclipse.

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", "org.eclipse.ceylon.compiler.java.test.cmr.modules.sparkframework/1", Arrays.asList("--overrides", getPackagePath() + "/modules/sparkframework/overrides-fix.xml"));
}
Also used : CeyloncTaskImpl(org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl) Test(org.junit.Test)

Example 60 with CeyloncTaskImpl

use of org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon by eclipse.

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());
}
Also used : ZipEntry(java.util.zip.ZipEntry) ErrorCollector(org.eclipse.ceylon.compiler.java.test.ErrorCollector) CompilerError(org.eclipse.ceylon.compiler.java.test.CompilerError) CeyloncTaskImpl(org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl) JarFile(java.util.jar.JarFile) JarFile(java.util.jar.JarFile) File(java.io.File) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Aggregations

CeyloncTaskImpl (org.eclipse.ceylon.compiler.java.tools.CeyloncTaskImpl)62 Test (org.junit.Test)51 File (java.io.File)34 JarFile (java.util.jar.JarFile)26 LinkedList (java.util.LinkedList)23 ErrorCollector (org.eclipse.ceylon.compiler.java.test.ErrorCollector)23 ZipEntry (java.util.zip.ZipEntry)13 ZipFile (java.util.zip.ZipFile)13 CompilerError (org.eclipse.ceylon.compiler.java.test.CompilerError)12 ExitState (org.eclipse.ceylon.compiler.java.launcher.Main.ExitState)7 CeyloncTool (org.eclipse.ceylon.compiler.java.tools.CeyloncTool)6 ArrayList (java.util.ArrayList)5 CeyloncFileManager (org.eclipse.ceylon.compiler.java.tools.CeyloncFileManager)5 TaskEvent (org.eclipse.ceylon.langtools.source.util.TaskEvent)4 TaskListener (org.eclipse.ceylon.langtools.source.util.TaskListener)4 Set (java.util.Set)3 DiagnosticListener (org.eclipse.ceylon.javax.tools.DiagnosticListener)3 JCCompilationUnit (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCCompilationUnit)3 Module (org.eclipse.ceylon.model.typechecker.model.Module)3 Ignore (org.junit.Ignore)3