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

Use debug log level for listing ignored items - fix #182 #290

Merged
merged 1 commit into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -162,16 +162,13 @@ protected class IgnorableDependency {
public Pattern type;
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