mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-28 20:15:22 +00:00
Warn user when plugin dependencies don't match
required minimal version
This commit is contained in:
1 parent
5c83c64e7a
commit
2d40b7e7e9
1 file changed
+18
-4
@@ -479,19 +479,33 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
*/
|
||||
/*package*/ void resolvePluginDependencies() throws IOException {
|
||||
List<String> missingDependencies = new ArrayList<String>();
|
||||
List<String> incompatibleDependencies = new ArrayList<String>();
|
||||
// make sure dependencies exist
|
||||
for (Dependency d : dependencies) {
|
||||
if (parent.getPlugin(d.shortName) == null)
|
||||
PluginWrapper plugin = parent.getPlugin(d.shortName);
|
||||
if (plugin == null || plugin.isActive()) {
|
||||
missingDependencies.add(d.toString());
|
||||
} else if (new VersionNumber(plugin.getVersion()).isOlderThan(new VersionNumber(d.version))) {
|
||||
incompatibleDependencies.add(d.toString());
|
||||
}
|
||||
}
|
||||
if (!missingDependencies.isEmpty())
|
||||
throw new IOException("Dependency "+Util.join(missingDependencies, ", ")+" doesn't exist");
|
||||
|
||||
// add the optional dependencies that exists
|
||||
for (Dependency d : optionalDependencies) {
|
||||
if (parent.getPlugin(d.shortName) != null)
|
||||
PluginWrapper plugin = parent.getPlugin(d.shortName);
|
||||
if (plugin != null) {
|
||||
dependencies.add(d);
|
||||
} else if (new VersionNumber(plugin.getVersion()).isOlderThan(new VersionNumber(d.version))) {
|
||||
incompatibleDependencies.add(d.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if (!missingDependencies.isEmpty())
|
||||
throw new IOException("Dependency "+Util.join(missingDependencies, ", ")+" doesn't exist");
|
||||
|
||||
if (!incompatibleDependencies.isEmpty())
|
||||
throw new IOException("Dependency "+Util.join(incompatibleDependencies, ", ")+" doesn't match required version");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user