diff --git a/build.gradle.kts b/build.gradle.kts index 053698f7c..8b5878178 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,105 +1,83 @@ import org.hypertrace.gradle.publishing.License.APACHE_2_0; plugins { - `java-library` - id("com.diffplug.spotless") version "5.2.0" apply false - id("org.hypertrace.publish-maven-central-plugin") version "1.0.4" apply false - id("org.hypertrace.ci-utils-plugin") version "0.3.0" - id("org.gradle.test-retry") version "1.2.0" apply false - id("org.owasp.dependencycheck") version "7.1.1" + id("com.diffplug.spotless") version "5.2.0" apply false + id("org.hypertrace.publish-maven-central-plugin") version "1.0.6" + id("org.hypertrace.ci-utils-plugin") version "0.3.0" + id("org.gradle.test-retry") version "1.2.0" apply false + id("org.owasp.dependencycheck") version "7.1.1" } -buildscript { - repositories { - mavenCentral() - } -} - -allprojects { - apply(plugin="java-library") - java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 +subprojects { + group = "org.hypertrace.agent" + description = "Hypertrace OpenTelemetry Javaagent" + + apply(plugin = "java-library") + apply(plugin = "com.diffplug.spotless") + apply(from = "$rootDir/gradle/spotless.gradle") + pluginManager.withPlugin("java-library") { + configure { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } repositories { - mavenCentral() + mavenCentral() + maven { + url = uri("https://oss.sonatype.org/content/repositories/snapshots/") + } } - tasks.compileJava { - options.compilerArgs.add("-Werror") + tasks.named("compileJava") { + options.compilerArgs.add("-Werror") } - tasks.withType { - options.compilerArgs.add("-Xlint:unchecked") - options.isDeprecation = true - options.release.set(8) + options.compilerArgs.add("-Xlint:unchecked") + options.isDeprecation = true + options.release.set(8) } -} - -val testDependencies by configurations.creating { - extendsFrom(configurations.testImplementation.get()) - extendsFrom(configurations.testRuntimeOnly.get()) -} - -subprojects { - group = "org.hypertrace.agent" - description = "Hypertrace OpenTelemetry Javaagent" - extra.set("versions", mapOf( - // when updating these values, some values must also be updated in buildSrc as this map - // cannot be accessed there - "opentelemetry" to "1.24.0", - "opentelemetry_semconv" to "1.24.0-alpha", - "opentelemetry_proto" to "0.11.0-alpha", - "opentelemetry_java_agent" to "1.24.0-alpha", - "opentelemetry_java_agent_all" to "1.24.0", - "opentelemetry_java_agent-tooling" to "1.24.0-alpha", - - "opentelemetry_gradle_plugin" to "1.24.0-alpha", - "byte_buddy" to "1.12.10", - "slf4j" to "2.0.7" - )) - - apply() - apply(plugin = "com.diffplug.spotless") - apply(from = "$rootDir/gradle/spotless.gradle") - - repositories { - mavenCentral() - jcenter() - maven { - url = uri("https://oss.sonatype.org/content/repositories/snapshots/") - } + dependencies { + add(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "org.junit.jupiter:junit-jupiter-api:5.7.0") + add(JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME, "org.junit.jupiter:junit-jupiter-engine:5.7.0") + add(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "org.junit-pioneer:junit-pioneer:1.0.0") } - pluginManager.withPlugin("org.hypertrace.publish-maven-central-plugin") { - configure { - repoName.set("javaagent") - license.set(APACHE_2_0) - } + tasks.named("test") { + useJUnitPlatform() + reports { + junitXml.isOutputPerTestCase = true + } } - dependencies { - testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.0") - testImplementation("org.junit-pioneer:junit-pioneer:1.0.0") - } + extra.set("versions", mapOf( + // when updating these values, some values must also be updated in buildSrc as this map + // cannot be accessed there + "opentelemetry" to "1.24.0", + "opentelemetry_semconv" to "1.24.0-alpha", + "opentelemetry_proto" to "0.11.0-alpha", + "opentelemetry_java_agent" to "1.24.0-alpha", + "opentelemetry_java_agent_all" to "1.24.0", + "opentelemetry_java_agent-tooling" to "1.24.0-alpha", + + "opentelemetry_gradle_plugin" to "1.24.0-alpha", + "byte_buddy" to "1.12.10", + "slf4j" to "2.0.7" + )) + } - tasks { - test { - useJUnitPlatform() - reports { - junitXml.isOutputPerTestCase = true - } - } + pluginManager.withPlugin("org.hypertrace.publish-maven-central-plugin") { + configure { + repoName.set("javaagent") + license.set(APACHE_2_0) } + } } dependencyCheck { - format = org.owasp.dependencycheck.reporting.ReportGenerator.Format.valueOf("ALL") + format = org.owasp.dependencycheck.reporting.ReportGenerator.Format.valueOf("ALL") // suppressionFile = "owasp-suppressions.xml" - scanConfigurations.add("runtimeClasspath") - failBuildOnCVSS = 7.0F + scanConfigurations.add("runtimeClasspath") + failBuildOnCVSS = 7.0F } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 8bea75384..684caa445 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -24,14 +24,20 @@ repositories { mavenCentral() } +tasks { + processResources { + duplicatesStrategy = DuplicatesStrategy.WARN + } +} + dependencies { - implementation(gradleApi()) + compileOnly(gradleApi()) implementation(localGroovy()) val otelInstrumentationVersion = "1.24.0-alpha" implementation("io.opentelemetry.javaagent:opentelemetry-muzzle:$otelInstrumentationVersion") implementation("io.opentelemetry.instrumentation.muzzle-generation:io.opentelemetry.instrumentation.muzzle-generation.gradle.plugin:$otelInstrumentationVersion") implementation("io.opentelemetry.instrumentation.muzzle-check:io.opentelemetry.instrumentation.muzzle-check.gradle.plugin:$otelInstrumentationVersion") - implementation("com.github.jengelman.gradle.plugins:shadow:6.0.0") + implementation("com.github.johnrengelman", "shadow","8.1.1") implementation("org.eclipse.aether", "aether-connector-basic", "1.1.0") implementation("org.eclipse.aether", "aether-transport-http", "1.1.0") implementation("org.apache.maven", "maven-aether-provider", "3.3.9") @@ -40,10 +46,10 @@ dependencies { implementation("org.ow2.asm", "asm", "9.1") implementation("org.ow2.asm", "asm-tree", "9.1") implementation("org.apache.httpcomponents:httpclient:4.5.10") - implementation("net.bytebuddy:byte-buddy-gradle-plugin:1.12.6") { + implementation("net.bytebuddy:byte-buddy-gradle-plugin:1.14.2") { exclude(group = "net.bytebuddy", module = "byte-buddy") } - implementation("net.bytebuddy:byte-buddy-dep:1.12.13") + implementation("net.bytebuddy:byte-buddy-dep:1.14.2") testImplementation("org.spockframework", "spock-core", "1.3-groovy-2.5") testImplementation("org.codehaus.groovy", "groovy-all", "2.5.8") diff --git a/buildSrc/src/main/groovy/MuzzlePlugin.groovy b/buildSrc/src/main/groovy/MuzzlePlugin.groovy index 85a20728d..3b1804587 100644 --- a/buildSrc/src/main/groovy/MuzzlePlugin.groovy +++ b/buildSrc/src/main/groovy/MuzzlePlugin.groovy @@ -55,14 +55,14 @@ class MuzzlePlugin implements Plugin { static { RemoteRepository central = new RemoteRepository.Builder("central", "default", "https://repo1.maven.org/maven2/").build() RemoteRepository sonatype = new RemoteRepository.Builder("sonatype", "default", "https://oss.sonatype.org/content/repositories/releases/").build() - RemoteRepository jcenter = new RemoteRepository.Builder("jcenter", "default", "https://jcenter.bintray.com/").build() + RemoteRepository mavenCentral = new RemoteRepository.Builder("mavenCentral", "default", "https://mavencentral.bintray.com/").build() RemoteRepository spring = new RemoteRepository.Builder("spring", "default", "https://repo.spring.io/libs-release/").build() RemoteRepository jboss = new RemoteRepository.Builder("jboss", "default", "https://repository.jboss.org/nexus/content/repositories/releases/").build() RemoteRepository typesafe = new RemoteRepository.Builder("typesafe", "default", "https://repo.typesafe.com/typesafe/releases").build() RemoteRepository akka = new RemoteRepository.Builder("akka", "default", "https://dl.bintray.com/akka/maven/").build() RemoteRepository atlassian = new RemoteRepository.Builder("atlassian", "default", "https://maven.atlassian.com/content/repositories/atlassian-public/").build() // MUZZLE_REPOS = Arrays.asList(central, sonatype, jcenter, spring, jboss, typesafe, akka, atlassian) - MUZZLE_REPOS = Arrays.asList(central, jcenter, typesafe) + MUZZLE_REPOS = Arrays.asList(central, mavenCentral, typesafe) } @Override diff --git a/gradle/java.gradle b/gradle/java.gradle index 588429738..38e8b5774 100644 --- a/gradle/java.gradle +++ b/gradle/java.gradle @@ -27,7 +27,6 @@ jar { repositories { mavenLocal() mavenCentral() - jcenter() maven { url "https://repo.typesafe.com/typesafe/releases" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index be52383ef..a59520664 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/instrumentation/apache-httpasyncclient-4.1/build.gradle.kts b/instrumentation/apache-httpasyncclient-4.1/build.gradle.kts index 957743c14..8b186e64b 100644 --- a/instrumentation/apache-httpasyncclient-4.1/build.gradle.kts +++ b/instrumentation/apache-httpasyncclient-4.1/build.gradle.kts @@ -4,6 +4,7 @@ plugins { id("io.opentelemetry.instrumentation.auto-instrumentation") muzzle } +evaluationDependsOn(":javaagent-tooling") muzzle { pass { @@ -20,7 +21,7 @@ afterEvaluate{ io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project, sourceSets.main.get(), io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name, - project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath + files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath) ).configure() } diff --git a/instrumentation/apache-httpclient-4.0/build.gradle.kts b/instrumentation/apache-httpclient-4.0/build.gradle.kts index 0d7cf02e8..d2045c18a 100644 --- a/instrumentation/apache-httpclient-4.0/build.gradle.kts +++ b/instrumentation/apache-httpclient-4.0/build.gradle.kts @@ -4,6 +4,7 @@ plugins { id("io.opentelemetry.instrumentation.auto-instrumentation") muzzle } +evaluationDependsOn(":javaagent-tooling") muzzle { // TODO this check fails, but it passes in OTEL https://github.com/hypertrace/javaagent/issues/144 @@ -32,7 +33,7 @@ afterEvaluate{ io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project, sourceSets.main.get(), io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name, - project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath + files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath) ).configure() } diff --git a/instrumentation/grpc-1.6/build.gradle.kts b/instrumentation/grpc-1.6/build.gradle.kts index 6babfafb1..9a37bec5d 100644 --- a/instrumentation/grpc-1.6/build.gradle.kts +++ b/instrumentation/grpc-1.6/build.gradle.kts @@ -1,13 +1,14 @@ -import com.google.protobuf.gradle.* +import com.google.protobuf.gradle.id plugins { `java-library` idea - id("com.google.protobuf") version "0.8.13" + id("com.google.protobuf") version "0.9.4" id("net.bytebuddy.byte-buddy") id("io.opentelemetry.instrumentation.auto-instrumentation") muzzle } +evaluationDependsOn(":javaagent-tooling") muzzle { pass { @@ -24,7 +25,7 @@ afterEvaluate{ io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project, sourceSets.main.get(), io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name, - project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath + files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath) ).configure() } @@ -37,23 +38,22 @@ idea { val testGrpcVersion = "1.30.0" protobuf { - protoc { - // The artifact spec for the Protobuf Compiler - artifact = "com.google.protobuf:protoc:3.3.0" + protoc { + // The artifact spec for the Protobuf Compiler + artifact = "com.google.protobuf:protoc:3.3.0" + } + plugins { + id("grpc") { + artifact = "io.grpc:protoc-gen-grpc-java:1.6.0" } - plugins { - id("grpc") { - artifact = "io.grpc:protoc-gen-grpc-java:1.6.0" - } - } - generateProtoTasks { - all().forEach { task -> - task.plugins { - id("grpc") { - } - } - } + } + generateProtoTasks { + all().configureEach { + plugins { + id("grpc") + } } + } } val versions: Map by extra @@ -75,7 +75,8 @@ dependencies { implementation("javax.annotation:javax.annotation-api:1.3.2") testImplementation(testFixtures(project(":testing-common"))) - testImplementation(project(":instrumentation:grpc-shaded-netty-1.9")) + + testImplementation(files(project(":instrumentation:grpc-shaded-netty-1.9").artifacts)) testImplementation("io.grpc:grpc-core:${grpcVersion}") { version { @@ -99,11 +100,15 @@ dependencies { } } +fun computeSourceSetNameForVersion(input: String): String { + return "test_${input.replace(".","")}" +} + val grpcVersions = listOf(grpcVersion, "1.30.0") sourceSets { for (version in grpcVersions) { - create("test_$version") { + create(computeSourceSetNameForVersion(version)) { dependencies { implementationConfigurationName("io.grpc:grpc-core:$version") } @@ -112,10 +117,10 @@ sourceSets { } tasks.compileTestJava { - this.classpath += sourceSets.named("test_$grpcVersion").get().output + this.classpath += sourceSets.named(computeSourceSetNameForVersion(grpcVersion)).get().output } tasks.test { - classpath += sourceSets.named("test_$grpcVersion").get().output + classpath += sourceSets.named(computeSourceSetNameForVersion(grpcVersion)).get().output } for (version in listOf("1.30.0")) { @@ -136,7 +141,7 @@ for (version in listOf("1.30.0")) { } val versionedTest = task("test_${version}") { group = "verification" - classpath = versionedConfiguration + sourceSets.main.get().output + sourceSets.test.get().output + sourceSets.named("test_$version").get().output + classpath = versionedConfiguration + sourceSets.main.get().output + sourceSets.test.get().output + sourceSets.named(computeSourceSetNameForVersion(version)).get().output useJUnitPlatform() } tasks.check { dependsOn(versionedTest) } diff --git a/instrumentation/grpc-1.6/src/test_1.30.0/java/io/opentelemetry/javaagent/instrumentation/hypertrace/grpc/v1_6/GrpcChannelProvider.java b/instrumentation/grpc-1.6/src/test_1300/java/io/opentelemetry/javaagent/instrumentation/hypertrace/grpc/v1_6/GrpcChannelProvider.java similarity index 100% rename from instrumentation/grpc-1.6/src/test_1.30.0/java/io/opentelemetry/javaagent/instrumentation/hypertrace/grpc/v1_6/GrpcChannelProvider.java rename to instrumentation/grpc-1.6/src/test_1300/java/io/opentelemetry/javaagent/instrumentation/hypertrace/grpc/v1_6/GrpcChannelProvider.java diff --git a/instrumentation/grpc-1.6/src/test_1.6.0/java/io/opentelemetry/javaagent/instrumentation/hypertrace/grpc/v1_6/GrpcChannelProvider.java b/instrumentation/grpc-1.6/src/test_160/java/io/opentelemetry/javaagent/instrumentation/hypertrace/grpc/v1_6/GrpcChannelProvider.java similarity index 100% rename from instrumentation/grpc-1.6/src/test_1.6.0/java/io/opentelemetry/javaagent/instrumentation/hypertrace/grpc/v1_6/GrpcChannelProvider.java rename to instrumentation/grpc-1.6/src/test_160/java/io/opentelemetry/javaagent/instrumentation/hypertrace/grpc/v1_6/GrpcChannelProvider.java diff --git a/instrumentation/grpc-shaded-netty-1.9/build.gradle.kts b/instrumentation/grpc-shaded-netty-1.9/build.gradle.kts index 2f5398c3e..05926dbcc 100644 --- a/instrumentation/grpc-shaded-netty-1.9/build.gradle.kts +++ b/instrumentation/grpc-shaded-netty-1.9/build.gradle.kts @@ -5,6 +5,8 @@ plugins { muzzle } +evaluationDependsOn(":javaagent-tooling") + muzzle { pass { group = "io.grpc" @@ -18,7 +20,7 @@ afterEvaluate{ io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project, sourceSets.main.get(), io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name, - project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath + files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath) ).configure() } diff --git a/instrumentation/java-streams/build.gradle.kts b/instrumentation/java-streams/build.gradle.kts index 948ede59a..c1a05f636 100644 --- a/instrumentation/java-streams/build.gradle.kts +++ b/instrumentation/java-streams/build.gradle.kts @@ -5,6 +5,8 @@ plugins { muzzle } +evaluationDependsOn(":javaagent-tooling") + muzzle { pass { coreJdk() @@ -15,7 +17,7 @@ afterEvaluate{ io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project, sourceSets.main.get(), io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name, - project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath + files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath) ).configure() } diff --git a/instrumentation/jaxrs-client-2.0/build.gradle.kts b/instrumentation/jaxrs-client-2.0/build.gradle.kts index 2473e2037..a0ffcda8d 100644 --- a/instrumentation/jaxrs-client-2.0/build.gradle.kts +++ b/instrumentation/jaxrs-client-2.0/build.gradle.kts @@ -4,6 +4,7 @@ plugins { id("io.opentelemetry.instrumentation.auto-instrumentation") muzzle } +evaluationDependsOn(":javaagent-tooling") muzzle { pass { @@ -24,7 +25,7 @@ afterEvaluate{ io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project, sourceSets.main.get(), io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name, - project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath + files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath) ).configure() } @@ -42,6 +43,7 @@ dependencies { testImplementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv:${versions["opentelemetry_semconv"]}") testImplementation(project(":instrumentation:apache-httpclient-4.0")) + testImplementation(files(project(":instrumentation:apache-httpclient-4.0").dependencyProject.sourceSets.main.map { it.output })) testImplementation("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-apache-httpclient-4.0:${versions["opentelemetry_java_agent"]}") testImplementation("org.jboss.resteasy:resteasy-client:3.0.5.Final") // ^ This version has timeouts https://issues.redhat.com/browse/RESTEASY-975 diff --git a/instrumentation/netty/netty-4.0/build.gradle.kts b/instrumentation/netty/netty-4.0/build.gradle.kts index e0470460e..f62ddb27d 100644 --- a/instrumentation/netty/netty-4.0/build.gradle.kts +++ b/instrumentation/netty/netty-4.0/build.gradle.kts @@ -5,6 +5,7 @@ plugins { id("io.opentelemetry.instrumentation.auto-instrumentation") muzzle } +evaluationDependsOn(":javaagent-tooling") muzzle { pass { @@ -36,7 +37,7 @@ afterEvaluate{ io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project, sourceSets.main.get(), io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name, - project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath + files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath) ).configure() } diff --git a/instrumentation/netty/netty-4.1/build.gradle.kts b/instrumentation/netty/netty-4.1/build.gradle.kts index e9d416987..50b12c314 100644 --- a/instrumentation/netty/netty-4.1/build.gradle.kts +++ b/instrumentation/netty/netty-4.1/build.gradle.kts @@ -5,6 +5,7 @@ plugins { id("io.opentelemetry.instrumentation.auto-instrumentation") muzzle } +evaluationDependsOn(":javaagent-tooling") muzzle { pass { @@ -36,7 +37,7 @@ afterEvaluate{ io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project, sourceSets.main.get(), io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name, - project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath + files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath) ).configure() } diff --git a/instrumentation/okhttp/okhttp-3.0/build.gradle.kts b/instrumentation/okhttp/okhttp-3.0/build.gradle.kts index 6e2d9e8ce..e91e2aa23 100644 --- a/instrumentation/okhttp/okhttp-3.0/build.gradle.kts +++ b/instrumentation/okhttp/okhttp-3.0/build.gradle.kts @@ -4,6 +4,7 @@ plugins { id("io.opentelemetry.instrumentation.auto-instrumentation") muzzle } +evaluationDependsOn(":javaagent-tooling") muzzle { pass { @@ -18,7 +19,7 @@ afterEvaluate{ io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project, sourceSets.main.get(), io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name, - project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath + files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath) ).configure() } diff --git a/instrumentation/servlet/servlet-3.0/build.gradle.kts b/instrumentation/servlet/servlet-3.0/build.gradle.kts index 0720a6445..31b407f11 100644 --- a/instrumentation/servlet/servlet-3.0/build.gradle.kts +++ b/instrumentation/servlet/servlet-3.0/build.gradle.kts @@ -4,6 +4,7 @@ plugins { id("io.opentelemetry.instrumentation.auto-instrumentation") muzzle } +evaluationDependsOn(":javaagent-tooling") muzzle { pass { @@ -23,7 +24,7 @@ afterEvaluate{ io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project, sourceSets.main.get(), io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name, - project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath + files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath) ).configure() } @@ -40,6 +41,7 @@ dependencies { muzzleBootstrap("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-servlet-common-bootstrap:${versions["opentelemetry_java_agent"]}") testImplementation(project(":instrumentation:servlet:servlet-rw")) + testImplementation(files(project(":instrumentation:servlet:servlet-rw").dependencyProject.sourceSets.main.map { it.output })) testImplementation(testFixtures(project(":testing-common")) as ProjectDependency) { exclude(group = "org.eclipse.jetty", module = "jetty-server") } diff --git a/instrumentation/servlet/servlet-rw/build.gradle.kts b/instrumentation/servlet/servlet-rw/build.gradle.kts index a249d7153..7aabd1cce 100644 --- a/instrumentation/servlet/servlet-rw/build.gradle.kts +++ b/instrumentation/servlet/servlet-rw/build.gradle.kts @@ -4,6 +4,7 @@ plugins { id("io.opentelemetry.instrumentation.auto-instrumentation") muzzle } +evaluationDependsOn(":javaagent-tooling") muzzle { pass { @@ -15,7 +16,7 @@ afterEvaluate{ io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project, sourceSets.main.get(), io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name, - project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath + files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath) ).configure() } diff --git a/instrumentation/spark-2.3/build.gradle.kts b/instrumentation/spark-2.3/build.gradle.kts index 38fed1b05..9561e42f6 100644 --- a/instrumentation/spark-2.3/build.gradle.kts +++ b/instrumentation/spark-2.3/build.gradle.kts @@ -5,6 +5,7 @@ plugins { id("io.opentelemetry.instrumentation.auto-instrumentation") muzzle } +evaluationDependsOn(":javaagent-tooling") // building against 2.3 and testing against 2.4 because JettyHandler is available since 2.4 only muzzle { @@ -19,7 +20,7 @@ afterEvaluate{ io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project, sourceSets.main.get(), io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name, - project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath + files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath) ).configure() } @@ -34,6 +35,7 @@ dependencies { compileOnly("com.sparkjava:spark-core:2.3") testImplementation(project(":instrumentation:servlet:servlet-rw")) + testImplementation(files(project(":instrumentation:servlet:servlet-rw").dependencyProject.sourceSets.main.map { it.output })) testImplementation(testFixtures(project(":testing-common"))) testImplementation("com.sparkjava:spark-core:2.3") testImplementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv:${versions["opentelemetry_semconv"]}") diff --git a/instrumentation/spring/spring-webflux-5.0/build.gradle.kts b/instrumentation/spring/spring-webflux-5.0/build.gradle.kts index 8596cc961..e200a02cf 100644 --- a/instrumentation/spring/spring-webflux-5.0/build.gradle.kts +++ b/instrumentation/spring/spring-webflux-5.0/build.gradle.kts @@ -17,6 +17,7 @@ configurations.testRuntimeClasspath { dependencies { testImplementation(testFixtures(project(":testing-common"))) testImplementation(project(":instrumentation:netty:netty-4.1")) + testImplementation(files(project(":instrumentation:netty:netty-4.1").dependencyProject.sourceSets.main.map { it.output })) testImplementation("org.springframework:spring-webflux:5.0.0.RELEASE") testImplementation("io.projectreactor.ipc:reactor-netty:0.7.0.RELEASE") diff --git a/instrumentation/struts-2.3/build.gradle.kts b/instrumentation/struts-2.3/build.gradle.kts index a02a958cc..e72e7b3cf 100644 --- a/instrumentation/struts-2.3/build.gradle.kts +++ b/instrumentation/struts-2.3/build.gradle.kts @@ -7,7 +7,9 @@ val versions: Map by extra dependencies { testImplementation(project(":instrumentation:servlet:servlet-rw")) + testImplementation(files(project(":instrumentation:servlet:servlet-rw").dependencyProject.sourceSets.main.map { it.output })) testImplementation(project(":instrumentation:servlet:servlet-3.0")) + testImplementation(files(project(":instrumentation:servlet:servlet-3.0").dependencyProject.sourceSets.main.map { it.output })) testImplementation(testFixtures(project(":testing-common")) as ProjectDependency) { exclude(group = "org.eclipse.jetty", module = "jetty-server") } diff --git a/instrumentation/undertow/undertow-1.4/build.gradle.kts b/instrumentation/undertow/undertow-1.4/build.gradle.kts index 06f581558..5234c9c0e 100644 --- a/instrumentation/undertow/undertow-1.4/build.gradle.kts +++ b/instrumentation/undertow/undertow-1.4/build.gradle.kts @@ -4,6 +4,7 @@ plugins { id("io.opentelemetry.instrumentation.auto-instrumentation") muzzle } +evaluationDependsOn(":javaagent-tooling") muzzle { pass { @@ -18,7 +19,7 @@ afterEvaluate{ io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project, sourceSets.main.get(), io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name, - project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath + files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath) ).configure() } diff --git a/instrumentation/undertow/undertow-servlet-1.4/build.gradle.kts b/instrumentation/undertow/undertow-servlet-1.4/build.gradle.kts index a7555d69e..1acf29120 100644 --- a/instrumentation/undertow/undertow-servlet-1.4/build.gradle.kts +++ b/instrumentation/undertow/undertow-servlet-1.4/build.gradle.kts @@ -4,6 +4,7 @@ plugins { id("io.opentelemetry.instrumentation.auto-instrumentation") muzzle } +evaluationDependsOn(":javaagent-tooling") muzzle { pass { @@ -18,7 +19,7 @@ afterEvaluate{ io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project, sourceSets.main.get(), io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name, - project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath + files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath) ).configure() } diff --git a/instrumentation/vertx/vertx-web-3.0/build.gradle.kts b/instrumentation/vertx/vertx-web-3.0/build.gradle.kts index d4267e7a8..a4af0a9aa 100644 --- a/instrumentation/vertx/vertx-web-3.0/build.gradle.kts +++ b/instrumentation/vertx/vertx-web-3.0/build.gradle.kts @@ -4,12 +4,13 @@ plugins { id("io.opentelemetry.instrumentation.auto-instrumentation") muzzle } +evaluationDependsOn(":javaagent-tooling") afterEvaluate{ io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project, sourceSets.main.get(), io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name, - project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath + files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath) ).configure() } @@ -33,6 +34,7 @@ dependencies { testImplementation(testFixtures(project(":testing-common"))) testImplementation(project(":instrumentation:netty:netty-4.0")) + testImplementation(files(project(":instrumentation:netty:netty-4.0").dependencyProject.sourceSets.main.map { it.output })) testImplementation("io.netty:netty-codec-http:${nettyVersion}") { version { diff --git a/javaagent-core/build.gradle.kts b/javaagent-core/build.gradle.kts index e00d1f9d3..bd574bf27 100644 --- a/javaagent-core/build.gradle.kts +++ b/javaagent-core/build.gradle.kts @@ -9,13 +9,5 @@ dependencies { api("io.opentelemetry:opentelemetry-api:${versions["opentelemetry"]}") api("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:${versions["opentelemetry"]}") implementation("org.slf4j:slf4j-api:${versions["slf4j"]}") - implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.4") { - constraints { - implementation("org.yaml:snakeyaml:1.31") { - because( - "SNYK error SNYK-JAVA-ORGYAML-2806360" - ) - } - } - } + implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.16.0") } diff --git a/javaagent-tooling/build.gradle.kts b/javaagent-tooling/build.gradle.kts index 20fe6f63a..255ffe7f5 100644 --- a/javaagent-tooling/build.gradle.kts +++ b/javaagent-tooling/build.gradle.kts @@ -18,7 +18,9 @@ repositories { dependencies { instrumentationMuzzle("io.opentelemetry.javaagent:opentelemetry-muzzle:${versions["opentelemetry_java_agent"]}") api("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:${versions["opentelemetry"]}") - instrumentationMuzzle("io.opentelemetry.instrumentation:gradle-plugins:${versions["opentelemetry_gradle_plugin"]}") + instrumentationMuzzle("io.opentelemetry.instrumentation:gradle-plugins:${versions["opentelemetry_gradle_plugin"]}") { + exclude(group = "gradle.plugin.com.github.johnrengelman", module = "shadow") + } instrumentationMuzzle("io.opentelemetry.javaagent:opentelemetry-javaagent-bootstrap:${versions["opentelemetry_java_agent"]}") instrumentationMuzzle("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api:${versions["opentelemetry_java_agent"]}") instrumentationMuzzle("net.bytebuddy:byte-buddy-dep:1.12.6") diff --git a/javaagent/build.gradle.kts b/javaagent/build.gradle.kts index c2febd5a3..076c41262 100644 --- a/javaagent/build.gradle.kts +++ b/javaagent/build.gradle.kts @@ -39,6 +39,8 @@ tasks { relocate("org.slf4j", "io.opentelemetry.javaagent.slf4j") relocate("java.util.logging.Logger", "io.opentelemetry.javaagent.bootstrap.PatchLogger") + relocate("com.fasterxml.jackson", "io.opentelemetry.javaagent.shaded.org.hypertrace.shaded.com.fasterxml.jackson") + relocate("org.yaml", "io.opentelemetry.javaagent.shaded.org.hypertrace.shaded.org.yaml") // prevents conflict with library instrumentation relocate("io.opentelemetry.instrumentation.api", "io.opentelemetry.javaagent.shaded.instrumentation.api") diff --git a/otel-extensions/build.gradle.kts b/otel-extensions/build.gradle.kts index ec489898b..a752d48cb 100644 --- a/otel-extensions/build.gradle.kts +++ b/otel-extensions/build.gradle.kts @@ -3,7 +3,7 @@ import com.google.protobuf.gradle.* plugins { `java-library` idea - id("com.google.protobuf") version "0.8.13" + id("com.google.protobuf") version "0.9.4" } @@ -59,15 +59,7 @@ dependencies { api("com.google.protobuf:protobuf-java") api("com.google.protobuf:protobuf-java-util") // convert yaml to json, since java protobuf impl supports only json - implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.4") { - constraints { - implementation("org.yaml:snakeyaml:1.31") { - because( - "SNYK error SNYK-JAVA-ORGYAML-2806360" - ) - } - } - } + implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.16.0") // fix vulnerability constraints { api("com.google.code.gson:gson:2.8.9") diff --git a/smoke-tests/build.gradle.kts b/smoke-tests/build.gradle.kts index 80efe02b5..6de59095c 100644 --- a/smoke-tests/build.gradle.kts +++ b/smoke-tests/build.gradle.kts @@ -24,7 +24,7 @@ dependencies{ testImplementation("com.google.protobuf:protobuf-java-util:3.15.8") testImplementation("org.spockframework:spock-core:1.3-groovy-2.5") testImplementation("info.solidsoft.spock:spock-global-unroll:0.5.1") - testImplementation("com.fasterxml.jackson.core:jackson-databind:2.13.4") + testImplementation("com.fasterxml.jackson.core:jackson-databind:2.16.0") testImplementation("org.codehaus.groovy:groovy-all:2.5.11") testImplementation("io.opentelemetry:opentelemetry-semconv:${versions["opentelemetry"]}-alpha") } diff --git a/smoke-tests/matrix/build.gradle b/smoke-tests/matrix/build.gradle index 1e72004aa..bc44a77c5 100644 --- a/smoke-tests/matrix/build.gradle +++ b/smoke-tests/matrix/build.gradle @@ -11,7 +11,7 @@ compileJava { } repositories { - jcenter() + mavenCentral() } dependencies { implementation("javax.servlet:javax.servlet-api:3.0.1") diff --git a/testing-common/build.gradle.kts b/testing-common/build.gradle.kts index 3f4a2f783..a1ccb996c 100644 --- a/testing-common/build.gradle.kts +++ b/testing-common/build.gradle.kts @@ -4,10 +4,6 @@ plugins { id("net.bytebuddy.byte-buddy") } -configurations { - implementation.get().extendsFrom(project(":").configurations["testDependencies"]) -} - val versions: Map by extra dependencies {