From e96b556e7e823ee1d0221114065def9f1c503932 Mon Sep 17 00:00:00 2001 From: Andriy Redko Date: Fri, 31 Mar 2023 22:19:09 -0400 Subject: [PATCH] Upgrade forbiddenapis to 3.5.1 (#6840) (#6898) * Upgrade forbiddenapis to 3.5 Signed-off-by: Uwe Schindler * Update to forbiddenapis 3.5.1 and change regex for missing classes Signed-off-by: Uwe Schindler --------- Signed-off-by: Uwe Schindler (cherry picked from commit 37b37c5b518c5bdb2dfdc5250117cfd39394edeb) Co-authored-by: Uwe Schindler --- buildSrc/build.gradle | 2 +- .../gradle/precommit/ThirdPartyAuditPrecommitPlugin.java | 2 +- .../opensearch/gradle/precommit/ThirdPartyAuditTask.java | 6 ++---- buildSrc/src/testKit/thirdPartyAudit/build.gradle | 1 - 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index e6415d0a58f17..35ffd9c5cd4a0 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -114,7 +114,7 @@ dependencies { api 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2' api 'org.jdom:jdom2:2.0.6.1' api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${props.getProperty('kotlin')}" - api 'de.thetaphi:forbiddenapis:3.4' + api 'de.thetaphi:forbiddenapis:3.5.1' api 'com.avast.gradle:gradle-docker-compose-plugin:0.16.11' api "org.yaml:snakeyaml:${props.getProperty('snakeyaml')}" api 'org.apache.maven:maven-model:3.9.1' diff --git a/buildSrc/src/main/java/org/opensearch/gradle/precommit/ThirdPartyAuditPrecommitPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/precommit/ThirdPartyAuditPrecommitPlugin.java index b2d12c4fc2f79..d83f1b01ee043 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/precommit/ThirdPartyAuditPrecommitPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/precommit/ThirdPartyAuditPrecommitPlugin.java @@ -51,7 +51,7 @@ public class ThirdPartyAuditPrecommitPlugin extends PrecommitPlugin { public TaskProvider 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 (BuildParams.isInternal() && project.getPath().equals(":libs:opensearch-core") == false) { diff --git a/buildSrc/src/main/java/org/opensearch/gradle/precommit/ThirdPartyAuditTask.java b/buildSrc/src/main/java/org/opensearch/gradle/precommit/ThirdPartyAuditTask.java index 67e2a45153391..403b4c65f70a7 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/precommit/ThirdPartyAuditTask.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/precommit/ThirdPartyAuditTask.java @@ -79,9 +79,7 @@ @CacheableTask public 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; @@ -368,7 +366,7 @@ private String runForbiddenAPIsCli() throws IOException { spec.jvmArgs("-Xmx1g"); spec.jvmArgs(LoggedExec.shortLivedArgs()); 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()); diff --git a/buildSrc/src/testKit/thirdPartyAudit/build.gradle b/buildSrc/src/testKit/thirdPartyAudit/build.gradle index 2c86d28cf0206..553ff5d8e6ed2 100644 --- a/buildSrc/src/testKit/thirdPartyAudit/build.gradle +++ b/buildSrc/src/testKit/thirdPartyAudit/build.gradle @@ -40,7 +40,6 @@ repositories { } dependencies { - forbiddenApisCliJar 'de.thetaphi:forbiddenapis:3.3' jdkJarHell 'org.opensearch:opensearch-core:current' compileOnly "org.${project.properties.compileOnlyGroup}:${project.properties.compileOnlyVersion}" implementation "org.${project.properties.compileGroup}:${project.properties.compileVersion}"