Gradle dependencies cleanup (#556)

* Bootstrap fixed

* Tooling fixed

* Testing fixed

* All instrumentation tests pass

* All tests pass

* Fix test

* Muzzle workaround

* Muzzle fix

* Update instrumentation/trace-annotation/trace-annotation.gradle

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
This commit is contained in:
Nikita Salnikov-Tarnovski 2020-06-24 12:01:14 +03:00 committed by GitHub
parent 6f5f67327f
commit 9a52f6708e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 92 additions and 82 deletions

View File

@ -10,15 +10,13 @@ minimumBranchCoverage = 0.0
minimumInstructionCoverage = 0.0
dependencies {
compile deps.opentelemetryApi
compile deps.opentelemetryApiAutoAnnotations
api deps.opentelemetryApi
compileOnly deps.opentelemetrySdk
compile project(':utils:thread-utils')
compile deps.slf4j
compile group: 'org.slf4j', name: 'slf4j-simple', version: versions.slf4j
implementation deps.slf4j
implementation group: 'org.slf4j', name: 'slf4j-simple', version: versions.slf4j
// ^ Generally a bad idea for libraries, but we're shadowing.
testCompile project(':testing')
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.19.0'
testCompile group: 'org.assertj', name: 'assertj-core', version: '1.7.1'
testImplementation project(':testing')
testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.19.0'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '1.7.1'
}

View File

@ -20,10 +20,9 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.ResourceBundle;
import java.util.Set;
@ -36,7 +35,7 @@ import org.mockito.Mockito;
public class PatchLoggerTest {
@Test
public void testImplementsAllMethods() {
final Set<MethodSignature> patchLoggerMethods = Sets.newHashSet();
final Set<MethodSignature> patchLoggerMethods = new HashSet<>();
for (final Method method : PatchLogger.class.getMethods()) {
final MethodSignature methodSignature = new MethodSignature();
methodSignature.name = method.getName();
@ -53,7 +52,7 @@ public class PatchLoggerTest {
.replace("io.opentelemetry.auto.bootstrap.PatchLogger", "java.util.logging.Logger");
patchLoggerMethods.add(methodSignature);
}
final Set<MethodSignature> julLoggerMethods = Sets.newHashSet();
final Set<MethodSignature> julLoggerMethods = new HashSet<>();
for (final Method method : java.util.logging.Logger.class.getMethods()) {
final String methodName = method.getName();
if (methodName.contains("Handler") || methodName.contains("Filter")) {
@ -61,7 +60,7 @@ public class PatchLoggerTest {
}
final MethodSignature builder = new MethodSignature();
builder.name = methodName;
final List<String> parameterTypes = Lists.newArrayList();
final List<String> parameterTypes = new ArrayList<>();
for (final Class<?> clazz : method.getParameterTypes()) {
parameterTypes.add(clazz.getName());
}

View File

@ -10,21 +10,22 @@ configurations {
}
dependencies {
compile(project(':auto-bootstrap'))
compile(project(':utils:thread-utils'))
implementation(project(':auto-bootstrap'))
implementation(project(':utils:thread-utils'))
compile deps.opentelemetryApi
compile deps.opentelemetrySdk
compile deps.opentelemetrySdkAutoConfig
compile deps.opentelemetryTraceProps
implementation deps.opentelemetryApi
implementation deps.opentelemetrySdk
implementation deps.opentelemetrySdkAutoConfig
implementation deps.opentelemetryTraceProps
compile group: 'com.blogspot.mydailyjava', name: 'weak-lock-free', version: '0.15'
compile deps.bytebuddy
compile deps.bytebuddyagent
implementation group: 'com.blogspot.mydailyjava', name: 'weak-lock-free', version: '0.15'
implementation deps.bytebuddy
implementation deps.bytebuddyagent
annotationProcessor deps.autoservice
implementation deps.autoservice
implementation deps.slf4j
testCompile project(':testing')
testImplementation project(':testing')
instrumentationMuzzle sourceSets.main.output
instrumentationMuzzle configurations.compile

View File

@ -7,6 +7,7 @@ apply from: "$rootDir/gradle/java.gradle"
dependencies {
testCompile project(':auto-tooling')
testCompile deps.opentelemetrySdkAutoConfig
testCompile project(':auto-exporters:opentelemetry-auto-exporter-otlp')
testCompile project(':auto-exporters:opentelemetry-auto-exporter-jaeger')
testCompile project(':auto-exporters:opentelemetry-auto-exporter-logging')

View File

@ -22,29 +22,32 @@ afterEvaluate {
transformation {
tasks = ['compileJava', 'compileScala', 'compileKotlin']
plugin = 'io.opentelemetry.auto.tooling.muzzle.MuzzleGradlePlugin'
classPath = project(':auto-tooling').configurations.instrumentationMuzzle + configurations.compile + sourceSets.main.output
classPath = project(':auto-tooling').configurations.instrumentationMuzzle + configurations.runtimeClasspath + sourceSets.main.output
}
}
dependencies {
implementation(project(':auto-bootstrap'))
// Apply common dependencies for instrumentation.
compile(project(':auto-tooling')) {
implementation(project(':auto-tooling')) {
// OpenTelemetry SDK is not needed for compilation, and :opentelemetry-sdk-shaded-for-testing
// is brought in for tests by project(:testing) below
exclude group: 'io.opentelemetry', module: 'opentelemetry-sdk'
}
compile deps.bytebuddy
implementation deps.bytebuddy
annotationProcessor deps.autoservice
implementation deps.autoservice
implementation deps.slf4j
// Include instrumentations instrumenting core JDK classes tp ensure interoperability with other instrumentation
testCompile project(':instrumentation:java-concurrent')
testImplementation project(':instrumentation:java-concurrent')
// FIXME: we should enable this, but currently this fails tests for google http client
//testCompile project(':instrumentation:http-url-connection')
testCompile project(':instrumentation:java-class-loader')
//testImplementation project(':instrumentation:http-url-connection')
testImplementation project(':instrumentation:java-class-loader')
testCompile project(':testing')
testImplementation project(':testing')
testAnnotationProcessor deps.autoservice
testImplementation deps.autoservice
testImplementation project(':utils:test-utils')
}
}

View File

@ -1,10 +1,6 @@
import java.time.Duration
if (project.path.startsWith(":instrumentation-core")) {
apply plugin: 'java-library'
} else {
apply plugin: 'java'
}
apply plugin: 'groovy'
apply from: "$rootDir/gradle/spotless.gradle"

View File

@ -32,6 +32,7 @@ dependencies {
testCompile group: 'software.amazon.awssdk', name: 'sqs', version: '2.2.0'
testCompile group: 'software.amazon.awssdk', name: 'dynamodb', version: '2.2.0'
testCompile group: 'software.amazon.awssdk', name: 'kinesis', version: '2.2.0'
testImplementation deps.guava
latestDepTestCompile project(':instrumentation:apache-httpclient:apache-httpclient-4.0')
latestDepTestCompile project(':instrumentation:netty:netty-4.1')

View File

@ -33,6 +33,7 @@ dependencies {
testCompile group: 'software.amazon.awssdk', name: 'sqs', version: '2.2.0'
testCompile group: 'software.amazon.awssdk', name: 'dynamodb', version: '2.2.0'
testCompile group: 'software.amazon.awssdk', name: 'kinesis', version: '2.2.0'
testImplementation deps.guava
latestDepTestCompile project(':instrumentation:apache-httpclient:apache-httpclient-4.0')
latestDepTestCompile project(':instrumentation:netty:netty-4.1')

View File

@ -53,6 +53,7 @@ testSets {
}
dependencies {
implementation(project(':utils:thread-utils'))
compileOnly group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version: '3.0.0'
testCompile group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version: '3.2.0'

View File

@ -51,6 +51,7 @@ public class CassandraClientInstrumentation extends Instrumenter.Default {
packageName + ".TracingSession",
packageName + ".TracingSession$1",
packageName + ".TracingSession$2",
"io.opentelemetry.auto.common.exec.DaemonThreadFactory",
};
}

View File

@ -48,6 +48,7 @@ dependencies {
testCompile group: 'io.grpc', name: 'grpc-protobuf', version: grpcVersion
testCompile group: 'io.grpc', name: 'grpc-stub', version: grpcVersion
testCompile group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
testCompile project(':utils:thread-utils')
latestDepTestCompile sourceSets.test.output // include the protobuf generated classes
latestDepTestCompile group: 'io.grpc', name: 'grpc-netty', version: '+'

View File

@ -27,7 +27,6 @@ import okhttp3.Response
import org.apache.catalina.Context
import org.apache.catalina.startup.Tomcat
import org.apache.jasper.JasperException
import org.eclipse.jetty.http.HttpStatus
import spock.lang.Shared
import spock.lang.Unroll
@ -142,7 +141,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner {
}
}
}
res.code() == HttpStatus.OK_200
res.code() == 200
cleanup:
res.close()
@ -204,7 +203,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner {
}
}
}
res.code() == HttpStatus.OK_200
res.code() == 200
cleanup:
res.close()
@ -263,7 +262,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner {
}
}
}
res.code() == HttpStatus.OK_200
res.code() == 200
cleanup:
res.close()
@ -333,7 +332,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner {
}
}
}
res.code() == HttpStatus.INTERNAL_SERVER_ERROR_500
res.code() == 500
cleanup:
res.close()
@ -394,7 +393,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner {
}
}
}
res.code() == HttpStatus.OK_200
res.code() == 200
cleanup:
res.close()
@ -489,7 +488,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner {
}
}
}
res.code() == HttpStatus.OK_200
res.code() == 200
cleanup:
res.close()
@ -536,7 +535,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner {
}
}
}
res.code() == HttpStatus.INTERNAL_SERVER_ERROR_500
res.code() == 500
cleanup:
res.close()
@ -556,7 +555,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner {
Response res = client.newCall(req).execute()
then:
res.code() == HttpStatus.OK_200
res.code() == 200
assertTraces(1) {
trace(0, 1) {
span(0) {

View File

@ -25,7 +25,6 @@ import okhttp3.Response
import org.apache.catalina.Context
import org.apache.catalina.startup.Tomcat
import org.apache.jasper.JasperException
import org.eclipse.jetty.http.HttpStatus
import spock.lang.Shared
import spock.lang.Unroll
@ -161,7 +160,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner {
}
}
}
res.code() == HttpStatus.OK_200
res.code() == 200
cleanup:
res.close()
@ -221,7 +220,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner {
}
}
}
res.code() == HttpStatus.OK_200
res.code() == 200
cleanup:
res.close()
@ -339,7 +338,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner {
}
}
}
res.code() == HttpStatus.OK_200
res.code() == 200
cleanup:
res.close()
@ -436,7 +435,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner {
}
}
}
res.code() == HttpStatus.OK_200
res.code() == 200
cleanup:
res.close()
@ -504,7 +503,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner {
}
}
}
res.code() == HttpStatus.INTERNAL_SERVER_ERROR_500
res.code() == 500
cleanup:
res.close()
@ -559,7 +558,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner {
}
}
}
res.code() == HttpStatus.NOT_FOUND_404
res.code() == 404
cleanup:
res.close()

View File

@ -30,7 +30,7 @@ dependencies {
compile project(':auto-tooling')
testCompile(project(':testing')) {
testImplementation(project(':testing')) {
exclude module: 'okhttp'
}
testCompile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.0.0'

View File

@ -26,7 +26,7 @@ dependencies {
compileOnly group: 'javax.servlet', name: 'servlet-api', version: '2.2'
compile(project(':instrumentation:servlet:servlet-common'))
testCompile(project(':testing')) {
testImplementation(project(':testing')) {
exclude group: 'org.eclipse.jetty', module: 'jetty-server'
}
testCompile group: 'org.eclipse.jetty', name: 'jetty-server', version: '7.0.0.v20091005'

View File

@ -25,7 +25,7 @@ dependencies {
testCompile project(':instrumentation:servlet:request-2.3')
// Don't want to conflict with jetty from the test server.
testCompile(project(':testing')) {
testImplementation(project(':testing')) {
exclude group: 'org.eclipse.jetty', module: 'jetty-server'
}
}

View File

@ -27,7 +27,7 @@ dependencies {
// compileOnly group: 'org.springframework', name: 'spring-webmvc', version: '2.5.6'
// compileOnly group: 'javax.servlet', name: 'servlet-api', version: '2.4'
testCompile(project(':testing')) {
testImplementation(project(':testing')) {
exclude(module: 'jetty-server') // incompatable servlet api
}

View File

@ -2,13 +2,16 @@ apply from: "$rootDir/gradle/instrumentation.gradle"
muzzle {
pass {
group = "io.opentracing.contrib.dropwizard"
module = "dropwizard-opentracing"
group = "io.opentelemetry"
module = "opentelemetry-contrib-auto-annotations"
versions = "(,)"
extraDependency 'io.opentracing.contrib.dropwizard:dropwizard-opentracing:0.2.2'
}
}
dependencies {
implementation deps.opentelemetryApiAutoAnnotations
testCompile group: 'com.newrelic.agent.java', name: 'newrelic-api', version: '+'
testCompile(group: 'io.opentracing.contrib.dropwizard', name: 'dropwizard-opentracing', version: '0.2.2') {
transitive = false

View File

@ -37,7 +37,7 @@ dependencies {
testCompile group: 'io.vertx', name: 'vertx-circuit-breaker', version: vertxVersion
testCompile group: 'io.vertx', name: 'vertx-rx-java2', version: vertxVersion
testCompile 'org.hsqldb:hsqldb:2.3.4'
testCompile deps.opentelemetryApiAutoAnnotations
// Vert.x 4.0 is incompatible with our tests.
latestDepTestCompile group: 'io.vertx', name: 'vertx-web', version: '3.+'

View File

@ -3,9 +3,11 @@ apply from: "$rootDir/gradle/java.gradle"
description = 'smoke-tests'
dependencies {
compile deps.spock
compile project(':testing')
compile project(':auto-exporters:opentelemetry-auto-exporter-logging')
api deps.spock
api project(':testing')
implementation project(':auto-exporters:opentelemetry-auto-exporter-logging')
implementation deps.slf4j
}
subprojects { subProject ->

View File

@ -15,43 +15,47 @@ excludedClassesCoverage += [
]
dependencies {
compile deps.opentelemetryApi
compile(project(path: ':opentelemetry-sdk-shaded-for-testing', configuration: 'shadow'))
compile deps.bytebuddy
compile deps.bytebuddyagent
compile deps.slf4j
compile deps.spock
compile deps.testLogging
compile deps.guava
api(project(path: ':opentelemetry-sdk-shaded-for-testing', configuration: 'shadow'))
implementation deps.opentelemetryApi
implementation deps.bytebuddy
implementation deps.bytebuddyagent
implementation deps.slf4j
implementation deps.spock
implementation deps.testLogging
implementation deps.guava
// okhttp 3.12.x is the last version to support Java7
compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.12.12'
compile group: 'com.squareup.okhttp3', name: 'logging-interceptor', version: '3.12.12'
api group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.12.12'
api group: 'com.squareup.okhttp3', name: 'logging-interceptor', version: '3.12.12'
compile group: 'org.eclipse.jetty', name: 'jetty-server', version: '8.0.0.v20110901'
//TODO replace with Servlet API?
implementation group: 'org.eclipse.jetty', name: 'jetty-server', version: '8.0.0.v20110901'
compile(project(':auto-tooling')) {
implementation(project(':auto-bootstrap'))
implementation(project(':auto-tooling')) {
// including :opentelemetry-sdk-shaded-for-testing above instead
exclude group: 'io.opentelemetry', module: 'opentelemetry-sdk'
}
compile project(':utils:test-utils')
api project(':utils:test-utils')
annotationProcessor deps.autoservice
implementation deps.autoservice
compile deps.groovy
implementation deps.groovy
testCompile project(':utils:test-utils')
testCompile project(':instrumentation:trace-annotation')
testImplementation project(':instrumentation:trace-annotation')
testCompile('io.opentracing.contrib.dropwizard:dropwizard-opentracing:0.2.2') {
//TODO replace with Otel WithSpan
testImplementation('io.opentracing.contrib.dropwizard:dropwizard-opentracing:0.2.2') {
// bringing this in has side effects and causes some tests to fail
exclude group: 'io.dropwizard', module: 'dropwizard-core'
}
testCompile group: 'cglib', name: 'cglib', version: '3.2.5'
testImplementation group: 'cglib', name: 'cglib', version: '3.2.5'
// test instrumenting java 1.1 bytecode
testCompile group: 'net.sf.jt400', name: 'jt400', version: '6.1'
//TODO do we want this?
testImplementation group: 'net.sf.jt400', name: 'jt400', version: '6.1'
// We have autoservices defined in test subtree, looks like we need this to be able to properly rebuild this
testAnnotationProcessor deps.autoservice

View File

@ -6,7 +6,7 @@ excludedClassesCoverage += [
]
dependencies {
compile deps.slf4j
implementation deps.slf4j
testCompile project(':utils:test-utils')
testImplementation project(':utils:test-utils')
}