Remove legacy transitive dependencies no longer bundled with the JVM from muzzle tests
This commit is contained in:
parent
cba8ba1221
commit
27b4db8861
|
@ -263,9 +263,15 @@ class MuzzlePlugin implements Plugin<Project> {
|
|||
private static Task addMuzzleTask(MuzzleDirective muzzleDirective, Artifact versionArtifact, Project instrumentationProject, Task runAfter, Project bootstrapProject, Project toolingProject) {
|
||||
def taskName = "muzzle-Assert${muzzleDirective.assertPass ? "Pass" : "Fail"}-$versionArtifact.groupId-$versionArtifact.artifactId-$versionArtifact.version${muzzleDirective.name ? "-${muzzleDirective.getNameSlug()}" : ""}"
|
||||
def config = instrumentationProject.configurations.create(taskName)
|
||||
config.dependencies.add(instrumentationProject.dependencies.create("$versionArtifact.groupId:$versionArtifact.artifactId:$versionArtifact.version") {
|
||||
def dep = instrumentationProject.dependencies.create("$versionArtifact.groupId:$versionArtifact.artifactId:$versionArtifact.version") {
|
||||
transitive = true
|
||||
})
|
||||
}
|
||||
// The following optional transitive dependencies are brought in by some legacy module such as log4j 1.x but are no
|
||||
// longer bundled with the JVM and have to be excluded for the muzzle tests to be able to run.
|
||||
dep.exclude group: 'com.sun.jdmk', module: 'jmxtools'
|
||||
dep.exclude group: 'com.sun.jmx', module: 'jmxri'
|
||||
|
||||
config.dependencies.add(dep)
|
||||
for (String additionalDependency : muzzleDirective.additionalDependencies) {
|
||||
config.dependencies.add(instrumentationProject.dependencies.create(additionalDependency) {
|
||||
transitive = true
|
||||
|
|
|
@ -9,10 +9,8 @@ import datadog.trace.agent.tooling.Instrumenter;
|
|||
import datadog.trace.agent.tooling.log.LogContextScopeListener;
|
||||
import datadog.trace.api.Config;
|
||||
import datadog.trace.api.GlobalTracer;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
import net.bytebuddy.asm.Advice;
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
|
@ -43,7 +41,7 @@ public class Log4j1MDCInstrumentation extends Instrumenter.Default {
|
|||
|
||||
@Override
|
||||
public String[] helperClassNames() {
|
||||
return new String[]{LogContextScopeListener.class.getName()};
|
||||
return new String[] {LogContextScopeListener.class.getName()};
|
||||
}
|
||||
|
||||
public static class MDCContextAdvice {
|
||||
|
@ -60,7 +58,7 @@ public class Log4j1MDCInstrumentation extends Instrumenter.Default {
|
|||
GlobalTracer.get().addScopeListener(new LogContextScopeListener(putMethod, removeMethod));
|
||||
} catch (final NoSuchMethodException e) {
|
||||
org.slf4j.LoggerFactory.getLogger(instance.getClass())
|
||||
.debug("Failed to add log4j ThreadContext span listener", e);
|
||||
.debug("Failed to add log4j ThreadContext span listener", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue