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
7 changes: 6 additions & 1 deletion biz.aQute.repository/src/aQute/p2/export/P2.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,18 @@ static class Feature extends IU {
final BundleId groupId;
final BundleId jarId;
final String plugin;
final String update;
final String updateLabel;

Feature(BundleId id, Domain properties, List<Provided> provides, List<Required> requires, String plugin) {
Feature(BundleId id, Domain properties, List<Provided> provides, List<Required> requires, String plugin,
String updateSiteUrl, String updateLabel) {
super(id, properties, provides, requires);
this.plugin = plugin;
this.requires.addAll(requires);
this.groupId = getBundleId(id.getBsn() + ".feature.group", id.getVersion());
this.jarId = getBundleId(id.getBsn() + ".feature.jar", id.getVersion());
this.update = updateSiteUrl;
this.updateLabel = updateLabel;
}

String getProvider() {
Expand Down
40 changes: 34 additions & 6 deletions biz.aQute.repository/src/aQute/p2/export/P2Export.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -80,7 +81,7 @@ class P2Export {
this.name = options.getOrDefault("name", bndrun.getName()
.replaceAll("\\.bndrun$", ".jar"));
this.update = bndrun.get("update");
this.updateLabel = bndrun.getProperty("update", "Update");
this.updateLabel = bndrun.getProperty("update.label", "Update");
this.provider = bndrun.getProperty("Bundle-Vendor", "bnd");
}

Expand Down Expand Up @@ -158,8 +159,10 @@ private JarResource generateContent(P2 p2) {
"p2.timestamp", System.currentTimeMillis(), //
"p2.compressed", true);

Set<String> addedUpdateUrls = new HashSet<>();
Tag references = new Tag(content, "references");
if (update != null) {
addedUpdateUrls.add(update);
new Tag(references, "repository")//
.addAttribute("uri", update)
.addAttribute("url", update)
Expand All @@ -171,6 +174,29 @@ private JarResource generateContent(P2 p2) {
.addAttribute("type", 0)
.addAttribute("options", 0);
}

p2.content.units.stream()
.distinct()
.sorted()
.forEach(iu -> {

if (iu instanceof Feature f) {
if (f.update != null && addedUpdateUrls.add(f.update)) {
new Tag(references, "repository")//
.addAttribute("uri", f.update)
.addAttribute("url", f.update)
.addAttribute("type", 1)
.addAttribute("options", 1);
new Tag(references, "repository")//
.addAttribute("uri", f.update)
.addAttribute("url", f.update)
.addAttribute("type", 0)
.addAttribute("options", 1);
}

}
});

size(references);

Tag units = new Tag(content, "units");
Expand Down Expand Up @@ -417,12 +443,13 @@ private Artifact generateFeature(Feature feature) throws Exception {
doDescription(f, feature);
doLegalFeature(f, feature);

Tag url = new Tag("url");
Tag url = new Tag(f, "url");

if (update != null) {
if (feature.update != null) {
Tag tUpdate = new Tag(url, "update");
if (updateLabel != null)
tUpdate.addAttribute("label", updateLabel);
tUpdate.addAttribute("url", feature.update);
if (feature.updateLabel != null)
tUpdate.addAttribute("label", feature.updateLabel);
}

Tag requires = new Tag(f, "requires");
Expand Down Expand Up @@ -570,7 +597,8 @@ P2 parse() {
parseRequired(requires, definition, defaultRange.toString());
parseProvided(provides, definition);

Feature feature = new Feature(featureId, definition, provides, requires, definition.get("-p2.plugin"));
Feature feature = new Feature(featureId, definition, provides, requires, definition.get("-p2.plugin"),
definition.get("update"), definition.get("update.label"));
units.add(feature);

Artifact art = generateFeature(feature);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Bundle-Name: Bndtools ECF Remote Services
Bundle-Description: ECF Remote Services integration for Bndtools
Bundle-Category bndtools
Bundle-Copyright: Copyright Composent, Inc. others, 2025
update: https://download.eclipse.org/rt/ecf/latest/site.p2/
update.label: ECF Update Site

Require-Capability \
feature;name=org.eclipse.ecf.core.feature;version="[0.0.0,1000)",\
feature;name=bndtools.main.feature,\
feature;name=org.eclipse.ecf.discovery.feature;version="[0.0.0,1000)",\
feature;name=org.eclipse.ecf.discovery.jmdns.feature;version="[0.0.0,1000)",\
feature;name=org.eclipse.ecf.osgi.services.feature;version="[0.0.0,1000)",\
feature;name=org.eclipse.ecf.provider.generic.feature;version="[0.0.0,1000)",\
feature;name=org.eclipse.ecf.provider.generic.remoteservice.feature;version="[0.0.0,1000)",\
feature;name=org.eclipse.ecf.remoteservice.feature;version="[0.0.0,1000)",\
feature;name=org.eclipse.ecf.remoteservice.sdk.bndtools.feature;version="[0.0.0,1000)",\
feature;name=org.eclipse.ecf.sharedobject.feature;version="[0.0.0,1000)"


Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,9 @@ version(s), and exceptions or additional permissions here}."
look for such a notice.

You may add additional accurate notices of copyright ownership.]]></license>
<url>
<update url="https://bndtools.jfrog.io/bndtools/update-latest" label="Bndtools Update Site"/>
</url>
<requires>
<import feature="org.eclipse.platform.feature.group" version="4.25.0" match="equivalent"/>
</requires>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<description url="https://bnd.bndtools.org/"><![CDATA[PDE integration for Bndtools]]></description>
<copyright><![CDATA[Copyright bndtools]]></copyright>
<license url="https://opensource.org/licenses/Apache-2.0"><![CDATA[Simple license description]]></license>
<url>
<update url="https://bndtools.jfrog.io/bndtools/update-latest" label="Bndtools Update Site"/>
</url>
<requires>
<import feature="bndtools.main.feature.feature.group" version="7.0.0" match="perfect"/>
<import feature="org.eclipse.pde.feature.group" version="3.14.1300" match="equivalent"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Bundle-Copyright: Copyright bndtools
features = \
bndtools.main.feature.bndrun, \
bndtools.m2e.feature.bndrun, \
bndtools.pde.feature.bndrun
bndtools.pde.feature.bndrun,\
bndtools.ecf.feature.bndrun

update = https://bndtools.jfrog.io/bndtools/update-latest
update.label = Bndtools Update Site
Expand Down
Loading