From 80607ef43e47c16db334c41102a50fa845610404 Mon Sep 17 00:00:00 2001 From: Timo Westkämper Date: Sun, 4 May 2014 22:08:58 +0300 Subject: Add PublicDiffCriteria and related config options --- .../main/java/org/semver/enforcer/AbstractEnforcerRule.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'enforcer-rule') 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 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); -- cgit v1.2.3