Skip to content

Commit

Permalink
Merge pull request #4145 from bjhargrave/version-attr
Browse files Browse the repository at this point in the history
mainclass: Version attributes must be of type Version
  • Loading branch information
bjhargrave authored Jun 5, 2020
2 parents 8f85b6f + 1c47319 commit cff3f92
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package aQute.bnd.osgi.resource;

import org.osgi.framework.Constants;
import org.osgi.framework.Version;
import org.osgi.framework.VersionRange;

import aQute.bnd.osgi.Domain;
Expand Down Expand Up @@ -30,9 +30,11 @@ public static void build(CapabilityBuilder mc, Domain manifest) {
mainClass = mainClass.replace('/', '.'); // yeah, it happens!

mc.addAttribute(MainClassNamespace.MAINCLASS_NAMESPACE, mainClass);
String version = manifest.get(Constants.BUNDLE_VERSION);
if (version != null)
String versionString = manifest.getBundleVersion();
if ((versionString != null) && aQute.bnd.version.Version.isVersion(versionString)) {
Version version = Version.parseVersion(versionString);
mc.addAttribute(VERSION_ATTRIBUTE, version);
}
}

public static String filter(String mainClass, VersionRange range) {
Expand Down

0 comments on commit cff3f92

Please sign in to comment.