use of org.eclipse.ceylon.cmr.api.ModuleDependencyInfo in project ceylon by eclipse.
the class LegacyImporter method outputSuggestions.
private void outputSuggestions(String pkg) throws Exception {
ModuleDependencyInfo dep = null;
Set<ModuleDetails> suggestions = findSuggestions(pkg);
if (!suggestions.isEmpty()) {
dep = feedback.suggestions(pkg, suggestions);
if (dep != null) {
expectedDependencies.add(dep);
hasProblems = true;
}
}
}
use of org.eclipse.ceylon.cmr.api.ModuleDependencyInfo in project ceylon by eclipse.
the class AbstractCeylonArtifactResult method getOrderedDependencies.
/**
* {@code ModuleInfo} has dependencies as a {@code Set} (actually a
* {@code HashSet}), but {@link #dependencies()} needs to return a list.
* The order matter much except when several dependencies can't be found.
* That happens, in particular, when trying to run a module compiled with a
* more recent (but still BC) version of Ceylon. So for consistency
* on that case we will already return ceylon.language first.
*/
private List<ModuleDependencyInfo> getOrderedDependencies(ModuleInfo infos) {
List<ModuleDependencyInfo> dependencies = new ArrayList<ModuleDependencyInfo>(infos.getDependencies());
for (int index = 0; index < dependencies.size(); index++) {
ModuleDependencyInfo dep = dependencies.get(index);
if ("ceylon.language".equals(dep.getName())) {
if (index != 0) {
dependencies.remove(index);
dependencies.add(0, dep);
}
break;
}
}
return dependencies;
}
use of org.eclipse.ceylon.cmr.api.ModuleDependencyInfo in project ceylon by eclipse.
the class JSUtils method getModuleInfo.
private ModuleInfo getModuleInfo(Object obj, String moduleName, String version, Overrides overrides) {
if (obj == null) {
return new ModuleInfo(null, moduleName, version, null, null, null, null, Collections.<ModuleDependencyInfo>emptySet());
}
if (!(obj instanceof Iterable)) {
throw new RuntimeException("Expected something Iterable");
}
@SuppressWarnings("unchecked") Iterable<Object> array = (Iterable<Object>) obj;
Set<ModuleDependencyInfo> deps = new HashSet<ModuleDependencyInfo>();
for (Object o : array) {
String module;
boolean optional = false;
boolean exported = false;
if (o instanceof String) {
module = asString(o);
} else {
@SuppressWarnings("unchecked") Map<String, Object> m = (Map<String, Object>) o;
module = m.get("path").toString();
optional = m.containsKey("opt");
exported = m.containsKey("exp");
}
String depUri = ModuleUtil.moduleName(module);
String namespace = ModuleUtil.getNamespaceFromUri(depUri);
String modName = ModuleUtil.getModuleNameFromUri(depUri);
deps.add(new ModuleDependencyInfo(namespace, modName, ModuleUtil.moduleVersion(module), optional, exported, Backends.JS));
}
ModuleInfo result = new ModuleInfo(null, moduleName, version, null, null, null, null, deps);
if (overrides != null)
result = overrides.applyOverrides(moduleName, version, result);
return result;
}
use of org.eclipse.ceylon.cmr.api.ModuleDependencyInfo 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);
}
}
}
Aggregations