use of org.apache.ivy.osgi.updatesite.xml.Require in project ant-ivy by apache.
the class PluginAdapter method featureAsBundle.
public static BundleInfo featureAsBundle(URI baseUri, EclipseFeature feature) {
BundleInfo b = new BundleInfo(feature.getId(), feature.getVersion());
URI uri;
if (feature.getUrl() == null) {
uri = baseUri.resolve("features/" + feature.getId() + '_' + feature.getVersion() + ".jar");
} else {
uri = baseUri.resolve(feature.getUrl());
}
b.addArtifact(new BundleArtifact(false, uri, null));
b.setDescription(feature.getDescription());
b.setLicense(feature.getLicense());
for (EclipsePlugin plugin : feature.getPlugins()) {
BundleRequirement r = new BundleRequirement(BundleInfo.BUNDLE_TYPE, plugin.getId(), new VersionRange(plugin.getVersion()), null);
b.addRequirement(r);
}
for (Require require : feature.getRequires()) {
String id;
if (require.getPlugin() != null) {
id = require.getPlugin();
} else {
id = require.getFeature();
}
VersionRange range;
if (require.getMatch().equals("greaterOrEqual")) {
range = new VersionRange(require.getVersion());
} else {
throw new IllegalStateException("unsupported match " + require.getMatch());
}
BundleRequirement r = new BundleRequirement(BundleInfo.BUNDLE_TYPE, id, range, null);
b.addRequirement(r);
}
return b;
}
Aggregations