diff options
author | toberlies | 2011-07-01 12:48:36 +0000 |
---|---|---|
committer | toberlies | 2011-07-01 12:48:36 +0000 |
commit | 21aef5cd787b0b0408b13fcfb0efa7cff0a46c5d (patch) | |
tree | 1f155ed512926b584093cf11543beba2d698aae3 /bundles/org.eclipse.equinox.p2.publisher.eclipse | |
parent | 78cd67c5a57394a96d55d0e77ef7b236796675b7 (diff) | |
download | rt.equinox.p2-21aef5cd787b0b0408b13fcfb0efa7cff0a46c5d.tar.gz rt.equinox.p2-21aef5cd787b0b0408b13fcfb0efa7cff0a46c5d.tar.xz rt.equinox.p2-21aef5cd787b0b0408b13fcfb0efa7cff0a46c5d.zip |
247099 Ability to disable greedy behavior of optional dependencies
Translate optional manifest imports/requires to optional non-greedy requirements
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.publisher.eclipse')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java index 9d5a40ef8..aa7d3895b 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java @@ -158,8 +158,11 @@ public class BundlesAction extends AbstractPublisherAction { // reqsDeps.add(MetadataFactory.createRequiredCapability(CAPABILITY_TYPE_OSGI_FRAGMENTS, bd.getSymbolicName(), VersionRange.emptyRange, null, false, false)); if (isFragment) reqsDeps.add(MetadataFactory.createRequirement(CAPABILITY_NS_OSGI_BUNDLE, bd.getHost().getName(), PublisherHelper.fromOSGiVersionRange(bd.getHost().getVersionRange()), null, false, false)); - for (int j = 0; j < requiredBundles.length; j++) - reqsDeps.add(MetadataFactory.createRequirement(CAPABILITY_NS_OSGI_BUNDLE, requiredBundles[j].getName(), PublisherHelper.fromOSGiVersionRange(requiredBundles[j].getVersionRange()), null, requiredBundles[j].isOptional(), false)); + for (BundleSpecification requiredBundle : requiredBundles) { + boolean optional = requiredBundle.isOptional(); + boolean greedy = !optional; + reqsDeps.add(MetadataFactory.createRequirement(CAPABILITY_NS_OSGI_BUNDLE, requiredBundle.getName(), PublisherHelper.fromOSGiVersionRange(requiredBundle.getVersionRange()), null, optional ? 0 : 1, 1, greedy)); + } // Process the import packages ImportPackageSpecification osgiImports[] = bd.getImportPackages(); @@ -169,8 +172,10 @@ public class BundlesAction extends AbstractPublisherAction { if (isDynamicImport(importSpec)) continue; VersionRange versionRange = PublisherHelper.fromOSGiVersionRange(importSpec.getVersionRange()); + boolean optional = isOptional(importSpec); + boolean greedy = !optional; //TODO this needs to be refined to take into account all the attribute handled by imports - reqsDeps.add(MetadataFactory.createRequirement(PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE, importSpec.getName(), versionRange, null, isOptional(importSpec), false)); + reqsDeps.add(MetadataFactory.createRequirement(PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE, importSpec.getName(), versionRange, null, optional ? 0 : 1, 1, greedy)); } iu.setRequirements(reqsDeps.toArray(new IRequirement[reqsDeps.size()])); |