Skip to content

Commit

Permalink
Use debug log level for listing ignored items - fix #182
Browse files Browse the repository at this point in the history
  • Loading branch information
slawekjaranowski committed Mar 10, 2024
1 parent 11985d9 commit c31f690
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 37 deletions.
16 changes: 6 additions & 10 deletions src/it/banduplicate-classes-jdk9/verify.groovy
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
File file = new File( basedir, "build.log" );
assert file.exists();
File file = new File(basedir, "build.log")
assert file.exists()

String text = file.getText("utf-8");
String text = file.getText("utf-8")


assert text.contains( '[INFO] Adding ignore: module-info' )
assert text.contains( '[DEBUG] Ignore: module-info maps to regex ^module-info(\\.class)?$' )
assert text.contains( '[INFO] Adding ignore: META-INF/versions/*/module-info' )
assert text.contains( '[DEBUG] Ignore: META-INF/versions/*/module-info maps to regex ^META-INF/versions/.*/module-info(\\.class)?$' )
assert text.contains( '[INFO] BUILD SUCCESS' )

return true;
assert text.contains('[DEBUG] Ignore: module-info maps to regex ^module-info(\\.class)?$')
assert text.contains('[DEBUG] Ignore: META-INF/versions/*/module-info maps to regex ^META-INF/versions/.*/module-info(\\.class)?$')
assert text.contains('[INFO] BUILD SUCCESS')
11 changes: 4 additions & 7 deletions src/it/enforce-bytecode-version-module-info-jdk8/verify.groovy
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
File file = new File( basedir, "build.log" );
assert file.exists();
File file = new File(basedir, "build.log")
assert file.exists()

String text = file.getText("utf-8");
String text = file.getText("utf-8")

assert text.contains( '[INFO] Adding ignore: module-info' )
assert text.contains( '[DEBUG] Ignore: module-info maps to regex ^module-info(\\.class)?$' )

return true;
assert text.contains('[DEBUG] Ignore: module-info maps to regex ^module-info(\\.class)?$')
12 changes: 5 additions & 7 deletions src/it/enforce-bytecode-version-multirelease-2/verify.groovy
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
File file = new File( basedir, "build.log" );
assert file.exists();
File file = new File(basedir, "build.log")
assert file.exists()

String text = file.getText("utf-8");
String text = file.getText("utf-8")

assert text.contains( '[INFO] Adding ignore: module-info' )
assert !text.contains( '[WARNING] Invalid bytecodeVersion for com.fasterxml.jackson.core:jackson-core:jar:2.13.0:runtime' )

return true;
assert text.contains('[DEBUG] Ignore: module-info maps to regex ^module-info(\\.class)?$')
assert !text.contains('[WARNING] Invalid bytecodeVersion for com.fasterxml.jackson.core:jackson-core:jar:2.13.0:runtime')
12 changes: 5 additions & 7 deletions src/it/enforce-bytecode-version-multirelease/verify.groovy
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
File file = new File( basedir, "build.log" );
assert file.exists();
File file = new File(basedir, "build.log")
assert file.exists()

String text = file.getText("utf-8");
String text = file.getText("utf-8")

assert text.contains( '[INFO] Adding ignore: module-info' )
assert text.contains( '[DEBUG] log4j-api-2.17.2.jar => ' )

return true;
assert text.contains('[DEBUG] Ignore: module-info maps to regex ^module-info(\\.class)?$')
assert text.contains('[DEBUG] log4j-api-2.17.2.jar => ')
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,13 @@ protected class IgnorableDependency {

public List<Pattern> ignores = new ArrayList<>();

public IgnorableDependency applyIgnoreClasses(String[] ignores, boolean indent) {
public void applyIgnoreClasses(String[] ignores, boolean indent) {
String prefix = indent ? " " : "";
for (String ignore : ignores) {
getLog().info(prefix + "Adding ignore: " + ignore);
ignore = ignore.replace('.', '/');
String pattern = asRegex(ignore);
getLog().debug(prefix + "Ignore: " + ignore + " maps to regex " + pattern);
String pattern = asRegex(ignore.replace('.', '/'));
getLog().debug(() -> prefix + "Ignore: " + ignore + " maps to regex " + pattern);
this.ignores.add(Pattern.compile(pattern));
}
return this;
}

public boolean matchesArtifact(Artifact dup) {
Expand Down

0 comments on commit c31f690

Please sign in to comment.