From 4aaf5f818bd6a3f2744411d85d494aa95d44c257 Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Sat, 7 Oct 2023 16:58:04 +0200 Subject: [PATCH] Remove processing of unused plugin element attributes in feature.xml Relates to https://github.com/eclipse-pde/eclipse.pde/issues/730 --- .../metadata/repository/io/XMLConstants.java | 1 - .../eclipse/FeatureManifestParser.java | 9 ------- .../p2/publisher/eclipse/ProductFile.java | 2 -- .../p2/publisher/eclipse/FeatureEntry.java | 24 ------------------- .../p2/publisher/eclipse/FeaturesAction.java | 16 ------------- .../repository/comparator/JarComparator.java | 3 --- .../repository/comparator/java/Messages.java | 1 - .../comparator/java/messages.properties | 1 - .../p2/updatesite/RemoteFeaturesAction.java | 3 ++- 9 files changed, 2 insertions(+), 58 deletions(-) diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/XMLConstants.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/XMLConstants.java index 0e9464b35b..fc3424f7d0 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/XMLConstants.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/XMLConstants.java @@ -59,7 +59,6 @@ public interface XMLConstants extends org.eclipse.equinox.internal.p2.persistenc // Constants for attributes of an installable unit element public static final String SINGLETON_ATTRIBUTE = "singleton"; //$NON-NLS-1$ - public static final String FRAGMENT_ATTRIBUTE = "fragment"; //$NON-NLS-1$ public static final String[] REQUIRED_IU_ATTRIBUTES = new String[] {ID_ATTRIBUTE, VERSION_ATTRIBUTE}; public static final String[] OPTIONAL_IU_ATTRIBUTES = new String[] {SINGLETON_ATTRIBUTE}; public static final String GENERATION_ATTRIBUTE = "generation"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureManifestParser.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureManifestParser.java index c773d02990..eac5c10e1e 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureManifestParser.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureManifestParser.java @@ -220,9 +220,6 @@ private void processImport(Attributes attributes) { private void processIncludes(Attributes attributes) { FeatureEntry entry = new FeatureEntry(attributes.getValue("id"), attributes.getValue("version"), false); //$NON-NLS-1$ //$NON-NLS-2$ - String unpack = attributes.getValue("unpack"); //$NON-NLS-1$ - if (unpack != null) - entry.setUnpack(Boolean.parseBoolean(unpack)); String optional = attributes.getValue("optional"); //$NON-NLS-1$ if (optional != null) entry.setOptional(Boolean.parseBoolean(optional)); @@ -253,12 +250,6 @@ private void processPlugin(Attributes attributes) { } else { FeatureEntry plugin = new FeatureEntry(id, version, true); setEnvironment(attributes, plugin); - String unpack = attributes.getValue("unpack"); //$NON-NLS-1$ - if (unpack != null) - plugin.setUnpack(Boolean.parseBoolean(unpack)); - String fragment = attributes.getValue("fragment"); //$NON-NLS-1$ - if (fragment != null) - plugin.setFragment(Boolean.parseBoolean(fragment)); String filter = attributes.getValue("filter"); //$NON-NLS-1$ if (filter != null) plugin.setFilter(filter); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java index 3732030dbc..d79cef7999 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java @@ -1235,12 +1235,10 @@ private void addLaunchArgumentToMap(String key, String value) { } protected void processPlugin(Attributes attributes) { - String fragment = attributes.getValue(ATTRIBUTE_FRAGMENT); String pluginId = attributes.getValue(ATTRIBUTE_ID); String pluginVersion = attributes.getValue(ATTRIBUTE_VERSION); FeatureEntry entry = new FeatureEntry(pluginId, pluginVersion != null ? pluginVersion : GENERIC_VERSION_NUMBER, true); - entry.setFragment(Boolean.parseBoolean(fragment)); plugins.add(entry); } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeatureEntry.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeatureEntry.java index d69db4b8ae..21de837c90 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeatureEntry.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeatureEntry.java @@ -29,9 +29,7 @@ public class FeatureEntry implements IPlatformEntry { private String nl; private String match; private final boolean isPlugin; - private boolean isFragment = false; private boolean isRequires = false; - private Boolean unpack = null; private boolean optional = false; private boolean isPatch = false; /** @@ -44,7 +42,6 @@ public static FeatureEntry createRequires(String id, String version, String matc result.match = match; result.isRequires = true; // for requires we don't care what the form is so leave it as false (JAR'd) - result.unpack = false; if (filter != null) result.setFilter(filter); return result; @@ -55,7 +52,6 @@ public static FeatureEntry createRequires(String id, VersionRange versionRange, result.match = match; result.isRequires = true; // for requires we don't care what the form is so leave it as false (JAR'd) - result.unpack = false; if (filter != null) result.setFilter(filter); return result; @@ -152,10 +148,6 @@ public int hashCode() { return result; } - public boolean isFragment() { - return isFragment; - } - public boolean isOptional() { return optional; } @@ -168,10 +160,6 @@ public boolean isRequires() { return isRequires; } - public boolean isUnpack() { - return (unpack == null || unpack.booleanValue()); - } - public void setEnvironment(String os, String ws, String arch, String nl) { this.os = os; this.ws = ws; @@ -187,18 +175,10 @@ public void setFilter(String filter) { } - public void setFragment(boolean value) { - isFragment = value; - } - public void setOptional(boolean value) { optional = value; } - public void setUnpack(boolean value) { - unpack = Boolean.valueOf(value); - } - public void setURL(String value) { url = value; } @@ -217,10 +197,6 @@ public String toString() { return result.toString(); } - public boolean unpackSet() { - return unpack != null; - } - public boolean isPatch() { return isPatch; } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java index f9f085020d..b1ea19e34f 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java @@ -175,21 +175,6 @@ private void createAdviceFileAdvice(Feature feature, IPublisherInfo publisherInf } } - /** - * Gather any advice we can from the given feature. In particular, it may have - * information about the shape of the bundles it includes. The discovered advice is - * added to the given result. - * @param feature the feature to process - * @param publisherInfo the publishing info to update - */ - private void createBundleShapeAdvice(Feature feature, IPublisherInfo publisherInfo) { - FeatureEntry entries[] = feature.getEntries(); - for (FeatureEntry entry : entries) { - if (entry.isUnpack() && entry.isPlugin() && !entry.isRequires()) - publisherInfo.addAdvice(new BundleShapeAdvice(entry.getId(), Version.parseVersion(entry.getVersion()), IBundleShapeAdvice.DIR)); - } - } - protected IInstallableUnit createFeatureRootFileIU(String featureId, String featureVersion, File location, FileSetDescriptor descriptor) { InstallableUnitDescription iu = new MetadataFactory.InstallableUnitDescription(); iu.setSingleton(true); @@ -404,7 +389,6 @@ protected void generateFeatureIUs(Feature[] featureList, IPublisherResult result // Build Feature IUs, and add them to any corresponding categories for (Feature feature : featureList) { //first gather any advice that might help us - createBundleShapeAdvice(feature, info); createAdviceFileAdvice(feature, info); ArrayList childIUs = new ArrayList<>(); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java index dab298fb76..e5ff97b033 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java @@ -162,9 +162,6 @@ public IStatus compareFeatures(File sourceFile, File destinationFile) { if (firstEntry.isOptional() != entries21.isOptional()) { parent.add(newErrorStatus(NLS.bind(Messages.featureEntryOptional, entries21))); } - if (firstEntry.isUnpack() != entries21.isUnpack()) { - parent.add(newErrorStatus(NLS.bind(Messages.featureEntryUnpack, entries21))); - } if (firstEntry.isRequires() && firstEntry.getMatch() != null && !firstEntry.getMatch().equals(entries21.getMatch())) { parent.add(newErrorStatus(NLS.bind(Messages.featureEntryMatch, entries21))); } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/Messages.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/Messages.java index 7406a3b791..2af44304f9 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/Messages.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/Messages.java @@ -36,7 +36,6 @@ public class Messages extends NLS { public static String featureVersionsDontMatch; public static String featureEntry; public static String featureEntryOptional; - public static String featureEntryUnpack; public static String featureEntryMatch; public static String featureEntryFilter; diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/messages.properties b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/messages.properties index 24ff176cc7..65415fcadf 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/messages.properties +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/messages.properties @@ -30,7 +30,6 @@ featureIdsDontMatch=Feature ids are not equal: \"{0}\" and \"{1}\" featureVersionsDontMatch=Feature versions are not equal: \"{0}\" and \"{1}\" featureEntry=The entry \"{0}\" is not present in both features. featureEntryOptional=The entry \"{0}\" is not optional in both features. -featureEntryUnpack=The entry \"{0}\" has different unpack attribute values. featureEntryMatch=The entry \"{0}\" has different match rules. featureEntryFilter=The entry \"{0}\" has different filters. diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteFeaturesAction.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteFeaturesAction.java index 70197d9f76..c223a252ae 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteFeaturesAction.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteFeaturesAction.java @@ -67,7 +67,8 @@ protected void generateFeatureIUs(Feature[] featureList, IPublisherResult result mockManifest.put("Bundle-Version", entry.getVersion()); //$NON-NLS-1$ BundleDescription bundleDescription = BundlesAction.createBundleDescription(mockManifest, null); IArtifactKey key = BundlesAction.createBundleArtifactKey(entry.getId(), entry.getVersion()); - IInstallableUnit[] bundleIUs = EclipsePublisherHelper.createEclipseIU(bundleDescription, entry.isUnpack(), key, extraProperties); + IInstallableUnit[] bundleIUs = EclipsePublisherHelper.createEclipseIU(bundleDescription, false, key, + extraProperties); for (IInstallableUnit bundleIU : bundleIUs) { result.addIU(bundleIU, IPublisherResult.ROOT); }