Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace project APIs using antiquated Equinox resolver's VersionRange #1340

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion features/org.eclipse.pde-feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="org.eclipse.pde"
label="%featureName"
version="3.15.500.qualifier"
version="3.16.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.pde.doc.user/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.pde.doc.user; singleton:=true
Bundle-Version: 3.15.300.qualifier
Bundle-Version: 3.16.0.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.help;bundle-version="[3.2.0,4.0.0)"
2 changes: 1 addition & 1 deletion org.eclipse.pde.doc.user/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<version>4.33.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.pde.doc.user</artifactId>
<version>3.15.300-SNAPSHOT</version>
<version>3.16.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion ui/org.eclipse.pde.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %name
Bundle-SymbolicName: org.eclipse.pde.core; singleton:=true
Bundle-Version: 3.18.200.qualifier
Bundle-Version: 3.19.0.qualifier
Bundle-Activator: org.eclipse.pde.internal.core.PDECore
Bundle-Vendor: %provider-name
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010, 2020 IBM Corporation and others.
* Copyright (c) 2010, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -17,8 +17,8 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.ServiceCaller;
import org.eclipse.osgi.service.resolver.VersionRange;
import org.osgi.framework.Version;
import org.osgi.framework.VersionRange;

/**
* Service used to create and configure bundle project descriptions.
Expand Down Expand Up @@ -55,19 +55,39 @@ public interface IBundleProjectService {
* @param name symbolic name of the host
* @param range version constraint or <code>null</code>
* @return host description
* @since 3.19
*/
IHostDescription newHost(String name, VersionRange range);

/**
* @deprecated Instead use {@link #newHost(String, VersionRange)}
*/
@Deprecated(forRemoval = true, since = "4.19")
default IHostDescription newHost(String name, org.eclipse.osgi.service.resolver.VersionRange range) {
return newHost(name, (VersionRange) range);
}

/**
* Creates and returns a new package import description.
*
* @param name fully qualified name of imported package
* @param range version constraint or <code>null</code>
* @param optional whether the import is optional
* @return package import description
* @since 3.19
*/
IPackageImportDescription newPackageImport(String name, VersionRange range, boolean optional);

/**
* @deprecated Instead use
* {@link #newPackageImport(String, VersionRange, boolean)}
*/
@Deprecated(forRemoval = true, since = "4.19")
default IPackageImportDescription newPackageImport(String name,
org.eclipse.osgi.service.resolver.VersionRange range, boolean optional) {
return newPackageImport(name, (VersionRange) range, optional);
}

/**
* Constructs a new package export description.
*
Expand All @@ -88,9 +108,20 @@ public interface IBundleProjectService {
* @param optional whether the required bundle is optional
* @param export whether the required bundle is re-exported
* @return required bundle description
* @since 3.19
*/
IRequiredBundleDescription newRequiredBundle(String name, VersionRange range, boolean optional, boolean export);

/**
* @deprecated Instead use
* {@link #newRequiredBundle(String, VersionRange, boolean, boolean)}
*/
@Deprecated(forRemoval = true, since = "4.19")
default IRequiredBundleDescription newRequiredBundle(String name,
org.eclipse.osgi.service.resolver.VersionRange range, boolean optional, boolean export) {
return newRequiredBundle(name, (VersionRange) range, optional, export);
}

/**
* Creates and returns a new bundle classpath entry defining the relationship
* between a source, binaries, and library on the Bundle-Classpath header.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010 IBM Corporation and others.
* Copyright (c) 2010, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -13,7 +13,7 @@
*******************************************************************************/
package org.eclipse.pde.core.project;

import org.eclipse.osgi.service.resolver.VersionRange;
import org.osgi.framework.VersionRange;

/**
* Describes a fragment host. Instances of this class can be created
Expand All @@ -30,14 +30,22 @@ public interface IHostDescription {
*
* @return symbolic name of the host
*/
public String getName();
String getName();

/**
* Returns the version constraint of the host or <code>null</code>
* if unspecified.
*
* @return version constraint or <code>null</code>
* @since 3.19
*/
public VersionRange getVersionRange();
VersionRange getVersion();

/** @deprecated Instead use {@link #getVersion()} */
@Deprecated(forRemoval = true, since = "4.19")
default org.eclipse.osgi.service.resolver.VersionRange getVersionRange() {
VersionRange version = getVersion();
return version != null ? new org.eclipse.osgi.service.resolver.VersionRange(version.toString()) : null;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010 IBM Corporation and others.
* Copyright (c) 2010, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -13,7 +13,7 @@
*******************************************************************************/
package org.eclipse.pde.core.project;

import org.eclipse.osgi.service.resolver.VersionRange;
import org.osgi.framework.VersionRange;

/**
* Describes a package import. Instances of this class can be created
Expand All @@ -30,21 +30,29 @@ public interface IPackageImportDescription {
*
* @return fully qualified name of the imported package
*/
public String getName();
String getName();

/**
* Returns the version constraint of the imported package or <code>null</code>
* if unspecified.
*
* @return version constraint or <code>null</code>
* @since 3.19
*/
public VersionRange getVersionRange();
VersionRange getVersion();

/** @deprecated Instead use {@link #getVersion()} */
@Deprecated(forRemoval = true, since = "4.19")
default org.eclipse.osgi.service.resolver.VersionRange getVersionRange() {
VersionRange version = getVersion();
return version != null ? new org.eclipse.osgi.service.resolver.VersionRange(version.toString()) : null;
}

/**
* Returns whether the package import is optional.
*
* @return whether optional
*/
public boolean isOptional();
boolean isOptional();

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010 IBM Corporation and others.
* Copyright (c) 2010, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -13,7 +13,7 @@
*******************************************************************************/
package org.eclipse.pde.core.project;

import org.eclipse.osgi.service.resolver.VersionRange;
import org.osgi.framework.VersionRange;

/**
* Describes a required bundle. Instances of this class can be created
Expand All @@ -30,28 +30,36 @@ public interface IRequiredBundleDescription {
*
* @return symbolic name of the required bundle
*/
public String getName();
String getName();

/**
* Returns the version constraint of the required bundle or <code>null</code>
* if unspecified.
*
* @return version constraint or <code>null</code>
* @since 3.19
*/
public VersionRange getVersionRange();
VersionRange getVersion();

/** @deprecated Instead use {@link #getVersion()} */
@Deprecated(forRemoval = true, since = "4.19")
default org.eclipse.osgi.service.resolver.VersionRange getVersionRange() {
VersionRange version = getVersion();
return version != null ? new org.eclipse.osgi.service.resolver.VersionRange(version.toString()) : null;
}

/**
* Returns whether the required bundle is re-exported.
*
* @return whether re-exported
*/
public boolean isExported();
boolean isExported();

/**
* Returns whether the required bundle is optional.
*
* @return whether optional
*/
public boolean isOptional();
boolean isOptional();

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2013 IBM Corporation and others.
* Copyright (c) 2011, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -32,7 +32,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.service.resolver.VersionRange;
import org.eclipse.osgi.util.ManifestElement;
import org.eclipse.osgi.util.NLS;
import org.eclipse.pde.core.plugin.IPluginModelBase;
Expand All @@ -50,6 +49,7 @@
import org.eclipse.team.core.importing.provisional.IBundleImporter;
import org.osgi.framework.BundleException;
import org.osgi.framework.Version;
import org.osgi.framework.VersionRange;

/**
* Factory class for creating bundle project descriptions and associated artifacts.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010 IBM Corporation and others.
* Copyright (c) 2010, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -13,8 +13,8 @@
*******************************************************************************/
package org.eclipse.pde.internal.core.project;

import org.eclipse.osgi.service.resolver.VersionRange;
import org.eclipse.pde.core.project.IHostDescription;
import org.osgi.framework.VersionRange;

/**
* Describes a host
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010 IBM Corporation and others.
* Copyright (c) 2010, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -13,8 +13,8 @@
*******************************************************************************/
package org.eclipse.pde.internal.core.project;

import org.eclipse.osgi.service.resolver.VersionRange;
import org.eclipse.pde.core.project.IPackageImportDescription;
import org.osgi.framework.VersionRange;

/**
* Describes a package import
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010 IBM Corporation and others.
* Copyright (c) 2010, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -13,8 +13,8 @@
*******************************************************************************/
package org.eclipse.pde.internal.core.project;

import org.eclipse.osgi.service.resolver.VersionRange;
import org.eclipse.pde.core.project.IRequiredBundleDescription;
import org.osgi.framework.VersionRange;

/**
* Describes a required bundle.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010, 2017 IBM Corporation and others.
* Copyright (c) 2010, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -13,7 +13,9 @@
*******************************************************************************/
package org.eclipse.pde.internal.core.project;

import org.eclipse.osgi.service.resolver.VersionRange;
import java.util.Objects;

import org.osgi.framework.VersionRange;

/**
* Common implementation for a requirement specification - host, required bundle,
Expand All @@ -40,7 +42,7 @@ public String getName() {
return fName;
}

public VersionRange getVersionRange() {
public VersionRange getVersion() {
return fRange;
}

Expand All @@ -50,10 +52,9 @@ public boolean isExported() {

@Override
public boolean equals(Object obj) {
if (obj instanceof RequirementSpecification spec) {
return getName().equals(spec.getName()) && isExported() == spec.isExported() && isOptional() == spec.isOptional() && equalOrNull(getVersionRange(), spec.getVersionRange());
}
return false;
return obj instanceof RequirementSpecification spec //
&& getName().equals(spec.getName()) && isExported() == spec.isExported()
&& isOptional() == spec.isOptional() && Objects.equals(getVersion(), spec.getVersion());
}

@Override
Expand All @@ -71,13 +72,6 @@ public int hashCode() {
return code;
}

private boolean equalOrNull(Object o1, Object o2) {
if (o1 == null) {
return o2 == null;
}
return o1.equals(o2);
}

public boolean isOptional() {
return fOptional;
}
Expand Down
Loading