use of org.eclipse.ceylon.cmr.api.ModuleVersionQuery in project ceylon by eclipse.
the class RepoUsingTool method findCompiledVersions.
private Collection<ModuleVersionDetails> findCompiledVersions(RepositoryManager repoMgr, String name, Type type, Integer jvmBinaryMajor, Integer jvmBinaryMinor, Integer jsBinaryMajor, Integer jsBinaryMinor) throws IOException {
String outRepo = DefaultToolOptions.getCompilerOutputRepo();
if (outRepo != null) {
File outDir = new File(outRepo);
CmrRepository rep = null;
List<CmrRepository> repositories = repoMgr.getRepositories();
for (CmrRepository repository : repositories) {
OpenNode root = repository.getRoot();
// it has binaries if it is not a folder
if (root.isRemote() || root.hasBinaries())
continue;
ContentStore service = root.getService(ContentStore.class);
if (service == null)
continue;
ContentHandle content = service.peekContent(root);
// again skip binaries
if (content == null || content.hasBinaries())
continue;
File repoFile = content.getContentAsFile();
if (repoFile != null && FileUtil.sameFile(repoFile, outDir)) {
rep = repository;
break;
}
}
if (rep != null && rep.isSearchable()) {
ModuleVersionQuery query = getModuleVersionQuery(null, name, null, type, jvmBinaryMajor, jvmBinaryMinor, jsBinaryMajor, jsBinaryMinor);
ModuleVersionResult result = new ModuleVersionResult(query.getName());
rep.completeVersions(query, result);
NavigableMap<String, ModuleVersionDetails> outRepoVersions = result.getVersions();
if (!outRepoVersions.isEmpty()) {
return outRepoVersions.values();
}
}
}
return null;
}
use of org.eclipse.ceylon.cmr.api.ModuleVersionQuery in project ceylon by eclipse.
the class RepoUsingTool method getModuleVersions.
protected Collection<ModuleVersionDetails> getModuleVersions(RepositoryManager repoMgr, String namespace, String name, String version, boolean exactVersionMatch, ModuleQuery.Type type, Integer jvmBinaryMajor, Integer jvmBinaryMinor, Integer jsBinaryMajor, Integer jsBinaryMinor) {
ModuleVersionQuery query = getModuleVersionQuery(namespace, name, version, type, jvmBinaryMajor, jvmBinaryMinor, jsBinaryMajor, jsBinaryMinor);
query.setExactVersionMatch(exactVersionMatch);
ModuleVersionResult result = repoMgr.completeVersions(query);
NavigableMap<String, ModuleVersionDetails> versionMap = result.getVersions();
return versionMap.values();
}
use of org.eclipse.ceylon.cmr.api.ModuleVersionQuery in project ceylon by eclipse.
the class CeylonInfoTool method getModuleVersionQuery.
@Override
protected ModuleVersionQuery getModuleVersionQuery(String namespace, String name, String version, ModuleQuery.Type type, Integer jvmBinaryMajor, Integer jvmBinaryMinor, Integer jsBinaryMajor, Integer jsBinaryMinor) {
ModuleVersionQuery query = super.getModuleVersionQuery(namespace, name, version, type, jvmBinaryMajor, jvmBinaryMinor, jsBinaryMajor, jsBinaryMinor);
if (findMember != null) {
query.setMemberName(findMember);
}
if (findPackage != null) {
query.setMemberName(findPackage);
query.setMemberSearchPackageOnly(true);
}
query.setMemberSearchExact(exactMatch);
if (requireAll) {
query.setRetrieval(ModuleQuery.Retrieval.ALL);
}
return query;
}
use of org.eclipse.ceylon.cmr.api.ModuleVersionQuery in project ceylon by eclipse.
the class LegacyImporter method findSuggestions.
private Set<ModuleDetails> findSuggestions(String pkg) {
Set<ModuleDetails> suggestions = new TreeSet<>();
ModuleVersionQuery query = new ModuleVersionQuery(null, "", null, ModuleQuery.Type.JVM);
query.setJvmBinaryMajor(Versions.JVM_BINARY_MAJOR_VERSION);
query.setJvmBinaryMinor(Versions.JVM_BINARY_MINOR_VERSION);
query.setMemberName(pkg);
query.setMemberSearchExact(true);
query.setMemberSearchPackageOnly(true);
ModuleSearchResult result = lookupRepoman.completeModules(query);
for (ModuleDetails mvd : result.getResults()) {
suggestions.add(mvd);
}
return suggestions;
}
use of org.eclipse.ceylon.cmr.api.ModuleVersionQuery in project ceylon by eclipse.
the class ModuleCopycat method getModuleVersions.
private Collection<ModuleVersionDetails> getModuleVersions(RepositoryManager repoMgr, String name, String version, ModuleQuery.Type type, Integer jvmBinaryMajor, Integer jvmBinaryMinor, Integer jsBinaryMajor, Integer jsBinaryMinor) {
ModuleVersionQuery query = new ModuleVersionQuery(null, name, version, type);
if (jvmBinaryMajor != null) {
query.setJvmBinaryMajor(jvmBinaryMajor);
}
if (jvmBinaryMinor != null) {
query.setJvmBinaryMinor(jvmBinaryMinor);
}
if (jsBinaryMajor != null) {
query.setJsBinaryMajor(jsBinaryMajor);
}
if (jsBinaryMinor != null) {
query.setJsBinaryMinor(jsBinaryMinor);
}
ModuleVersionResult result = repoMgr.completeVersions(query);
NavigableMap<String, ModuleVersionDetails> versionMap = result.getVersions();
return versionMap.values();
}
Aggregations