提交 2d40b7e7 编写于 作者: N Nicolas De Loof

Warn user when plugin dependencies don't match

required minimal version
上级 5c83c64e
......@@ -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");
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册