Skip to content

Commit b2e8446

Browse files
authored
adjust artifact coordinates for nested instrumentations (open-telemetry#791)
1 parent ae83d01 commit b2e8446

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

buildSrc/src/main/kotlin/otel.publish-conventions.gradle.kts

+5-2
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,17 @@ afterEvaluate {
8282
fun computeArtifactId(): String {
8383
val path = project.path
8484
if (!path.contains("instrumentation")) {
85-
// Return default artifacId for non auto-instrumentation publications.
85+
// Return default artifactId for non auto-instrumentation publications.
8686
return project.name
8787
}
8888

8989
// Adding library name to its related auto-instrumentation subprojects.
9090
// For example, prepending "okhttp-3.0-" to both the "library" and "agent" subprojects inside the "okhttp-3.0" folder.
9191
val match = Regex("[^:]+:[^:]+\$").find(path)
92-
val artifactId = match!!.value.replace(":", "-")
92+
var artifactId = match!!.value.replace(":", "-")
93+
if ( !artifactId.startsWith("instrumentation-")){
94+
artifactId = "instrumentation-$artifactId"
95+
}
9396

9497
logger.debug("Using artifact id: '{}' for subproject: '{}'", artifactId, path)
9598
return artifactId

0 commit comments

Comments
 (0)