use of org.eclipse.ceylon.cmr.api.RepositoryManager in project ceylon by eclipse.
the class TestModelMethodsAndAttributes method initTypechecker.
public static void initTypechecker() {
if (model == null) {
final RepositoryManager repoman = CeylonUtils.repoManager().systemRepo("../dist/dist/repo").outRepo("test-modules").buildManager();
tc = new TypeCheckerBuilder().addSrcDirectory(new File("src/test/resources/modeltests")).setRepositoryManager(repoman).getTypeChecker();
tc.process();
}
}
use of org.eclipse.ceylon.cmr.api.RepositoryManager in project ceylon by eclipse.
the class TestSiteVariance method typeChecker.
private TypeChecker typeChecker(Options opts) {
final RepositoryManager repoman = CeylonUtils.repoManager().userRepos(opts.getRepos()).outRepo(opts.getOutRepo()).buildManager();
final TypeCheckerBuilder builder = new TypeCheckerBuilder().moduleManagerFactory(new JsModuleManagerFactory("UTF-8"));
for (File sd : opts.getSrcDirs()) {
builder.addSrcDirectory(sd);
}
builder.setRepositoryManager(repoman);
final TypeChecker tc = builder.getTypeChecker();
JsModuleManagerFactory.setVerbose(true);
tc.process();
return tc;
}
use of org.eclipse.ceylon.cmr.api.RepositoryManager in project ceylon by eclipse.
the class LanguageCompiler method initProcessAnnotations.
@Override
public void initProcessAnnotations(Iterable<? extends Processor> processors) {
java.util.List<String> aptModules = options.getMulti(Option.CEYLONAPT);
if (aptModules != null) {
CeyloncFileManager dfm = (CeyloncFileManager) fileManager;
RepositoryManager repositoryManager = dfm.getRepositoryManager();
final Set<ModuleSpec> visited = new HashSet<>();
StatusPrinterAptProgressListener progressListener = null;
if (sp != null) {
progressListener = new StatusPrinterAptProgressListener(sp) {
@Override
protected long getNumberOfModulesResolved() {
return visited.size();
}
};
sp.clearLine();
sp.log("Starting APT resolving");
}
for (String aptModule : aptModules) {
ModuleSpec moduleSpec = ModuleSpec.parse(aptModule);
addDependenciesToAptPath(repositoryManager, moduleSpec, visited, progressListener);
}
if (sp != null) {
sp.clearLine();
sp.log("Done APT resolving");
}
// we only run APT if asked explicitly with the --apt flag
super.initProcessAnnotations(processors);
}
// else don't do anything, which will leave the "processAnnotations" field to false
}
use of org.eclipse.ceylon.cmr.api.RepositoryManager in project ceylon by eclipse.
the class CMRTests method testMavenFileResolver.
@Test
public void testMavenFileResolver() throws ZipException, IOException {
CeylonRepoManagerBuilder builder = CeylonUtils.repoManager();
RepositoryManager repository = builder.buildManager();
String groupId = "javax.el";
String artifactId = "javax.el-api";
String version = "3.0.0";
String coord = groupId + ":" + artifactId;
File artifact = repository.getArtifact(MavenArtifactContext.NAMESPACE, coord, version);
Assert.assertNotNull(artifact);
try (ZipFile zf = new ZipFile(artifact)) {
String descriptorPath = String.format("META-INF/maven/%s/%s/pom.xml", groupId, artifactId);
ZipEntry entry = zf.getEntry(descriptorPath);
Assert.assertNotNull(entry);
try (InputStream is = zf.getInputStream(entry)) {
DependencyResolver resolver = new MavenDependencyResolver();
ModuleInfo info = resolver.resolveFromInputStream(is, coord, version, null);
Assert.assertNotNull(info);
// FIXME: find one with dependencies
System.err.println(info.getDependencies());
}
}
}
use of org.eclipse.ceylon.cmr.api.RepositoryManager in project ceylon by eclipse.
the class CallbackTestCase method doTest.
protected void doTest(ArtifactContext context, TestArtifactCallback callback) throws Exception {
String repoURL = "http://jboss-as7-modules-repository.googlecode.com/svn/trunk/ceylon";
try {
new URL(repoURL).openStream();
} catch (Exception e) {
log.error(String.format("Cannot connect to repo %s - %s", repoURL, e));
// probably not on the internet?
return;
}
RepositoryManagerBuilder builder = getRepositoryManagerBuilder(false, 60000, java.net.Proxy.NO_PROXY);
RemoteContentStore rcs = new RemoteContentStore(repoURL, log, false, 60000, java.net.Proxy.NO_PROXY);
CmrRepository repo = new DefaultRepository(rcs.createRoot());
RepositoryManager manager = builder.addRepository(repo).buildRepository();
try {
File file = manager.getArtifact(context);
Assert.assertNotNull(file);
Assert.assertTrue(callback.size > 0);
Assert.assertEquals(callback.size, callback.current);
} catch (Exception re) {
Assert.assertNotNull(callback.ts);
Assert.assertNotNull(callback.err);
Assert.assertEquals(callback.ts, callback.err.getMessage());
} finally {
manager.removeArtifact(null, name, version);
// test if remove really works
testSearchResults("org.eclipse.fizbiz", ModuleQuery.Type.JVM, new ModuleSearchResult.ModuleDetails[0]);
}
}
Aggregations