Skip to content

Commit 72523f0

Browse files
committed
Remove -alpha suffix from opentelemetry-semconv artifact
1 parent 723e435 commit 72523f0

File tree

6 files changed

+39
-33
lines changed

6 files changed

+39
-33
lines changed

build.gradle.kts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,21 @@ val schemaUrlVersions = listOf(
2222
"1.23.1",
2323
"1.22.0")
2424

25-
// Compute the artifact version, which includes the "-alpha" suffix and includes "-SNAPSHOT" suffix if not releasing
26-
// Release example: version=1.21.0-alpha
27-
// Snapshot example: version=1.21.0-alpha-SNAPSHOT
28-
var releaseVersion = semanticConventionsVersion + "-alpha"
29-
if (snapshot) {
30-
releaseVersion += "-SNAPSHOT"
31-
}
32-
3325
allprojects {
34-
version = releaseVersion
26+
// Compute the artifact version.
27+
// Include the "-alpha" suffix if the artifact contains a gradle.properties file with contents "otel.release=alpha".
28+
// Include the "-SNAPSHOT" suffix if not releasing.
29+
// Release example: 1.21.0 OR 1.21.0-alpha
30+
// Snapshot example: 1.21.0-SNAPSHOT OR 1.21.0-alpha-SNAPSHOT
31+
var ver = semanticConventionsVersion
32+
val release = findProperty("otel.release")
33+
if (release != null) {
34+
ver += "-" + release
35+
}
36+
if (snapshot) {
37+
ver += "-SNAPSHOT"
38+
}
39+
version = ver
3540
}
3641

3742
nexusPublishing {

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

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
import japicmp.model.JApiChangeStatus
2-
import japicmp.model.JApiClass
3-
import japicmp.model.JApiCompatibility
4-
import japicmp.model.JApiCompatibilityChange
5-
import japicmp.model.JApiMethod
1+
import japicmp.model.*
62
import me.champeau.gradle.japicmp.JapicmpTask
73
import me.champeau.gradle.japicmp.report.Violation
8-
import me.champeau.gradle.japicmp.report.stdrules.AbstractRecordingSeenMembers
9-
import me.champeau.gradle.japicmp.report.stdrules.BinaryIncompatibleRule
10-
import me.champeau.gradle.japicmp.report.stdrules.RecordSeenMembersSetup
11-
import me.champeau.gradle.japicmp.report.stdrules.SourceCompatibleRule
12-
import me.champeau.gradle.japicmp.report.stdrules.UnchangedMemberRule
4+
import me.champeau.gradle.japicmp.report.stdrules.*
135

146

157
plugins {
@@ -34,7 +26,7 @@ val latestReleasedVersion: String by lazy {
3426
class SourceIncompatibleRule : AbstractRecordingSeenMembers() {
3527
override fun maybeAddViolation(member: JApiCompatibility): Violation? {
3628
if (!member.isSourceCompatible()) {
37-
return Violation.error(member, "Not source compatible")
29+
return Violation.error(member, "Not source compatible: $member")
3830
}
3931
return null
4032
}
@@ -52,7 +44,7 @@ fun findArtifact(version: String): File {
5244
val depModule = "io.opentelemetry.semconv:${base.archivesName.get()}:$version@jar"
5345
val depJar = "${base.archivesName.get()}-$version.jar"
5446
val configuration: Configuration = configurations.detachedConfiguration(
55-
dependencies.create(depModule),
47+
dependencies.create(depModule),
5648
)
5749
return files(configuration.files).filter {
5850
it.name.equals(depJar)
@@ -72,7 +64,7 @@ if (!project.hasProperty("otel.release")) {
7264
// the japicmp "new" version is either the user-specified one, or the locally built jar.
7365
val apiNewVersion: String? by project
7466
val newArtifact = apiNewVersion?.let { findArtifact(it) }
75-
?: file(getByName<Jar>("jar").archiveFile)
67+
?: file(getByName<Jar>("jar").archiveFile)
7668
newClasspath.from(files(newArtifact))
7769

7870
// only output changes, not everything
@@ -82,19 +74,21 @@ if (!project.hasProperty("otel.release")) {
8274
val apiBaseVersion: String? by project
8375
val baselineVersion = apiBaseVersion ?: latestReleasedVersion
8476
oldClasspath.from(
85-
try {
86-
files(findArtifact(baselineVersion))
87-
} catch (e: Exception) {
88-
// if we can't find the baseline artifact, this is probably one that's never been published before,
89-
// so publish the whole API. We do that by flipping this flag, and comparing the current against nothing.
90-
onlyModified.set(false)
91-
files()
92-
},
77+
try {
78+
files(findArtifact(baselineVersion))
79+
} catch (e: Exception) {
80+
// if we can't find the baseline artifact, this is probably one that's never been published before,
81+
// so publish the whole API. We do that by flipping this flag, and comparing the current against nothing.
82+
onlyModified.set(false)
83+
files()
84+
},
9385
)
9486

9587
// Reproduce defaults from https://github.com/melix/japicmp-gradle-plugin/blob/09f52739ef1fccda6b4310cf3f4b19dc97377024/src/main/java/me/champeau/gradle/japicmp/report/ViolationsGenerator.java#L130
9688
// with some changes.
9789
val exclusions = mutableListOf<String>()
90+
// Generics are not detected correctly
91+
exclusions.add("CLASS_GENERIC_TEMPLATE_CHANGED")
9892
// Allow new default methods on interfaces
9993
exclusions.add("METHOD_NEW_DEFAULT")
10094
// Allow adding default implementations for default methods
@@ -115,7 +109,11 @@ if (!project.hasProperty("otel.release")) {
115109

116110
// this is needed so that we only consider the current artifact, and not dependencies
117111
ignoreMissingClasses.set(true)
118-
packageExcludes.addAll("*.internal", "*.internal.*")
112+
val baseVersionString = if (apiBaseVersion == null) "latest" else baselineVersion
113+
txtOutputFile.set(
114+
apiNewVersion?.let { file("$rootDir/docs/apidiffs/${apiNewVersion}_vs_$baselineVersion/${base.archivesName.get()}.txt") }
115+
?: file("$rootDir/docs/apidiffs/current_vs_$baseVersionString/${base.archivesName.get()}.txt"),
116+
)
119117
}
120118
// have the check task depend on the api comparison task, to make it more likely it will get used.
121119
named("check") {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
plugins {
22
`maven-publish`
33
signing
4+
5+
id("otel.japicmp-conventions")
46
}
57

68
publishing {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Comparing source compatibility of opentelemetry-semconv-1.29.0-SNAPSHOT.jar against opentelemetry-semconv-1.29.0-alpha.jar
2+
No changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
otel.release=alpha

semconv/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
plugins {
22
id("otel.java-conventions")
33
id("otel.publish-conventions")
4-
// TODO: re-enable japicmp when artifact is stable
5-
// id("otel.japicmp-conventions")
64

75
id("otel.animalsniffer-conventions")
86
}

0 commit comments

Comments
 (0)