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

Remove processing of unused plugin element attributes in feature.xml and distinction between Plug-ins and Fragments in ProductFile #368

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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 @@ -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$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,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;
/**
Expand All @@ -42,7 +40,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;
Expand All @@ -53,7 +50,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;
Expand Down Expand Up @@ -150,10 +146,6 @@ public int hashCode() {
return result;
}

public boolean isFragment() {
return isFragment;
}

public boolean isOptional() {
return optional;
}
Expand All @@ -166,10 +158,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;
Expand All @@ -185,18 +173,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;
}
Expand All @@ -215,10 +195,6 @@ public String toString() {
return result.toString();
}

public boolean unpackSet() {
return unpack != null;
}

public boolean isPatch() {
return isPatch;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<IInstallableUnit> childIUs = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Loading