Search in sources :

Example 21 with ModuleSpec

use of org.eclipse.ceylon.common.ModuleSpec in project ceylon by eclipse.

the class CompatTests method compileAndRunDepends120With121.

@Test
public void compileAndRunDepends120With121() throws Throwable {
    ProcessBuilder pb = new ProcessBuilder(get121DistPath() + "/bin/ceylon", "compile", "--offline", "--rep", "test/src/org/eclipse/ceylon/compiler/java/test/compat/modules", "--src=test/src/org/eclipse/ceylon/compiler/java/test/compat/source", "depends120");
    assert (0 == pb.inheritIO().start().waitFor());
    // with the default upgrade dist behaviour
    runInJBossModules("run", "depends120", Arrays.asList("--rep", "modules", "--rep", "test/src/org/eclipse/ceylon/compiler/java/test/compat/modules"), Arrays.asList(Versions.CEYLON_VERSION_NUMBER), null, null);
    runInJBossModules("run", "depends120", Arrays.asList("--flat-classpath", "--rep", "modules", "--rep", "test/src/org/eclipse/ceylon/compiler/java/test/compat/modules"), Arrays.asList(Versions.CEYLON_VERSION_NUMBER), null, null);
    runInMainApi("test/src/org/eclipse/ceylon/compiler/java/test/compat/modules", new ModuleSpec(null, "depends120", "1.0.0"), "depends120.run_", Arrays.asList(Versions.CEYLON_VERSION_NUMBER), false);
}
Also used : ModuleSpec(org.eclipse.ceylon.common.ModuleSpec) Test(org.junit.Test)

Example 22 with ModuleSpec

use of org.eclipse.ceylon.common.ModuleSpec in project ceylon by eclipse.

the class CompatTests method runCompiled1299CarIn121MainApi.

// TODO FlatClasspath downgrade
@Ignore("Removed until we can create compiled modules with alternate versions")
@Test
public void runCompiled1299CarIn121MainApi() throws Throwable {
    File err = File.createTempFile("compattest", "out");
    try {
        mainApiClasspath("test/src/org/eclipse/ceylon/compiler/java/test/compat/modules", new ModuleSpec(null, "compiled1299", "1.0.0"), Collections.<ModuleSpec>emptyList(), 1, err, false);
        assertFileContainsLine(err, "Module org.eclipse.ceylon.typechecker/1.2.99 not found in the following repositories:");
    } finally {
        err.delete();
    }
}
Also used : ModuleSpec(org.eclipse.ceylon.common.ModuleSpec) File(java.io.File) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 23 with ModuleSpec

use of org.eclipse.ceylon.common.ModuleSpec in project ceylon by eclipse.

the class CompatTests method classpathCompiled1299With121NoDowngrade.

@Ignore("Removed until we can create compiled modules with alternate versions")
@Test
public void classpathCompiled1299With121NoDowngrade() throws Throwable {
    File err = File.createTempFile("compattest", "out");
    try {
        mainApiClasspath("test/src/org/eclipse/ceylon/compiler/java/test/compat/modules", new ModuleSpec(null, "compiled1299", "1.0.0"), Collections.<ModuleSpec>emptyList(), 1, err, false);
        assertFileContainsLine(err, "Module org.eclipse.ceylon.typechecker/1.2.99 not found in the following repositories:");
    } finally {
        err.delete();
    }
}
Also used : ModuleSpec(org.eclipse.ceylon.common.ModuleSpec) File(java.io.File) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 24 with ModuleSpec

use of org.eclipse.ceylon.common.ModuleSpec in project ceylon by eclipse.

the class RepoUsingTool method collectModule.

private void collectModule(File sourceRoot, File sourceFile, Map<String, ModuleSpec> modules) {
    File relativeFile = FileUtil.relativeFile(sourceRoot, sourceFile);
    String name = relativeFile.getPath().replace(File.separatorChar, '.');
    if (modules.containsKey(name))
        return;
    try {
        ModuleDescriptorReader mdr = new ModuleDescriptorReader(name, sourceRoot);
        String version = mdr.getModuleVersion();
        if (version != null) {
            modules.put(name, new ModuleSpec(null, name, version));
        }
    } catch (ModuleDescriptorReader.NoSuchModuleException x) {
        // skip this source folder and look in the next one
        x.printStackTrace();
    }
}
Also used : ModuleDescriptorReader(org.eclipse.ceylon.common.ModuleDescriptorReader) ModuleSpec(org.eclipse.ceylon.common.ModuleSpec) File(java.io.File)

Example 25 with ModuleSpec

use of org.eclipse.ceylon.common.ModuleSpec in project ceylon by eclipse.

the class RepoUsingTool method getSourceModules.

protected List<ModuleSpec> getSourceModules(List<File> srcDirs) {
    Map<String, ModuleSpec> modules = new HashMap<String, ModuleSpec>();
    for (File srcDir : srcDirs) {
        collectModules(srcDir, srcDir, modules);
    }
    ArrayList<ModuleSpec> ret = new ArrayList<ModuleSpec>(modules.size());
    ret.addAll(modules.values());
    return ret;
}
Also used : ModuleSpec(org.eclipse.ceylon.common.ModuleSpec) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) File(java.io.File)

Aggregations

ModuleSpec (org.eclipse.ceylon.common.ModuleSpec)35 File (java.io.File)18 ArtifactResult (org.eclipse.ceylon.model.cmr.ArtifactResult)13 ArrayList (java.util.ArrayList)11 ArtifactContext (org.eclipse.ceylon.cmr.api.ArtifactContext)7 IOException (java.io.IOException)6 Test (org.junit.Test)6 ZipFile (java.util.zip.ZipFile)5 ModuleGraph (org.eclipse.ceylon.cmr.ceylon.loader.ModuleGraph)5 HashSet (java.util.HashSet)4 LinkedList (java.util.LinkedList)4 ModuleVersionDetails (org.eclipse.ceylon.cmr.api.ModuleVersionDetails)4 ToolUsageError (org.eclipse.ceylon.common.tool.ToolUsageError)4 List (java.util.List)3 ZipEntry (java.util.zip.ZipEntry)3 RepositoryManager (org.eclipse.ceylon.cmr.api.RepositoryManager)3 Module (org.eclipse.ceylon.cmr.ceylon.loader.ModuleGraph.Module)3 Ignore (org.junit.Ignore)3 BufferedReader (java.io.BufferedReader)2 FileOutputStream (java.io.FileOutputStream)2