Skip to content

Commit 2a24d17

Browse files
upgrade jackson, shaded, gradle versions (#395)
* initial attempt to upgrade jackson, shaded, gradle versions * build: experiment * update plugin version * cleanup * cleanup * shade snakeyaml and jackson --------- Co-authored-by: Aaron Steinfeld <[email protected]>
1 parent bf443ae commit 2a24d17

File tree

31 files changed

+145
-150
lines changed

31 files changed

+145
-150
lines changed

build.gradle.kts

Lines changed: 57 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,83 @@
11
import org.hypertrace.gradle.publishing.License.APACHE_2_0;
22

33
plugins {
4-
`java-library`
5-
id("com.diffplug.spotless") version "5.2.0" apply false
6-
id("org.hypertrace.publish-maven-central-plugin") version "1.0.4" apply false
7-
id("org.hypertrace.ci-utils-plugin") version "0.3.0"
8-
id("org.gradle.test-retry") version "1.2.0" apply false
9-
id("org.owasp.dependencycheck") version "7.1.1"
4+
id("com.diffplug.spotless") version "5.2.0" apply false
5+
id("org.hypertrace.publish-maven-central-plugin") version "1.0.6"
6+
id("org.hypertrace.ci-utils-plugin") version "0.3.0"
7+
id("org.gradle.test-retry") version "1.2.0" apply false
8+
id("org.owasp.dependencycheck") version "7.1.1"
109
}
1110

12-
buildscript {
13-
repositories {
14-
mavenCentral()
15-
}
16-
}
17-
18-
allprojects {
19-
apply(plugin="java-library")
20-
java {
21-
sourceCompatibility = JavaVersion.VERSION_1_8
22-
targetCompatibility = JavaVersion.VERSION_1_8
11+
subprojects {
12+
group = "org.hypertrace.agent"
13+
description = "Hypertrace OpenTelemetry Javaagent"
14+
15+
apply(plugin = "java-library")
16+
apply(plugin = "com.diffplug.spotless")
17+
apply(from = "$rootDir/gradle/spotless.gradle")
18+
pluginManager.withPlugin("java-library") {
19+
configure<JavaPluginExtension> {
20+
sourceCompatibility = JavaVersion.VERSION_1_8
21+
targetCompatibility = JavaVersion.VERSION_1_8
2322
}
2423

2524
repositories {
26-
mavenCentral()
25+
mavenCentral()
26+
maven {
27+
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
28+
}
2729
}
2830

29-
tasks.compileJava {
30-
options.compilerArgs.add("-Werror")
31+
tasks.named<JavaCompile>("compileJava") {
32+
options.compilerArgs.add("-Werror")
3133
}
3234

33-
3435
tasks.withType<JavaCompile> {
35-
options.compilerArgs.add("-Xlint:unchecked")
36-
options.isDeprecation = true
37-
options.release.set(8)
36+
options.compilerArgs.add("-Xlint:unchecked")
37+
options.isDeprecation = true
38+
options.release.set(8)
3839
}
39-
}
40-
41-
val testDependencies by configurations.creating {
42-
extendsFrom(configurations.testImplementation.get())
43-
extendsFrom(configurations.testRuntimeOnly.get())
44-
}
45-
46-
subprojects {
47-
group = "org.hypertrace.agent"
48-
description = "Hypertrace OpenTelemetry Javaagent"
4940

50-
extra.set("versions", mapOf(
51-
// when updating these values, some values must also be updated in buildSrc as this map
52-
// cannot be accessed there
53-
"opentelemetry" to "1.24.0",
54-
"opentelemetry_semconv" to "1.24.0-alpha",
55-
"opentelemetry_proto" to "0.11.0-alpha",
56-
"opentelemetry_java_agent" to "1.24.0-alpha",
57-
"opentelemetry_java_agent_all" to "1.24.0",
58-
"opentelemetry_java_agent-tooling" to "1.24.0-alpha",
59-
60-
"opentelemetry_gradle_plugin" to "1.24.0-alpha",
61-
"byte_buddy" to "1.12.10",
62-
"slf4j" to "2.0.7"
63-
))
64-
65-
apply<JavaPlugin>()
66-
apply(plugin = "com.diffplug.spotless")
67-
apply(from = "$rootDir/gradle/spotless.gradle")
68-
69-
repositories {
70-
mavenCentral()
71-
jcenter()
72-
maven {
73-
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
74-
}
41+
dependencies {
42+
add(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "org.junit.jupiter:junit-jupiter-api:5.7.0")
43+
add(JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME, "org.junit.jupiter:junit-jupiter-engine:5.7.0")
44+
add(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "org.junit-pioneer:junit-pioneer:1.0.0")
7545
}
7646

77-
pluginManager.withPlugin("org.hypertrace.publish-maven-central-plugin") {
78-
configure<org.hypertrace.gradle.publishing.HypertracePublishMavenCentralExtension> {
79-
repoName.set("javaagent")
80-
license.set(APACHE_2_0)
81-
}
47+
tasks.named<Test>("test") {
48+
useJUnitPlatform()
49+
reports {
50+
junitXml.isOutputPerTestCase = true
51+
}
8252
}
8353

84-
dependencies {
85-
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0")
86-
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.0")
87-
testImplementation("org.junit-pioneer:junit-pioneer:1.0.0")
88-
}
54+
extra.set("versions", mapOf(
55+
// when updating these values, some values must also be updated in buildSrc as this map
56+
// cannot be accessed there
57+
"opentelemetry" to "1.24.0",
58+
"opentelemetry_semconv" to "1.24.0-alpha",
59+
"opentelemetry_proto" to "0.11.0-alpha",
60+
"opentelemetry_java_agent" to "1.24.0-alpha",
61+
"opentelemetry_java_agent_all" to "1.24.0",
62+
"opentelemetry_java_agent-tooling" to "1.24.0-alpha",
63+
64+
"opentelemetry_gradle_plugin" to "1.24.0-alpha",
65+
"byte_buddy" to "1.12.10",
66+
"slf4j" to "2.0.7"
67+
))
68+
}
8969

90-
tasks {
91-
test {
92-
useJUnitPlatform()
93-
reports {
94-
junitXml.isOutputPerTestCase = true
95-
}
96-
}
70+
pluginManager.withPlugin("org.hypertrace.publish-maven-central-plugin") {
71+
configure<org.hypertrace.gradle.publishing.HypertracePublishMavenCentralExtension> {
72+
repoName.set("javaagent")
73+
license.set(APACHE_2_0)
9774
}
75+
}
9876
}
9977

10078
dependencyCheck {
101-
format = org.owasp.dependencycheck.reporting.ReportGenerator.Format.valueOf("ALL")
79+
format = org.owasp.dependencycheck.reporting.ReportGenerator.Format.valueOf("ALL")
10280
// suppressionFile = "owasp-suppressions.xml"
103-
scanConfigurations.add("runtimeClasspath")
104-
failBuildOnCVSS = 7.0F
81+
scanConfigurations.add("runtimeClasspath")
82+
failBuildOnCVSS = 7.0F
10583
}

buildSrc/build.gradle.kts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,20 @@ repositories {
2424
mavenCentral()
2525
}
2626

27+
tasks {
28+
processResources {
29+
duplicatesStrategy = DuplicatesStrategy.WARN
30+
}
31+
}
32+
2733
dependencies {
28-
implementation(gradleApi())
34+
compileOnly(gradleApi())
2935
implementation(localGroovy())
3036
val otelInstrumentationVersion = "1.24.0-alpha"
3137
implementation("io.opentelemetry.javaagent:opentelemetry-muzzle:$otelInstrumentationVersion")
3238
implementation("io.opentelemetry.instrumentation.muzzle-generation:io.opentelemetry.instrumentation.muzzle-generation.gradle.plugin:$otelInstrumentationVersion")
3339
implementation("io.opentelemetry.instrumentation.muzzle-check:io.opentelemetry.instrumentation.muzzle-check.gradle.plugin:$otelInstrumentationVersion")
34-
implementation("com.github.jengelman.gradle.plugins:shadow:6.0.0")
40+
implementation("com.github.johnrengelman", "shadow","8.1.1")
3541
implementation("org.eclipse.aether", "aether-connector-basic", "1.1.0")
3642
implementation("org.eclipse.aether", "aether-transport-http", "1.1.0")
3743
implementation("org.apache.maven", "maven-aether-provider", "3.3.9")
@@ -40,10 +46,10 @@ dependencies {
4046
implementation("org.ow2.asm", "asm", "9.1")
4147
implementation("org.ow2.asm", "asm-tree", "9.1")
4248
implementation("org.apache.httpcomponents:httpclient:4.5.10")
43-
implementation("net.bytebuddy:byte-buddy-gradle-plugin:1.12.6") {
49+
implementation("net.bytebuddy:byte-buddy-gradle-plugin:1.14.2") {
4450
exclude(group = "net.bytebuddy", module = "byte-buddy")
4551
}
46-
implementation("net.bytebuddy:byte-buddy-dep:1.12.13")
52+
implementation("net.bytebuddy:byte-buddy-dep:1.14.2")
4753

4854
testImplementation("org.spockframework", "spock-core", "1.3-groovy-2.5")
4955
testImplementation("org.codehaus.groovy", "groovy-all", "2.5.8")

buildSrc/src/main/groovy/MuzzlePlugin.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ class MuzzlePlugin implements Plugin<Project> {
5555
static {
5656
RemoteRepository central = new RemoteRepository.Builder("central", "default", "https://repo1.maven.org/maven2/").build()
5757
RemoteRepository sonatype = new RemoteRepository.Builder("sonatype", "default", "https://oss.sonatype.org/content/repositories/releases/").build()
58-
RemoteRepository jcenter = new RemoteRepository.Builder("jcenter", "default", "https://jcenter.bintray.com/").build()
58+
RemoteRepository mavenCentral = new RemoteRepository.Builder("mavenCentral", "default", "https://mavencentral.bintray.com/").build()
5959
RemoteRepository spring = new RemoteRepository.Builder("spring", "default", "https://repo.spring.io/libs-release/").build()
6060
RemoteRepository jboss = new RemoteRepository.Builder("jboss", "default", "https://repository.jboss.org/nexus/content/repositories/releases/").build()
6161
RemoteRepository typesafe = new RemoteRepository.Builder("typesafe", "default", "https://repo.typesafe.com/typesafe/releases").build()
6262
RemoteRepository akka = new RemoteRepository.Builder("akka", "default", "https://dl.bintray.com/akka/maven/").build()
6363
RemoteRepository atlassian = new RemoteRepository.Builder("atlassian", "default", "https://maven.atlassian.com/content/repositories/atlassian-public/").build()
6464
// MUZZLE_REPOS = Arrays.asList(central, sonatype, jcenter, spring, jboss, typesafe, akka, atlassian)
65-
MUZZLE_REPOS = Arrays.asList(central, jcenter, typesafe)
65+
MUZZLE_REPOS = Arrays.asList(central, mavenCentral, typesafe)
6666
}
6767

6868
@Override

gradle/java.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jar {
2727
repositories {
2828
mavenLocal()
2929
mavenCentral()
30-
jcenter()
3130
maven {
3231
url "https://repo.typesafe.com/typesafe/releases"
3332
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

instrumentation/apache-httpasyncclient-4.1/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
id("io.opentelemetry.instrumentation.auto-instrumentation")
55
muzzle
66
}
7+
evaluationDependsOn(":javaagent-tooling")
78

89
muzzle {
910
pass {
@@ -20,7 +21,7 @@ afterEvaluate{
2021
io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project,
2122
sourceSets.main.get(),
2223
io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name,
23-
project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath
24+
files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath)
2425
).configure()
2526
}
2627

instrumentation/apache-httpclient-4.0/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
id("io.opentelemetry.instrumentation.auto-instrumentation")
55
muzzle
66
}
7+
evaluationDependsOn(":javaagent-tooling")
78

89
muzzle {
910
// TODO this check fails, but it passes in OTEL https://github.com/hypertrace/javaagent/issues/144
@@ -32,7 +33,7 @@ afterEvaluate{
3233
io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project,
3334
sourceSets.main.get(),
3435
io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name,
35-
project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath
36+
files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath)
3637
).configure()
3738
}
3839

instrumentation/grpc-1.6/build.gradle.kts

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import com.google.protobuf.gradle.*
1+
import com.google.protobuf.gradle.id
22

33
plugins {
44
`java-library`
55
idea
6-
id("com.google.protobuf") version "0.8.13"
6+
id("com.google.protobuf") version "0.9.4"
77
id("net.bytebuddy.byte-buddy")
88
id("io.opentelemetry.instrumentation.auto-instrumentation")
99
muzzle
1010
}
11+
evaluationDependsOn(":javaagent-tooling")
1112

1213
muzzle {
1314
pass {
@@ -24,7 +25,7 @@ afterEvaluate{
2425
io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project,
2526
sourceSets.main.get(),
2627
io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name,
27-
project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath
28+
files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath)
2829
).configure()
2930
}
3031

@@ -37,23 +38,22 @@ idea {
3738
val testGrpcVersion = "1.30.0"
3839

3940
protobuf {
40-
protoc {
41-
// The artifact spec for the Protobuf Compiler
42-
artifact = "com.google.protobuf:protoc:3.3.0"
41+
protoc {
42+
// The artifact spec for the Protobuf Compiler
43+
artifact = "com.google.protobuf:protoc:3.3.0"
44+
}
45+
plugins {
46+
id("grpc") {
47+
artifact = "io.grpc:protoc-gen-grpc-java:1.6.0"
4348
}
44-
plugins {
45-
id("grpc") {
46-
artifact = "io.grpc:protoc-gen-grpc-java:1.6.0"
47-
}
48-
}
49-
generateProtoTasks {
50-
all().forEach { task ->
51-
task.plugins {
52-
id("grpc") {
53-
}
54-
}
55-
}
49+
}
50+
generateProtoTasks {
51+
all().configureEach {
52+
plugins {
53+
id("grpc")
54+
}
5655
}
56+
}
5757
}
5858

5959
val versions: Map<String, String> by extra
@@ -75,7 +75,8 @@ dependencies {
7575
implementation("javax.annotation:javax.annotation-api:1.3.2")
7676

7777
testImplementation(testFixtures(project(":testing-common")))
78-
testImplementation(project(":instrumentation:grpc-shaded-netty-1.9"))
78+
79+
testImplementation(files(project(":instrumentation:grpc-shaded-netty-1.9").artifacts))
7980

8081
testImplementation("io.grpc:grpc-core:${grpcVersion}") {
8182
version {
@@ -99,11 +100,15 @@ dependencies {
99100
}
100101
}
101102

103+
fun computeSourceSetNameForVersion(input: String): String {
104+
return "test_${input.replace(".","")}"
105+
}
106+
102107
val grpcVersions = listOf(grpcVersion, "1.30.0")
103108

104109
sourceSets {
105110
for (version in grpcVersions) {
106-
create("test_$version") {
111+
create(computeSourceSetNameForVersion(version)) {
107112
dependencies {
108113
implementationConfigurationName("io.grpc:grpc-core:$version")
109114
}
@@ -112,10 +117,10 @@ sourceSets {
112117
}
113118

114119
tasks.compileTestJava {
115-
this.classpath += sourceSets.named("test_$grpcVersion").get().output
120+
this.classpath += sourceSets.named(computeSourceSetNameForVersion(grpcVersion)).get().output
116121
}
117122
tasks.test {
118-
classpath += sourceSets.named("test_$grpcVersion").get().output
123+
classpath += sourceSets.named(computeSourceSetNameForVersion(grpcVersion)).get().output
119124
}
120125

121126
for (version in listOf("1.30.0")) {
@@ -136,7 +141,7 @@ for (version in listOf("1.30.0")) {
136141
}
137142
val versionedTest = task<Test>("test_${version}") {
138143
group = "verification"
139-
classpath = versionedConfiguration + sourceSets.main.get().output + sourceSets.test.get().output + sourceSets.named("test_$version").get().output
144+
classpath = versionedConfiguration + sourceSets.main.get().output + sourceSets.test.get().output + sourceSets.named(computeSourceSetNameForVersion(version)).get().output
140145
useJUnitPlatform()
141146
}
142147
tasks.check { dependsOn(versionedTest) }

instrumentation/grpc-shaded-netty-1.9/build.gradle.kts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ plugins {
55
muzzle
66
}
77

8+
evaluationDependsOn(":javaagent-tooling")
9+
810
muzzle {
911
pass {
1012
group = "io.grpc"
@@ -18,7 +20,7 @@ afterEvaluate{
1820
io.opentelemetry.instrumentation.gradle.bytebuddy.ByteBuddyPluginConfigurator(project,
1921
sourceSets.main.get(),
2022
io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin::class.java.name,
21-
project(":javaagent-tooling").configurations["instrumentationMuzzle"] + configurations.runtimeClasspath
23+
files(project(":javaagent-tooling").configurations["instrumentationMuzzle"], configurations.runtimeClasspath)
2224
).configure()
2325
}
2426

0 commit comments

Comments
 (0)