diff options
author | Timo Westkämper <[email protected]> | 2014-05-04 22:08:58 +0300 |
---|---|---|
committer | Timo Westkämper <[email protected]> | 2014-05-04 22:08:58 +0300 |
commit | 80607ef43e47c16db334c41102a50fa845610404 (patch) | |
tree | c5f57775fc537d489bf01008a2326f7d3dc17bdf /enforcer-rule | |
parent | fda5584b30fc2485df7583bdb15d2ee436b85120 (diff) |
Add PublicDiffCriteria and related config options
Diffstat (limited to 'enforcer-rule')
-rwxr-xr-x | enforcer-rule/src/main/java/org/semver/enforcer/AbstractEnforcerRule.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/enforcer-rule/src/main/java/org/semver/enforcer/AbstractEnforcerRule.java b/enforcer-rule/src/main/java/org/semver/enforcer/AbstractEnforcerRule.java index 8525be6..38c2517 100755 --- a/enforcer-rule/src/main/java/org/semver/enforcer/AbstractEnforcerRule.java +++ b/enforcer-rule/src/main/java/org/semver/enforcer/AbstractEnforcerRule.java @@ -39,6 +39,9 @@ import org.apache.maven.enforcer.rule.api.EnforcerRuleException; import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; +import org.osjava.jardiff.DiffCriteria; +import org.osjava.jardiff.PublicDiffCriteria; +import org.osjava.jardiff.SimpleDiffCriteria; import org.semver.Comparer; import org.semver.Delta; import org.semver.Dumper; @@ -79,6 +82,13 @@ public abstract class AbstractEnforcerRule implements EnforcerRule { * @parameter */ private boolean dumpDetails = false; + + /** + * Check public members only + * + * @parameter + */ + private boolean publicOnly = false; private Set<String> extractFilters(final String[] filtersAsStringArray) { if (filtersAsStringArray == null) { @@ -149,7 +159,8 @@ public abstract class AbstractEnforcerRule implements EnforcerRule { helper.getLog().info("Using <"+currentJar+"> as current JAR"); try { - final Comparer comparer = new Comparer(previousJar, currentJar, extractFilters(this.includes), extractFilters(this.excludes)); + final DiffCriteria diffCriteria = publicOnly ? new PublicDiffCriteria() : new SimpleDiffCriteria(); + final Comparer comparer = new Comparer(diffCriteria, previousJar, currentJar, extractFilters(this.includes), extractFilters(this.excludes)); final Delta delta = comparer.diff(); enforce(helper, delta, previous, current); |