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

Update forbiddenapis to 3.5.1 #96032

Merged
merged 1 commit into from
May 12, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class ThirdPartyAuditTaskFuncTest extends AbstractGradleInternalPluginFuncTest {
buildFile << """
import org.elasticsearch.gradle.internal.precommit.ThirdPartyAuditPrecommitPlugin
import org.elasticsearch.gradle.internal.precommit.ThirdPartyAuditTask

apply plugin:'java'

group = 'org.elasticsearch'
version = 'current'
repositories {
Expand All @@ -45,8 +45,8 @@ class ThirdPartyAuditTaskFuncTest extends AbstractGradleInternalPluginFuncTest {
}
}
mavenCentral()
}
}

tasks.named("thirdPartyAudit").configure {
signatureFile = file('signature-file.txt')
}
Expand Down Expand Up @@ -98,6 +98,8 @@ class ThirdPartyAuditTaskFuncTest extends AbstractGradleInternalPluginFuncTest {
def output = normalized(result.getOutput())
assertOutputContains(output, """\
Forbidden APIs output:
DEBUG: Classpath: [file:./build/precommit/thirdPartyAudit/thirdPartyAudit/]
DEBUG: Detected Java 9 or later with module system.
ERROR: Forbidden class/interface use: java.io.File [non-public internal runtime class]
ERROR: in org.acme.TestingIO (method declaration of 'getFile()')
ERROR: Scanned 1 class file(s) for forbidden API invocations (in 0.00s), 1 error(s).
Expand Down Expand Up @@ -134,7 +136,11 @@ class ThirdPartyAuditTaskFuncTest extends AbstractGradleInternalPluginFuncTest {
def output = normalized(result.getOutput())
assertOutputContains(output, """\
Forbidden APIs output:
WARNING: Class 'org.apache.logging.log4j.LogManager' cannot be loaded (while looking up details about referenced class 'org.apache.logging.log4j.LogManager'). Please fix the classpath!
DEBUG: Classpath: [file:./build/precommit/thirdPartyAudit/thirdPartyAudit/]
DEBUG: Detected Java 9 or later with module system.
DEBUG: Class 'org.apache.logging.log4j.LogManager' cannot be loaded (while looking up details about referenced class 'org.apache.logging.log4j.LogManager').
WARNING: While scanning classes to check, the following referenced classes were not found on classpath (this may miss some violations):
WARNING: org.apache.logging.log4j.LogManager
==end of forbidden APIs==
Missing classes:
* org.apache.logging.log4j.LogManager""".stripIndent())
Expand Down Expand Up @@ -177,7 +183,7 @@ class ThirdPartyAuditTaskFuncTest extends AbstractGradleInternalPluginFuncTest {
Execution failed for task ':thirdPartyAudit'.
> Audit of third party dependencies failed:
Jar Hell with the JDK:
*
*
""".stripIndent())
assertOutputMissing(output, "Classes with violations:");
assertNoDeprecationWarning(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class ThirdPartyAuditPrecommitPlugin extends PrecommitPlugin {
public TaskProvider<? extends Task> createTask(Project project) {
project.getPlugins().apply(CompileOnlyResolvePlugin.class);
project.getConfigurations().create("forbiddenApisCliJar");
project.getDependencies().add("forbiddenApisCliJar", "de.thetaphi:forbiddenapis:3.4");
project.getDependencies().add("forbiddenApisCliJar", "de.thetaphi:forbiddenapis:3.5.1");
Configuration jdkJarHellConfig = project.getConfigurations().create(JDK_JAR_HELL_CONFIG_NAME);
if (project.getPath().equals(LIBS_ELASTICSEARCH_CORE_PROJECT_PATH) == false) {
// Internal projects are not all plugins, so make sure the check is available
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@
@CacheableTask
public abstract class ThirdPartyAuditTask extends DefaultTask {

private static final Pattern MISSING_CLASS_PATTERN = Pattern.compile(
"WARNING: Class '(.*)' cannot be loaded \\(.*\\)\\. Please fix the classpath!"
);
private static final Pattern MISSING_CLASS_PATTERN = Pattern.compile("DEBUG: Class '(.*)' cannot be loaded \\(.*\\)\\.");

private static final Pattern VIOLATION_PATTERN = Pattern.compile("\\s\\sin ([a-zA-Z0-9$.]+) \\(.*\\)");
private static final int SIG_KILL_EXIT_VALUE = 137;
Expand Down Expand Up @@ -337,7 +335,7 @@ private String runForbiddenAPIsCli() throws IOException {
spec.classpath(getForbiddenAPIsClasspath(), classpath);
spec.jvmArgs("-Xmx1g");
spec.getMainClass().set("de.thetaphi.forbiddenapis.cli.CliMain");
spec.args("-f", getSignatureFile().getAbsolutePath(), "-d", getJarExpandDir(), "--allowmissingclasses");
spec.args("-f", getSignatureFile().getAbsolutePath(), "-d", getJarExpandDir(), "--debug", "--allowmissingclasses");
spec.setErrorOutput(errorOut);
if (getLogger().isInfoEnabled() == false) {
spec.setStandardOutput(new NullOutputStream());
Expand Down
2 changes: 1 addition & 1 deletion gradle/build.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ checkstyle = "com.puppycrawl.tools:checkstyle:10.3"
commons-codec = "commons-codec:commons-codec:1.11"
commmons-io = "commons-io:commons-io:2.2"
docker-compose = "com.avast.gradle:gradle-docker-compose-plugin:0.16.12"
forbiddenApis = "de.thetaphi:forbiddenapis:3.4"
forbiddenApis = "de.thetaphi:forbiddenapis:3.5.1"
hamcrest = "org.hamcrest:hamcrest:2.1"
httpcore = "org.apache.httpcomponents:httpcore:4.4.12"
httpclient = "org.apache.httpcomponents:httpclient:4.5.10"
Expand Down
6 changes: 3 additions & 3 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1091,9 +1091,9 @@
<sha256 value="b6ae5b90d5825070d2f82ac61417090fce8ed7e56348a3e86a2026774e8ba56a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="de.thetaphi" name="forbiddenapis" version="3.4">
<artifact name="forbiddenapis-3.4.jar">
<sha256 value="c02730010ecc60ed49fb23e5ec25f678789a2c1a2582835806bc0ae6100ee109" origin="Generated by Gradle"/>
<component group="de.thetaphi" name="forbiddenapis" version="3.5.1">
<artifact name="forbiddenapis-3.5.1.jar">
<sha256 value="3401b109c496a301c95585f94b4099e197fcd001ac008672eaab06d9fbe08a27" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="dev.equo.ide" name="solstice" version="1.0.3">
Expand Down