Warn user when plugin dependencies don't match

required minimal version
This commit is contained in:
Nicolas De Loof committed 2014-02-11 13:31:38 +01:00
1 parent 5c83c64e7a
commit 2d40b7e7e9
1 file changed
+18 -4
+18 -4
View File
@@ -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");
}
/**