Skip to content

Commit

Permalink
Publish shaded OpenTelemetry API and annotations for muzzle (#3555)
Browse files Browse the repository at this point in the history
* Publish shaded OpenTelemetry API and annotations for muzzle

* code review
  • Loading branch information
Mateusz Rzeszutek authored Jul 14, 2021
1 parent c1b5c08 commit 229d8ad
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,15 @@ fun inverseOf(muzzleDirective: MuzzleDirective, system: RepositorySystem, sessio
val inverseDirectives = mutableSetOf<MuzzleDirective>()

val allVersionsArtifact = DefaultArtifact(
muzzleDirective.group.get(), muzzleDirective.module.get(), "jar", "[,)")
muzzleDirective.group.get(),
muzzleDirective.module.get(),
muzzleDirective.classifier.get(),
"jar",
"[,)")
val directiveArtifact = DefaultArtifact(
muzzleDirective.group.get(),
muzzleDirective.module.get(),
muzzleDirective.classifier.get(),
"jar",
muzzleDirective.versions.get())

Expand All @@ -294,6 +299,7 @@ fun inverseOf(muzzleDirective: MuzzleDirective, system: RepositorySystem, sessio
val inverseDirective = objects.newInstance(MuzzleDirective::class).apply {
group.set(muzzleDirective.group)
module.set(muzzleDirective.module)
classifier.set(muzzleDirective.classifier)
versions.set(version)
assertPass.set(!muzzleDirective.assertPass.get())
excludedDependencies.set(muzzleDirective.excludedDependencies)
Expand Down Expand Up @@ -325,6 +331,7 @@ fun muzzleDirectiveToArtifacts(muzzleDirective: MuzzleDirective, system: Reposit
val directiveArtifact: Artifact = DefaultArtifact(
muzzleDirective.group.get(),
muzzleDirective.module.get(),
muzzleDirective.classifier.get(),
"jar",
muzzleDirective.versions.get())

Expand All @@ -339,6 +346,7 @@ fun muzzleDirectiveToArtifacts(muzzleDirective: MuzzleDirective, system: Reposit
DefaultArtifact(
muzzleDirective.group.get(),
muzzleDirective.module.get(),
muzzleDirective.classifier.get(),
"jar",
it)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ abstract class MuzzleDirective {
abstract val name: Property<String>
abstract val group: Property<String>
abstract val module: Property<String>
abstract val classifier: Property<String>
abstract val versions: Property<String>
abstract val skipVersions: SetProperty<String>
abstract val additionalDependencies: ListProperty<String>
Expand All @@ -25,6 +26,7 @@ abstract class MuzzleDirective {

init {
name.convention("")
classifier.convention("")
skipVersions.convention(emptySet())
additionalDependencies.convention(listOf())
excludedDependencies.convention(listOf())
Expand Down Expand Up @@ -88,6 +90,9 @@ abstract class MuzzleDirective {
.append(module.get())
.append(':')
.append(versions.get())
if (classifier.isPresent) {
sb.append(':').append(classifier.get())
}
}
return sb.toString()
}
Expand Down
7 changes: 4 additions & 3 deletions buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ plugins {
val otelJava = extensions.create<OtelJavaExtension>("otelJava")

afterEvaluate {
val previousBaseArchiveName = base.archivesName.get()
if (findProperty("mavenGroupId") == "io.opentelemetry.javaagent.instrumentation") {
base.archivesName.set("opentelemetry-javaagent-${base.archivesName.get()}")
} else {
base.archivesName.set("opentelemetry-${base.archivesName.get()}")
base.archivesName.set("opentelemetry-javaagent-$previousBaseArchiveName")
} else if (!previousBaseArchiveName.startsWith("opentelemetry-")) {
base.archivesName.set("opentelemetry-$previousBaseArchiveName")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ plugins {
id("otel.javaagent-instrumentation")
}

// TODO: add muzzle once 1.4.0 is released

val versions: Map<String, String> by project

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ plugins {
id("otel.javaagent-instrumentation")
}

// TODO: add muzzle once 1.4.0 is released

dependencies {
// this instrumentation needs to be able to reference both the OpenTelemetry API
// that is shaded in the bootstrap class loader (for sending telemetry to the agent),
Expand Down
4 changes: 4 additions & 0 deletions opentelemetry-api-shaded-for-instrumenting/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ plugins {
id("com.github.johnrengelman.shadow")

id("otel.java-conventions")
id("otel.publish-conventions")
}

description = "opentelemetry-api shaded for internal javaagent usage"
group = "io.opentelemetry.javaagent"

dependencies {
implementation("io.opentelemetry:opentelemetry-api")
implementation("io.opentelemetry:opentelemetry-api-metrics")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ plugins {
id("com.github.johnrengelman.shadow")

id("otel.java-conventions")
id("otel.publish-conventions")
}

description = "opentelemetry-extension-annotations shaded for internal javaagent usage"
group = "io.opentelemetry.javaagent"

dependencies {
implementation("io.opentelemetry:opentelemetry-extension-annotations")
implementation("io.opentelemetry:opentelemetry-context")
Expand Down

0 comments on commit 229d8ad

Please sign in to comment.