Convert apache-http, akka, and play to muzzle plugin

This commit is contained in:
Andrew Kent 2018-08-20 18:41:17 -07:00
parent c6841c9d06
commit f06eb57449
5 changed files with 45 additions and 55 deletions

View File

@ -16,6 +16,20 @@ compileLagomTestGroovy {
targetCompatibility = 1.8
}
muzzle {
pass {
group = 'com.typesafe.akka'
module = 'akka-http_2.11'
versions = "[10.0.0,10.0.12)"
}
pass {
group = 'com.typesafe.akka'
module = 'akka-http_2.12'
versions = "[10.0.0,10.0.12)"
}
}
dependencies {
compileOnly group: 'com.typesafe.akka', name: 'akka-http_2.11', version: '10.0.0'

View File

@ -1,29 +1,23 @@
apply plugin: 'version-scan'
apply from: "${rootDir}/gradle/java.gradle"
versionScan {
muzzle {
pass {
group = "org.apache.httpcomponents"
module = "httpclient"
versions = "[4.3,)"
legacyGroup = "commons-httpclient"
legacyModule = "commons-httpclient"
verifyPresent = [
// The commented out classes are required for the instrumentation (this is checked by our bytebuddy rules).
// Once the verifier can report on the failed versions these classes can be commented out and the pass range can be widened.
// "org.apache.http.HttpException" : null,
// "org.apache.http.HttpRequest" : null,
// "org.apache.http.client.RedirectStrategy" : null,
"org.apache.http.client.methods.CloseableHttpResponse": null,
"org.apache.http.client.methods.HttpExecutionAware" : null,
"org.apache.http.client.methods.HttpRequestWrapper" : null,
"org.apache.http.client.protocol.HttpClientContext" : null,
// "org.apache.http.conn.routing.HttpRoute" : null,
"org.apache.http.impl.execchain.ClientExecChain" : null
]
}
pass {
group = "commons-httpclient"
module = "commons-httpclient"
versions = "[4.3,)"
}
fail {
group = "org.apache.httpcomponents"
module = "httpclient"
versions = "[,4.3)"
}
}
apply from: "${rootDir}/gradle/java.gradle"
apply plugin: 'org.unbroken-dome.test-sets'
testSets {

View File

@ -1,7 +1,6 @@
package datadog.trace.instrumentation.apachehttpclient;
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasSuperType;
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static io.opentracing.log.Fields.ERROR_OBJECT;
import static net.bytebuddy.matcher.ElementMatchers.isAbstract;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
@ -36,22 +35,6 @@ public class ApacheHttpClientInstrumentation extends Instrumenter.Default {
.or(safeHasSuperType(named("org.apache.http.impl.client.CloseableHttpClient")));
}
@Override
public ElementMatcher<ClassLoader> classLoaderMatcher() {
return classLoaderHasClasses(
"org.apache.http.HttpException",
"org.apache.http.HttpRequest",
"org.apache.http.client.RedirectStrategy",
"org.apache.http.client.methods.CloseableHttpResponse",
"org.apache.http.client.methods.HttpExecutionAware",
"org.apache.http.client.methods.HttpRequestWrapper",
"org.apache.http.client.protocol.HttpClientContext",
"org.apache.http.conn.routing.HttpRoute",
"org.apache.http.impl.execchain.ClientExecChain",
"org.apache.http.impl.client.CloseableHttpClient",
"org.apache.http.impl.client.InternalHttpClient");
}
@Override
public String[] helperClassNames() {
return new String[] {

View File

@ -7,6 +7,19 @@ testSets {
latestDepTest
}
muzzle {
pass {
group = 'com.typesafe.play'
module = 'play_2.11'
versions = '[2.4.0,2.7.0-M1)'
}
pass {
group = 'com.typesafe.play'
module = 'play_2.12'
versions = '[2.4.0,2.7.0-M1)'
}
}
dependencies {
compileOnly group: 'com.typesafe.play', name: 'play_2.11', version: '2.4.0'

View File

@ -1,8 +1,6 @@
package datadog.trace.instrumentation.play;
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasSuperType;
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClassWithMethod;
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static io.opentracing.log.Fields.ERROR_OBJECT;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.returns;
@ -50,18 +48,6 @@ public final class PlayInstrumentation extends Instrumenter.Default {
return safeHasSuperType(named("play.api.mvc.Action"));
}
@Override
public ElementMatcher<ClassLoader> classLoaderMatcher() {
return classLoaderHasClasses(
"akka.japi.JavaPartialFunction",
"play.api.mvc.Action",
"play.api.mvc.Result",
"scala.Option",
"scala.Tuple2",
"scala.concurrent.Future")
.and(classLoaderHasClassWithMethod("play.api.mvc.Request", "tags"));
}
@Override
public String[] helperClassNames() {
return new String[] {