-
Notifications
You must be signed in to change notification settings - Fork 340
Upgrade Shadow plugin to 9.4.2 #11730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| plugins { | ||
| java | ||
| id("com.diffplug.spotless") version "8.4.0" | ||
| id("com.gradleup.shadow") version "8.3.9" | ||
| id("com.gradleup.shadow") version "9.4.2" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Would it make sense to move into catalog, since it used more in one place? |
||
| } | ||
|
|
||
| java { | ||
|
|
@@ -69,7 +69,13 @@ tasks { | |
| } | ||
|
|
||
| shadowJar { | ||
| duplicatesStrategy = DuplicatesStrategy.INCLUDE | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. q: may I know why |
||
| mergeServiceFiles() | ||
| // Service descriptors are intentionally merged by mergeServiceFiles(); let | ||
| // duplicate service entries reach that transformer instead of failing first. | ||
| filesNotMatching("META-INF/services/**") { | ||
| duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
| } | ||
| manifest { | ||
| attributes(mapOf("Main-Class" to "datadog.trace.plugin.csi.PluginApplication")) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| plugins { | ||
| java | ||
| id("com.gradleup.shadow") version "8.3.9" | ||
| id("com.gradleup.shadow") version "9.4.2" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: catalog? |
||
| } | ||
|
|
||
| java { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,4 +34,3 @@ tasks.named("shadowJar", ShadowJar) { | |
| tasks.named("jar", Jar) { | ||
| archiveClassifier = 'unbundled' | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,13 +120,37 @@ if (project.gradle.startParameter.taskNames.any { it.endsWith("generateMuzzleRep | |
|
|
||
| tasks.named('shadowJar', ShadowJar) { | ||
| duplicatesStrategy = DuplicatesStrategy.FAIL | ||
| // Shadow 8.x silently wrote duplicate class (130+) entries into the instrumentation jar. | ||
| // Those duplicate entries did not survive as duplicates in the final agent jar, | ||
| // because `:dd-java-agent:expandAgentShadowJarInst` expands the instrumentation jar | ||
| // with a `Sync` task, and the specific `inst` expansion keeps the first duplicate path. | ||
| // (explicit `duplicatesStrategy = DuplicatesStrategy.EXCLUDE` on the `inst` prefix). | ||
| // | ||
| // Shadow 9 refactored deeply it's "copy" pipeline via https://github.com/GradleUp/shadow/pull/1233 | ||
| // by `Project.zipTree` and can now honor `DuplicatesStrategy`, see in particular | ||
| // * https://github.com/GradleUp/shadow/issues/1223 - Duplicates from jars are not handled per duplicatesStrategy | ||
| // * https://github.com/GradleUp/shadow/issues/488 - DuplicatesStrategy.FAIL doesn't work with transform | ||
| // | ||
| // Keeping `duplicatesStrategy = FAIL` only, Shadow 9 now fails while creating the instrumentation jar. | ||
| filesMatching([ | ||
| // agent-installer also publishes this Java 11 source-set output at runtime. | ||
| 'datadog/trace/agent/tooling/bytebuddy/DDJava9ClassFileTransformer*.class', | ||
| // agent-installer also publishes this Java 25 source-set output at runtime. | ||
| 'datadog/trace/agent/tooling/servicediscovery/MemFDUnixWriterFFM*.class', | ||
| // aggregate instrumentation includes some classes directly and via jars. | ||
| 'datadog/trace/instrumentation/**/*.class', | ||
| // same aggregate duplication, for Java 11 exception profiling advice. | ||
| 'datadog/exceptions/instrumentation/**/*.class', | ||
| ]) { | ||
| duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
| } | ||
|
Comment on lines
+135
to
+146
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: I asked codex to give me the list of the duplicate classes Shadow Instrumentation Duplicate ClassesGenerated from a temporary The verbose origin check showed no meaningful difference between duplicate origins: class-output/runtime-artifact pairs have identical origin hashes, and the servlet5 runtime-artifact/runtime-file-dependency pairs are also identical. The list is therefore grouped by owning module.
|
||
| dependencies { | ||
| // the tracer is now in a separate shadow jar | ||
| exclude(project(":dd-trace-core")) | ||
| exclude(dependency('com.datadoghq:sketches-java')) | ||
| exclude(dependency('com.google.re2j:re2j')) | ||
| deps.excludeShared.execute(it) | ||
| } | ||
| dependencies deps.excludeShared | ||
| } | ||
|
|
||
| // temporary config to add slf4j-simple so we get logging from instrumenters while indexing | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,8 @@ tasks.named("jar", Jar) { | |
| } | ||
|
|
||
| tasks.named("shadowJar", ShadowJar) { | ||
| configurations = [project.configurations.runtimeClasspath] | ||
| configurations.add(project.configurations.named('runtimeClasspath')) | ||
| duplicatesStrategy = DuplicatesStrategy.INCLUDE | ||
| mergeServiceFiles() | ||
| append 'META-INF/spring.handlers' | ||
| append 'META-INF/spring.schemas' | ||
|
|
@@ -26,6 +27,15 @@ tasks.named("shadowJar", ShadowJar) { | |
| paths = ['META-INF/spring.factories'] | ||
| mergeStrategy = "append" | ||
| } | ||
| filesNotMatching([ | ||
| 'META-INF/services/**', | ||
| 'META-INF/spring.handlers', | ||
| 'META-INF/spring.schemas', | ||
| 'META-INF/spring.tooling', | ||
| 'META-INF/spring.factories', | ||
| ]) { | ||
| duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
| } | ||
|
Comment on lines
+30
to
+38
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: this pattern looks like repeating several times, any ideas how to reuse code? |
||
| } | ||
|
|
||
| dependencies { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: catalog?