use of aQute.bnd.service.RepositoryPlugin in project bnd by bndtools.
the class Project method releaseURI.
public URI releaseURI(String name, String jarName, InputStream jarStream) throws Exception {
List<RepositoryPlugin> releaseRepos = getReleaseRepos(name);
if (releaseRepos.isEmpty()) {
return null;
}
// use only first
RepositoryPlugin releaseRepo = releaseRepos.get(0);
// release repo
return releaseRepo(releaseRepo, jarName, jarStream);
}
use of aQute.bnd.service.RepositoryPlugin in project bndtools by bndtools.
the class AvailableBundlesPart method getRepositories.
@Override
public List<RepositoryPlugin> getRepositories() {
List<String> tmp = model.getRunRepos();
includedRepos = (tmp == null) ? null : new HashSet<String>(tmp);
Workspace workspace = model.getWorkspace();
List<RepositoryPlugin> repos;
try {
repos = RepositoryUtils.listRepositories(workspace, true);
} catch (Exception e) {
repos = Collections.emptyList();
}
return repos;
}
use of aQute.bnd.service.RepositoryPlugin in project bndtools by bndtools.
the class BndContainerSourceManager method getSourceBundle.
private static File getSourceBundle(IPath path, Map<String, String> props) {
Workspace bndWorkspace;
try {
bndWorkspace = Central.getWorkspace();
if (bndWorkspace == null) {
return null;
}
} catch (final Exception e) {
return null;
}
IPath bundlePath = path;
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IResource resource = root.findMember(path);
if (resource != null) {
bundlePath = resource.getLocation();
}
try (JarInputStream jarStream = new JarInputStream(IO.stream(bundlePath.toFile()), false)) {
Manifest manifest = jarStream.getManifest();
if (manifest == null) {
return null;
}
Domain domain = Domain.domain(manifest);
Entry<String, Attrs> bsnAttrs = domain.getBundleSymbolicName();
if (bsnAttrs == null) {
return null;
}
String bsn = bsnAttrs.getKey();
String version = domain.getBundleVersion();
if (version == null) {
version = props.get("version");
}
for (RepositoryPlugin repo : RepositoryUtils.listRepositories(true)) {
if (repo == null) {
continue;
}
if (repo instanceof WorkspaceRepository) {
continue;
}
File sourceBundle = repo.get(bsn + ".source", new Version(version), props);
if (sourceBundle != null) {
return sourceBundle;
}
}
} catch (final Exception e) {
// Ignore, something went wrong, or we could not find the source bundle
}
return null;
}
use of aQute.bnd.service.RepositoryPlugin in project bndtools by bndtools.
the class WorkspaceReleaseJob method run.
@Override
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask(Messages.releasingProjects, projectDiffs.size());
for (ProjectDiff projectDiff : projectDiffs) {
if (projectDiff.isRelease()) {
RepositoryPlugin release = null;
if (projectDiff.getReleaseRepository() != null) {
release = Activator.getRepositoryPlugin(projectDiff.getReleaseRepository());
}
ReleaseContext context = new ReleaseContext(projectDiff.getProject(), projectDiff.getBaselines(), release, releaseOption);
ReleaseJob job = new ReleaseJob(context, showMessage);
job.setRule(ResourcesPlugin.getWorkspace().getRoot());
job.run(new SubProgressMonitor(monitor, 1));
}
monitor.worked(1);
}
monitor.done();
return Status.OK_STATUS;
}
use of aQute.bnd.service.RepositoryPlugin in project bndtools by bndtools.
the class ReleaseHelper method getReleaseRepositories.
public static String[] getReleaseRepositories() {
List<RepositoryPlugin> repos = Activator.getRepositories();
List<String> ret = new ArrayList<String>();
for (RepositoryPlugin repo : repos) {
if (repo.canWrite()) {
if (repo.getName() != null) {
ret.add(repo.getName());
} else {
ret.add(repo.toString());
}
}
}
return ret.toArray(new String[0]);
}
Aggregations