Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce dependencies versions #150

Merged
merged 5 commits into from
Jun 24, 2017
Merged

Enforce dependencies versions #150

merged 5 commits into from
Jun 24, 2017

Conversation

decebals
Copy link
Member

@decebals decebals commented Jun 22, 2017

This PR check the dependency version declared in plugin metadata (see PluginDescriptor.getDependencies() -> PluginDependency.getPluginVersionSupport()).
The important method is DependencyResolver.checkDependencyVersion().
The actual implementation is:

/**
 * Check if an existing version of dependency is compatible with the required version (from plugin descriptor).
 *
 * @param requiredVersion
 * @param existingVersion
 * @return
 */
protected boolean checkDependencyVersion(String requiredVersion, Version existingVersion) {
    return existingVersion.satisfies(requiredVersion);
}

DependencyResolver class is capable now to offer additional information via DependencyResolver.Result object returned by public Result resolve(List<PluginDescriptor> plugins) method:

public static class Result {

    private boolean cyclicDependency;
    private List<String> notFoundDependencies; // value is "pluginId"
    private List<String> sortedPlugins; // value is "pluginId"
    private List<WrongDependencyVersion> wrongVersionDependencies;

    // getters

}
public static class WrongDependencyVersion {

    private String dependencyId; // value is "pluginId"
    private String dependentId; // value is "pluginId"
    private Version existingVersion;
    private String requiredVersion;

    // getters

}

The actual implementation allows you to stop the application if something is wrong with the dependencies (the default behavior) via:

  • DependencyResolver.CyclicDependencyException
  • DependencyResolver.DependenciesNotFoundException
  • DependencyResolver.DependenciesWrongVersionException

or to try to eliminate the plugins with problems and start the application only with the plugins that are OK.

@coveralls
Copy link

coveralls commented Jun 22, 2017

Coverage Status

Coverage decreased (-0.6%) to 52.133% when pulling 7814de4 on dependencies into a9c70ff on master.

@coveralls
Copy link

coveralls commented Jun 23, 2017

Coverage Status

Coverage increased (+1.9%) to 54.614% when pulling 3261133 on dependencies into a9c70ff on master.

@coveralls
Copy link

coveralls commented Jun 23, 2017

Coverage Status

Coverage increased (+1.9%) to 54.614% when pulling 1661d30 on dependencies into a9c70ff on master.

@coveralls
Copy link

coveralls commented Jun 24, 2017

Coverage Status

Coverage increased (+2.0%) to 54.694% when pulling d77cfad on dependencies into a9c70ff on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants