use of org.eclipse.ceylon.cmr.api.CmrRepository in project ceylon by eclipse.
the class RepoUsingTool method getModuleNotFoundErrorMessage.
protected String getModuleNotFoundErrorMessage(RepositoryManager repoMgr, String name, String version, String msgkeyNotFound) {
StringBuilder err = new StringBuilder();
String descr = version == null ? name : name + "/" + version;
err.append(Messages.msg(bundle, msgkeyNotFound, descr));
err.append("\n");
boolean fullySearchable = true;
for (CmrRepository repo : repoMgr.getRepositories()) {
if (version != null || repo.isSearchable()) {
err.append(" ");
err.append(repo.getDisplayString());
err.append("\n");
} else {
fullySearchable = false;
}
}
if (version == null && !fullySearchable) {
err.append(Messages.msg(bundle, "missing.version.suggestion"));
}
return err.toString();
}
use of org.eclipse.ceylon.cmr.api.CmrRepository 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.CmrRepository in project ceylon by eclipse.
the class ModuleLoaderTest method testNoDotsFromMavenWithOverrides.
@Test
public void testNoDotsFromMavenWithOverrides() throws ModuleNotFoundException {
CmrRepository repository = AetherRepository.createRepository(log, false, 60000);
Overrides ov = RepositoryManagerBuilder.parseOverrides(overrides);
Assert.assertTrue(ov.getAddedArtifacts().isEmpty());
RepositoryManager manager = new SimpleRepositoryManager(repository, log, ov);
Map<String, String> extraModules = new HashMap<>();
extraModules.put("org.antlr:stringtemplate", "3.2.1");
// this one has an override that adds aopalliance:aopalliance/1.0
extraModules.put("org.postgresql:postgresql", "9.4.1208");
TestableModuleLoader moduleLoader = new TestableModuleLoader(manager, null, extraModules, true);
moduleLoader.loadModule("com.google.inject:guice", "4.0", ModuleScope.RUNTIME);
// Check that we got them
Assert.assertEquals("2.7.7", moduleLoader.getModuleVersion("maven:antlr:antlr"));
Assert.assertEquals("1.0", moduleLoader.getModuleVersion("maven:aopalliance:aopalliance"));
}
use of org.eclipse.ceylon.cmr.api.CmrRepository in project ceylon by eclipse.
the class ModuleLoaderTest method testModuleLoader.
@Test
public void testModuleLoader() throws ModuleNotFoundException {
CmrRepository repository = AetherRepository.createRepository(log, false, 60000);
RepositoryManager manager = new SimpleRepositoryManager(repository, log);
Map<String, String> extraModules = new HashMap<>();
extraModules.put("org.springframework.boot:spring-boot-starter-web", "1.3.5.RELEASE");
extraModules.put("org.springframework.boot:spring-boot-starter-undertow", "1.3.5.RELEASE");
extraModules.put("org.springframework.boot:spring-boot-starter-data-jpa", "1.3.5.RELEASE");
extraModules.put("org.springframework.cloud:spring-cloud-starter-eureka", "1.1.2.RELEASE");
extraModules.put("org.postgresql:postgresql", "9.4.1208");
extraModules.put("org.liquibase:liquibase-core", "3.4.2");
TestableModuleLoader moduleLoader = new TestableModuleLoader(manager, null, extraModules, false);
moduleLoader.loadModule("org.liquibase:liquibase-core", "3.4.2", ModuleScope.RUNTIME);
// Check that we got the latest version
Assert.assertEquals("4.2.6.RELEASE", moduleLoader.getModuleVersion("org.springframework:spring-core"));
// Check that this one did not get removed
Assert.assertEquals("4.2.6.RELEASE", moduleLoader.getModuleVersion("org.springframework:spring-context"));
// Those two should not be there
Assert.assertNull(moduleLoader.getModuleVersion("javax.servlet:servlet-api"));
Assert.assertNull(moduleLoader.getModuleVersion("org.springframework:spring"));
// Check that we got the runtime dep
Assert.assertEquals("3.3.6.Final", moduleLoader.getModuleVersion("org.jboss.xnio:xnio-nio"));
moduleLoader.cleanup();
moduleLoader.loadModule("org.liquibase:liquibase-core", "3.4.2", ModuleScope.COMPILE);
// Check that we got the latest version
Assert.assertEquals("4.2.6.RELEASE", moduleLoader.getModuleVersion("org.springframework:spring-core"));
// Check that this one did not get removed
Assert.assertEquals("4.2.6.RELEASE", moduleLoader.getModuleVersion("org.springframework:spring-context"));
// Those two should not be there
Assert.assertNull(moduleLoader.getModuleVersion("javax.servlet:servlet-api"));
Assert.assertNull(moduleLoader.getModuleVersion("org.springframework:spring"));
// Check that we have no runtime dep
Assert.assertNull(moduleLoader.getModuleVersion("org.jboss.xnio:xnio-nio"));
}
use of org.eclipse.ceylon.cmr.api.CmrRepository in project ceylon by eclipse.
the class AbstractNodeRepositoryManager method fromRepositories.
/**
* Cache is only used for remote repos; see issue #47.
*/
private Node fromRepositories(Iterable<CmrRepository> repositories, ArtifactContext context, boolean addLeaf) {
log.debug("Looking for " + context);
for (CmrRepository repository : repositories) {
log.debug(" Looking in " + repository);
if (!repository.supportsNamespace(context.getNamespace())) {
log.debug(" -> does not support namespace " + context.getNamespace());
continue;
}
Node child = fromRepository(repository, context, addLeaf);
if (child != null) {
log.debug(" -> Found");
return child;
}
log.debug(" -> Not Found");
}
log.debug(" -> Artifact " + context + " not found in any repository");
return null;
}
Aggregations