Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodor Boev2017-12-11 12:40:13 +0000
committerTodor Boev2017-12-13 13:21:54 +0000
commit72c083ed10a1cca83f00befbefc279af09779df0 (patch)
tree48b1c542a8d9e39dd85c85674f0c829bef42d993 /bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox
parentcf04c14fb70f9579577a5dcd3df5a71366cbeb97 (diff)
downloadrt.equinox.p2-72c083ed10a1cca83f00befbefc279af09779df0.tar.gz
rt.equinox.p2-72c083ed10a1cca83f00befbefc279af09779df0.tar.xz
rt.equinox.p2-72c083ed10a1cca83f00befbefc279af09779df0.zip
Bug 528494 - Using the match operator for RequiredCapabilityI20171214-2000
- Fixed the BundlesAction conversion of open ended OSGi version ranges to agree with the P2 open ended version ranges. - Fixed the publisher tests to rely less on IRequiredCapability Change-Id: Iaf1232bfe361ed4d6bb448cc0b210ddfe120569b Signed-off-by: Todor Boev <rinsvind@gmail.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox')
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java31
1 files changed, 22 insertions, 9 deletions
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java
index 7e462e735..8fc15de68 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Genuitec, LLC - added license support
@@ -46,14 +46,14 @@ public class PublisherHelper {
public static final String NAMESPACE_FLAVOR = "org.eclipse.equinox.p2.flavor"; //$NON-NLS-1$"
/**
- * A capability name in the {@link #NAMESPACE_ECLIPSE_TYPE} namespace
+ * A capability name in the {@link #NAMESPACE_ECLIPSE_TYPE} namespace
* representing a feature
* @see IProvidedCapability#getName()
*/
public static final String TYPE_ECLIPSE_FEATURE = "feature"; //$NON-NLS-1$
/**
- * A capability name in the {@link #NAMESPACE_ECLIPSE_TYPE} namespace
+ * A capability name in the {@link #NAMESPACE_ECLIPSE_TYPE} namespace
* representing a source bundle
* @see IProvidedCapability#getName()
*/
@@ -214,22 +214,35 @@ public class PublisherHelper {
* @return The created omni version
*/
public static Version fromOSGiVersion(org.osgi.framework.Version version) {
- if (version == null)
- return null;
- if (version.getMajor() == Integer.MAX_VALUE && version.getMicro() == Integer.MAX_VALUE && version.getMicro() == Integer.MAX_VALUE)
+ if (version == null) {
return Version.MAX_VERSION;
+ }
+ if (version.getMajor() == Integer.MAX_VALUE && version.getMicro() == Integer.MAX_VALUE && version.getMicro() == Integer.MAX_VALUE) {
+ return Version.MAX_VERSION;
+ }
return Version.createOSGi(version.getMajor(), version.getMinor(), version.getMicro(), version.getQualifier());
}
public static org.eclipse.osgi.service.resolver.VersionRange toOSGiVersionRange(VersionRange range) {
- if (range.equals(VersionRange.emptyRange))
+ if (range.equals(VersionRange.emptyRange)) {
return org.eclipse.osgi.service.resolver.VersionRange.emptyRange;
+ }
return new org.eclipse.osgi.service.resolver.VersionRange(toOSGiVersion(range.getMinimum()), range.getIncludeMinimum(), toOSGiVersion(range.getMaximum()), range.getIncludeMinimum());
}
public static VersionRange fromOSGiVersionRange(org.eclipse.osgi.service.resolver.VersionRange range) {
- if (range.equals(org.eclipse.osgi.service.resolver.VersionRange.emptyRange))
+ if (range.equals(org.eclipse.osgi.service.resolver.VersionRange.emptyRange)) {
return VersionRange.emptyRange;
- return new VersionRange(fromOSGiVersion(range.getMinimum()), range.getIncludeMinimum(), fromOSGiVersion(range.getMaximum()), range.getIncludeMaximum());
+ }
+
+ Version min = fromOSGiVersion(range.getLeft());
+ boolean includeMin = range.getIncludeMinimum();
+
+ Version max = fromOSGiVersion(range.getRight());
+ // TODO The OSGi open ended range does not include the max value, where as the p2 does
+ // Fix the p2 range to not include maximum as well (how will this affect the projector)?.
+ boolean includeMax = Version.MAX_VERSION.equals(max) ? true : range.getIncludeMaximum();
+
+ return new VersionRange(min, includeMin, max, includeMax);
}
}

Back to the top