Search in sources :

Example 46 with CeyloncTaskImpl

use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.

the class CMRTests method testMdlApacheSpark.

@Ignore("It takes ages to download about 200 jars")
@Test
public void testMdlApacheSpark() throws Throwable {
    // initially run both without offline, then it's much faster
    CeyloncTaskImpl ceylonTask = getCompilerTask(Arrays.asList("-out", destDir, "-offline"), "modules/apachespark/module.ceylon", "modules/apachespark/test.ceylon");
    assertEquals("Compilation failed", Boolean.TRUE, ceylonTask.call());
    runInJBossModules("run", "com.redhat.ceylon.compiler.java.test.cmr.modules.apachespark/1", Arrays.<String>asList("--flat-classpath", "--offline", "--maven-overrides", getPackagePath() + "/modules/apachespark/overrides.xml"));
}
Also used : CeyloncTaskImpl(com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 47 with CeyloncTaskImpl

use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.

the class CMRTests method testMdlAetherIgnoreRecursiveDependencies.

@Test
public void testMdlAetherIgnoreRecursiveDependencies() throws IOException {
    // Try to compile the ceylon module
    CeyloncTaskImpl ceylonTask = getCompilerTask(Arrays.asList("-out", destDir, "-rep", "aether", "-verbose:cmr"), (DiagnosticListener<? super FileObject>) null, "modules/aetherIgnoreDependencies/module.ceylon", "modules/aetherIgnoreDependencies/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.4/camel-core-2.9.4.jar");
    assertTrue(camelJar.exists());
    File camelJettyJar = new File(System.getProperty("user.home"), ".m2/repository/org/apache/camel/camel-jetty/2.9.4/camel-jetty-2.9.4.jar");
    assertTrue(camelJettyJar.exists());
}
Also used : CeyloncTaskImpl(com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl) JarFile(java.util.jar.JarFile) ZipFile(java.util.zip.ZipFile) File(java.io.File) Test(org.junit.Test)

Example 48 with CeyloncTaskImpl

use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.

the class CMRTests method testMdlDependenciesFromMavenFlatClasspath.

@Test
public void testMdlDependenciesFromMavenFlatClasspath() 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("--flat-classpath", "--overrides", getPackagePath() + "/modules/sparkframework/overrides-log.xml"));
}
Also used : CeyloncTaskImpl(com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl) Test(org.junit.Test)

Example 49 with CeyloncTaskImpl

use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.

the class CMRTests method testMdlAetherDependencyCustom.

@Test
public void testMdlAetherDependencyCustom() throws IOException {
    // Try to compile the ceylon module
    File settingsFile = new File(getPackagePath(), "modules/aethercustom/settings.xml");
    CeyloncTaskImpl ceylonTask = getCompilerTask(Arrays.asList("-out", destDir, "-rep", "aether:" + settingsFile.getAbsolutePath(), "-verbose:cmr"), (DiagnosticListener<? super FileObject>) null, "modules/aethercustom/module.ceylon", "modules/aethercustom/foo.ceylon");
    assertEquals(Boolean.TRUE, ceylonTask.call());
    File restletJar = new File("build/test-cars/cmr-repository", "org/restlet/org.restlet/1.1.10/org.restlet-1.1.10.jar");
    assertTrue(restletJar.exists());
}
Also used : CeyloncTaskImpl(com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl) JarFile(java.util.jar.JarFile) ZipFile(java.util.zip.ZipFile) File(java.io.File) Test(org.junit.Test)

Example 50 with CeyloncTaskImpl

use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.

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("com.redhat.ceylon.compiler.java.test.cmr.modules.java"));
    Boolean ret = task.call();
    assertTrue(ret);
}
Also used : CeyloncTaskImpl(com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Aggregations

CeyloncTaskImpl (com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl)53 Test (org.junit.Test)43 File (java.io.File)27 JarFile (java.util.jar.JarFile)19 ErrorCollector (com.redhat.ceylon.compiler.java.test.ErrorCollector)18 LinkedList (java.util.LinkedList)18 ZipEntry (java.util.zip.ZipEntry)13 CompilerError (com.redhat.ceylon.compiler.java.test.CompilerError)11 ZipFile (java.util.zip.ZipFile)8 ExitState (com.redhat.ceylon.compiler.java.launcher.Main.ExitState)6 CeyloncFileManager (com.redhat.ceylon.compiler.java.tools.CeyloncFileManager)5 CeyloncTool (com.redhat.ceylon.compiler.java.tools.CeyloncTool)5 ArrayList (java.util.ArrayList)5 TaskEvent (com.sun.source.util.TaskEvent)4 TaskListener (com.sun.source.util.TaskListener)4 Module (com.redhat.ceylon.model.typechecker.model.Module)3 JCCompilationUnit (com.sun.tools.javac.tree.JCTree.JCCompilationUnit)3 DiagnosticListener (javax.tools.DiagnosticListener)3 Ignore (org.junit.Ignore)3 JavaPositionsRetriever (com.redhat.ceylon.compiler.java.codegen.JavaPositionsRetriever)2