Search in sources :

Example 31 with ModuleVersionDetails

use of org.eclipse.ceylon.cmr.api.ModuleVersionDetails in project ceylon by eclipse.

the class CeylonInfoTool method outputVersions.

private void outputVersions(String namespace, String moduleName, Collection<ModuleVersionDetails> versions, String prefix) throws IOException {
    String namePrefix = (formatting == Formatting.fancy) ? prefix + "    " : "";
    for (ModuleVersionDetails version : versions) {
        if (formatting == Formatting.fancy || (!showDependencies && !showNames)) {
            append(prefix);
            if (formatting == Formatting.simple) {
                if (namespace != null) {
                    append(namespace).append(":");
                }
                append(moduleName).append("/");
            }
            append(version.getVersion());
            if (formatting == Formatting.fancy) {
                append(" - ").append(version.getOrigin());
                if (hasOnlyIncompatibleBinaries(version)) {
                    append(" ");
                    msg("label.incompatible.version");
                }
                if (version.isRemote()) {
                    append(" ");
                    msg("label.remote");
                }
            }
            newline();
        }
        if (showDependencies) {
            if (formatting == Formatting.fancy || !version.getDependencies().isEmpty()) {
                for (ModuleDependencyInfo dep : version.getDependencies()) {
                    if (dep.getModuleScope() == ModuleScope.TEST)
                        continue;
                    if (formatting == Formatting.fancy) {
                        append(prefix).append("    ").append(dep);
                    } else {
                        if (namespace != null) {
                            append(namespace).append(":");
                        }
                        append(moduleName).append("/").append(version.getVersion()).append(" ").append(dep.getModuleName());
                    }
                    newline();
                }
            } else {
                if (namespace != null) {
                    append(namespace).append(":");
                }
                append(moduleName).append("/").append(version.getVersion()).newline();
            }
        }
        if (showNames) {
            outputNames(namespace, moduleName, version, namePrefix);
        }
    }
}
Also used : ModuleVersionDetails(org.eclipse.ceylon.cmr.api.ModuleVersionDetails) ModuleDependencyInfo(org.eclipse.ceylon.cmr.api.ModuleDependencyInfo)

Example 32 with ModuleVersionDetails

use of org.eclipse.ceylon.cmr.api.ModuleVersionDetails in project ceylon by eclipse.

the class CeylonBrowseTool method run.

@Override
public void run() throws Exception {
    for (ModuleSpec module : modules) {
        List<ModuleVersionDetails> versions = new ArrayList<ModuleVersionDetails>(getModuleVersions(getRepositoryManager(), module.getNamespace(), module.getName(), module.getVersion(), false, ModuleQuery.Type.ALL, null, null, null, null));
        Collections.sort(versions);
        if (versions.isEmpty()) {
            String err = getModuleNotFoundErrorMessage(getRepositoryManager(), module.getName(), module.getVersion());
            errorAppend(err);
            errorNewline();
            continue;
        }
        ModuleVersionDetails mvd = versions.get(versions.size() - 1);
        browseDoc(mvd);
    }
}
Also used : ModuleSpec(org.eclipse.ceylon.common.ModuleSpec) ModuleVersionDetails(org.eclipse.ceylon.cmr.api.ModuleVersionDetails) ArrayList(java.util.ArrayList)

Aggregations

ModuleVersionDetails (org.eclipse.ceylon.cmr.api.ModuleVersionDetails)32 ModuleDependencyInfo (org.eclipse.ceylon.cmr.api.ModuleDependencyInfo)10 ModuleVersionArtifact (org.eclipse.ceylon.cmr.api.ModuleVersionArtifact)10 File (java.io.File)7 ArrayList (java.util.ArrayList)6 ModuleVersionQuery (org.eclipse.ceylon.cmr.api.ModuleVersionQuery)5 ModuleVersionResult (org.eclipse.ceylon.cmr.api.ModuleVersionResult)5 OpenNode (org.eclipse.ceylon.cmr.spi.OpenNode)5 ArtifactContext (org.eclipse.ceylon.cmr.api.ArtifactContext)4 Node (org.eclipse.ceylon.cmr.spi.Node)4 ModuleSpec (org.eclipse.ceylon.common.ModuleSpec)4 HashSet (java.util.HashSet)3 TreeSet (java.util.TreeSet)3 RepositoryManager (org.eclipse.ceylon.cmr.api.RepositoryManager)3 ToolUsageError (org.eclipse.ceylon.common.tool.ToolUsageError)3 ArtifactResult (org.eclipse.ceylon.model.cmr.ArtifactResult)3 List (java.util.List)2 Map (java.util.Map)2 CmrRepository (org.eclipse.ceylon.cmr.api.CmrRepository)2 ModuleInfo (org.eclipse.ceylon.cmr.api.ModuleInfo)2