[JENKINS-21486] Fixing optional dependency version resolution. (#2421)

Without it version of optional dependencies is set to "X.Y;resolution:=optional" which causes problems when using hudson.util.VersionNumber comparison methods.
This commit is contained in:
Michal Slusarczyk authored and Oleg Nenashev committed 2016-06-29 20:02:28 +02:00
1 parent a24adb72fa
commit fa1c03b0d8
2 files changed
+34 -3

No files matched your search

+8 -3
View File
@@ -209,10 +209,10 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
if(idx==-1)
throw new IllegalArgumentException("Illegal dependency specifier "+s);
this.shortName = s.substring(0,idx);
this.version = s.substring(idx+1);
String version = s.substring(idx+1);
boolean isOptional = false;
String[] osgiProperties = s.split(";");
String[] osgiProperties = version.split("[;]");
for (int i = 1; i < osgiProperties.length; i++) {
String osgiProperty = osgiProperties[i].trim();
if (osgiProperty.equalsIgnoreCase("resolution:=optional")) {
@@ -220,6 +220,11 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
}
}
this.optional = isOptional;
if (isOptional) {
this.version = osgiProperties[0];
} else {
this.version = version;
}
}
@Override