Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
java
`maven-publish`
signing
id("com.gradleup.shadow")
id("pl.allegro.tech.build.axion-release")
id("io.github.gradle-nexus.publish-plugin")
}
Expand Down Expand Up @@ -63,6 +64,16 @@ tasks.named<Jar>("sourcesJar") {
from(allSources())
}

// produce "-all" jar with a shaded copy of ASM
tasks.shadowJar {
dependsOn(embed)
from(embed.map { zipTree(it) })
relocate("org.objectweb.asm", "datadog.instrument.asm")
}
tasks.assemble {
dependsOn(tasks.shadowJar)
}

publishing {
publications {
create<MavenPublication>("maven") {
Expand All @@ -89,6 +100,16 @@ publishing {
developerConnection = "scm:[email protected]:datadog/dd-instrument-java.git"
url = "https://github.com/datadog/dd-instrument-java"
}
withXml {
// mark ASM dependency as optional
var doc = asElement().ownerDocument
var deps = doc.getElementsByTagName("dependency")
for (i in 0 ..< deps.length) {
var optional = doc.createElement("optional")
optional.textContent = "true"
deps.item(i).appendChild(optional)
}
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ repositories {
dependencies {
// needed to re-use the 'libs' version catalog between the main project and buildSrc
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
implementation(libs.shadow)
implementation(libs.spotless)
implementation(libs.spotbugs)
implementation(libs.axion.release)
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[versions]
asm = "9.9"
shadow = "9.2.2"
junit-jupiter = "5.13.4"
junit-platform = "1.13.4"
assertj = "3.27.5"
Expand All @@ -12,6 +13,7 @@ jmh-plugin = "0.7.3"

[libraries]
asm = { module = "org.ow2.asm:asm", version.ref = "asm" }
shadow = { module = "com.gradleup.shadow:shadow-gradle-plugin", version.ref = "shadow" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
junit-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-platform" }
assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" }
Expand Down