Skip to content

Commit

Permalink
add dependencies + test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainJuge committed Sep 5, 2024
1 parent 0f60e22 commit 720633c
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions jmx-scrapper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,56 @@ description = "JMX metrics scrapper"
otelJava.moduleName.set("io.opentelemetry.contrib.jmxscrapper")

application.mainClass.set("io.opentelemetry.contrib.jmxscrapper.JmxMetrics")

dependencies {
implementation("io.opentelemetry:opentelemetry-api")
implementation("io.opentelemetry:opentelemetry-sdk")
implementation("io.opentelemetry:opentelemetry-sdk-metrics")
implementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure")
implementation("io.opentelemetry:opentelemetry-sdk-testing")

implementation("io.opentelemetry.instrumentation:opentelemetry-jmx-metrics")

}


tasks {
shadowJar {
mergeServiceFiles()

manifest {
attributes["Implementation-Version"] = project.version
}
// This should always be standalone, so remove "-all" to prevent unnecessary artifact.
archiveClassifier.set("")
}

jar {
archiveClassifier.set("noshadow")
}

withType<Test>().configureEach {
dependsOn(shadowJar)
systemProperty("shadow.jar.path", shadowJar.get().archiveFile.get().asFile.absolutePath)
systemProperty("gradle.project.version", "${project.version}")
}

// Because we reconfigure publishing to only include the shadow jar, the Gradle metadata is not correct.
// Since we are fully bundled and have no dependencies, Gradle metadata wouldn't provide any advantage over
// the POM anyways so in practice we shouldn't be losing anything.
withType<GenerateModuleMetadata>().configureEach {
enabled = false
}
}

// Don't publish non-shadowed jar (shadowJar is in shadowRuntimeElements)
with(components["java"] as AdhocComponentWithVariants) {
configurations.forEach {
withVariantsFromConfiguration(configurations["apiElements"]) {
skip()
}
withVariantsFromConfiguration(configurations["runtimeElements"]) {
skip()
}
}
}

0 comments on commit 720633c

Please sign in to comment.