File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ plugins {
22 java
33 `maven- publish`
44 signing
5+ id(" com.gradleup.shadow" )
56 id(" pl.allegro.tech.build.axion-release" )
67 id(" io.github.gradle-nexus.publish-plugin" )
78}
@@ -63,6 +64,16 @@ tasks.named<Jar>("sourcesJar") {
6364 from(allSources())
6465}
6566
67+ // produce "-all" jar with a shaded copy of ASM
68+ tasks.shadowJar {
69+ dependsOn(embed)
70+ from(embed.map { zipTree(it) })
71+ relocate(" org.objectweb.asm" , " datadog.instrument.asm" )
72+ }
73+ tasks.assemble {
74+ dependsOn(tasks.shadowJar)
75+ }
76+
6677publishing {
6778 publications {
6879 create<MavenPublication >(" maven" ) {
@@ -89,6 +100,16 @@ publishing {
89100 developerConnection
= " scm:[email protected] :datadog/dd-instrument-java.git" 90101 url = " https://github.com/datadog/dd-instrument-java"
91102 }
103+ withXml {
104+ // mark ASM dependency as optional
105+ var doc = asElement().ownerDocument
106+ var deps = doc.getElementsByTagName(" dependency" )
107+ for (i in 0 .. < deps.length) {
108+ var optional = doc.createElement(" optional" )
109+ optional.textContent = " true"
110+ deps.item(i).appendChild(optional)
111+ }
112+ }
92113 }
93114 }
94115 }
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ repositories {
99dependencies {
1010 // needed to re-use the 'libs' version catalog between the main project and buildSrc
1111 implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
12+ implementation(libs.shadow)
1213 implementation(libs.spotless)
1314 implementation(libs.spotbugs)
1415 implementation(libs.axion.release)
Original file line number Diff line number Diff line change 11[versions ]
22asm = " 9.8"
3+ shadow = " 9.2.2"
34junit-jupiter = " 5.13.4"
45junit-platform = " 1.13.4"
56assertj = " 3.27.5"
@@ -12,6 +13,7 @@ jmh-plugin = "0.7.3"
1213
1314[libraries ]
1415asm = { module = " org.ow2.asm:asm" , version.ref = " asm" }
16+ shadow = { module = " com.gradleup.shadow:shadow-gradle-plugin" , version.ref = " shadow" }
1517junit-jupiter = { module = " org.junit.jupiter:junit-jupiter" , version.ref = " junit-jupiter" }
1618junit-launcher = { module = " org.junit.platform:junit-platform-launcher" , version.ref = " junit-platform" }
1719assertj-core = { module = " org.assertj:assertj-core" , version.ref = " assertj" }
You can’t perform that action at this time.
0 commit comments