use of com.redhat.ceylon.cmr.api.ModuleSearchResult.ModuleDetails in project ceylon-compiler by ceylon.
the class CeylonInfoTool method run.
@Override
public void run() throws Exception {
if (showIncompatible != Incompatible.yes) {
binaryMajor = Versions.JVM_BINARY_MAJOR_VERSION;
binaryMinor = Versions.JVM_BINARY_MINOR_VERSION;
}
String msgkey = showIncompatible == Incompatible.no ? "module.not.found.compat" : "module.not.found";
for (ModuleSpec module : modules) {
String name = module.getName();
if (!module.isVersioned() && (name.startsWith("*") || name.endsWith("*"))) {
Collection<ModuleDetails> modules = getModules(getRepositoryManager(), name, queryType, binaryMajor, binaryMinor);
if (modules.isEmpty()) {
String err;
if (name.startsWith("*") || name.endsWith("*")) {
err = CeylonInfoMessages.msg("no.match", name);
} else {
err = getModuleNotFoundErrorMessage(getRepositoryManager(), module.getName(), module.getVersion(), msgkey);
}
errorAppend(err);
errorNewline();
continue;
}
outputModules(module, modules);
} else {
Collection<ModuleVersionDetails> versions = getModuleVersions(getRepositoryManager(), module.getName(), module.getVersion(), queryType, binaryMajor, binaryMinor);
if (versions.isEmpty()) {
// try from source
ModuleVersionDetails fromSource = getVersionFromSource(name);
if (fromSource != null) {
// is it the version we're after?
versions = Arrays.asList(fromSource);
} else {
if (showIncompatible == Incompatible.auto && (binaryMajor != null || binaryMinor != null)) {
// If we were called with a specific version and we didn't find a "compatible"
// artifact then lets see if we can find an "incompatible" one
versions = getModuleVersions(getRepositoryManager(), module.getName(), module.getVersion(), queryType, null, null);
}
if (versions.isEmpty()) {
String err = getModuleNotFoundErrorMessage(getRepositoryManager(), module.getName(), module.getVersion(), msgkey);
errorAppend(err);
errorNewline();
continue;
}
}
}
if (module.getVersion() == null || module.getVersion().isEmpty() || versions.size() > 1) {
outputVersions(module, versions);
} else {
outputDetails(module, versions.iterator().next());
}
}
}
}
Aggregations