Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.eclipse.pde.core.plugin.PluginRegistry;
import org.eclipse.pde.core.target.ITargetPlatformService;
import org.eclipse.pde.core.target.NameVersionDescriptor;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
import org.osgi.framework.namespace.HostNamespace;
Expand Down Expand Up @@ -187,8 +188,7 @@ public static Set<BundleDescription> findRequirementsClosure(Collection<BundleDe
if (wiring == null || !wiring.isInUse()) {
continue;
}

if (includeAllFragments || includeNonTestFragments) {
if (includeAllFragments || includeNonTestFragments || isExtensibleApi(bundle)) {
// A fragment's host is already required by a wire
for (BundleDescription fragment : bundle.getFragments()) {
if (includeAllFragments || !isTestWorkspaceProject(fragment)) {
Expand Down Expand Up @@ -229,6 +229,25 @@ public static Set<BundleDescription> findRequirementsClosure(Collection<BundleDe
return closure;
}

private static boolean isExtensibleApi(BundleDescription bundleDescription) {
if (bundleDescription.getFragments().length == 0) {
return false;
}
Object userObject = bundleDescription.getUserObject();
if (userObject instanceof IPluginModelBase model) {
return ClasspathUtilCore.hasExtensibleAPI(model);
}
IPluginModelBase model = PluginRegistry.findModel((Resource) bundleDescription);
if (model != null) {
return ClasspathUtilCore.hasExtensibleAPI(model);
}
Bundle bundle = bundleDescription.getBundle();
if (bundle != null) {
return Boolean.parseBoolean(bundle.getHeaders().get(ICoreConstants.EXTENSIBLE_API));
}
return false;
}

private static void addNewRequiredBundle(BundleDescription bundle, Set<BundleDescription> requiredBundles,
Queue<BundleDescription> pending) {
if (bundle != null && bundle.isResolved() && !bundle.isRemovalPending() && requiredBundles.add(bundle)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ private static void addPluginBundle(IPluginModelBase plugin, State launchState,
throw new IllegalStateException("Plugins have different TP state"); //$NON-NLS-1$
}
BundleDescription launchBundle = launchState.getFactory().createBundleDescription(bundle);
launchBundle.setUserObject(plugin);
if (!launchState.addBundle(launchBundle)) {
throw new IllegalStateException("Failed to add bundle to launch state: " + launchBundle); //$NON-NLS-1$
}
Expand Down
Loading