Skip to content

Commit

Permalink
upgrade jackson, shaded, gradle versions (#395)
Browse files Browse the repository at this point in the history
* initial attempt to upgrade jackson, shaded, gradle versions

* build: experiment

* update plugin version

* cleanup

* cleanup

* shade snakeyaml and jackson

---------

Co-authored-by: Aaron Steinfeld <aaron@traceable.ai>
  • Loading branch information
shashank11p and aaron-steinfeld authored Dec 13, 2023
1 parent bf443ae commit 2a24d17
Show file tree
Hide file tree
Showing 31 changed files with 145 additions and 150 deletions.
136 changes: 57 additions & 79 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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<JavaPluginExtension> {
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<JavaCompile>("compileJava") {
options.compilerArgs.add("-Werror")
}


tasks.withType<JavaCompile> {
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<JavaPlugin>()
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<org.hypertrace.gradle.publishing.HypertracePublishMavenCentralExtension> {
repoName.set("javaagent")
license.set(APACHE_2_0)
}
tasks.named<Test>("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<org.hypertrace.gradle.publishing.HypertracePublishMavenCentralExtension> {
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
}
14 changes: 10 additions & 4 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/groovy/MuzzlePlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ class MuzzlePlugin implements Plugin<Project> {
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
Expand Down
1 change: 0 additions & 1 deletion gradle/java.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jar {
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
url "https://repo.typesafe.com/typesafe/releases"
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion instrumentation/apache-httpasyncclient-4.1/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id("io.opentelemetry.instrumentation.auto-instrumentation")
muzzle
}
evaluationDependsOn(":javaagent-tooling")

muzzle {
pass {
Expand All @@ -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()
}

Expand Down
3 changes: 2 additions & 1 deletion instrumentation/apache-httpclient-4.0/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}

Expand Down
51 changes: 28 additions & 23 deletions instrumentation/grpc-1.6/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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()
}

Expand All @@ -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<String, String> by extra
Expand All @@ -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 {
Expand All @@ -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")
}
Expand All @@ -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")) {
Expand All @@ -136,7 +141,7 @@ for (version in listOf("1.30.0")) {
}
val versionedTest = task<Test>("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) }
Expand Down
4 changes: 3 additions & 1 deletion instrumentation/grpc-shaded-netty-1.9/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ plugins {
muzzle
}

evaluationDependsOn(":javaagent-tooling")

muzzle {
pass {
group = "io.grpc"
Expand All @@ -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()
}

Expand Down
Loading

0 comments on commit 2a24d17

Please sign in to comment.