use of org.eclipse.osgi.service.resolver.VersionConstraint in project rt.equinox.framework by eclipse.
the class ResolverBundle method hasUnresolvedConstraint.
private boolean hasUnresolvedConstraint(ResolverConstraint reason, ResolverBundle detachedFragment, ResolverBundle remainingFragment, ResolverImport[] oldImports, BundleConstraint[] oldRequires, List<ResolverImport> additionalImports, List<BundleConstraint> additionalRequires) {
ImportPackageSpecification[] remainingFragImports = remainingFragment.getBundleDescription().getImportPackages();
BundleSpecification[] remainingFragRequires = remainingFragment.getBundleDescription().getRequiredBundles();
VersionConstraint[] constraints;
if (reason instanceof ResolverImport)
constraints = remainingFragImports;
else
constraints = remainingFragRequires;
for (int i = 0; i < constraints.length; i++) if (reason.getName().equals(constraints[i].getName())) {
detachFragment(remainingFragment, reason);
return true;
}
for (int i = 0; i < oldImports.length; i++) {
if (oldImports[i].getVersionConstraint().getBundle() != detachedFragment.getBundleDescription())
// the constraint is not from the detached fragment
continue;
for (int j = 0; j < remainingFragImports.length; j++) {
if (oldImports[i].getName().equals(remainingFragImports[j].getName())) {
// same constraint, must reuse the constraint object but swap out the fragment info
additionalImports.add(oldImports[i]);
oldImports[i].setVersionConstraint(remainingFragImports[j]);
break;
}
}
}
for (int i = 0; i < oldRequires.length; i++) {
if (oldRequires[i].getVersionConstraint().getBundle() != detachedFragment.getBundleDescription())
// the constraint is not from the detached fragment
continue;
for (int j = 0; j < remainingFragRequires.length; j++) {
if (oldRequires[i].getName().equals(remainingFragRequires[j].getName())) {
// same constraint, must reuse the constraint object but swap out the fragment info
additionalRequires.add(oldRequires[i]);
oldRequires[i].setVersionConstraint(remainingFragRequires[j]);
break;
}
}
}
return false;
}
use of org.eclipse.osgi.service.resolver.VersionConstraint in project tycho by eclipse.
the class Activator method getRelevantErrors.
private static void getRelevantErrors(State state, Set<ResolverError> errors, BundleDescription bundle) {
ResolverError[] bundleErrors = state.getResolverErrors(bundle);
for (int j = 0; j < bundleErrors.length; j++) {
ResolverError error = bundleErrors[j];
errors.add(error);
VersionConstraint constraint = error.getUnsatisfiedConstraint();
if (constraint instanceof BundleSpecification || constraint instanceof HostSpecification) {
BundleDescription[] requiredBundles = state.getBundles(constraint.getName());
for (int i = 0; i < requiredBundles.length; i++) {
getRelevantErrors(state, errors, requiredBundles[i]);
}
}
}
}
use of org.eclipse.osgi.service.resolver.VersionConstraint in project tycho by eclipse.
the class EquinoxResolver method getRelevantErrors.
private void getRelevantErrors(State state, Set<ResolverError> errors, BundleDescription bundle) {
ResolverError[] bundleErrors = state.getResolverErrors(bundle);
for (int j = 0; j < bundleErrors.length; j++) {
ResolverError error = bundleErrors[j];
errors.add(error);
VersionConstraint constraint = error.getUnsatisfiedConstraint();
if (constraint instanceof BundleSpecification || constraint instanceof HostSpecification) {
BundleDescription[] requiredBundles = state.getBundles(constraint.getName());
for (int i = 0; i < requiredBundles.length; i++) {
// do not handle that bundle (again). See bug 442594.
if (bundle.equals(requiredBundles[i])) {
continue;
}
getRelevantErrors(state, errors, requiredBundles[i]);
}
}
}
}
Aggregations