Skip to content

Commit 09a6578

Browse files
jack-bergtrask
andauthored
Prepare stable release (#130)
* Remove -alpha suffix from opentelemetry-semconv artifact * Remove deprecated ResourceAttributes, SemanticAttributes * Update japicmp to generate diff for first release * jApiCmp --------- Co-authored-by: Trask Stalnaker <[email protected]>
1 parent dc2c13d commit 09a6578

File tree

8 files changed

+210
-6188
lines changed

8 files changed

+210
-6188
lines changed

build.gradle.kts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,21 @@ val schemaUrlVersions = listOf(
2020
"1.25.0",
2121
"1.24.0")
2222

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

3540
nexusPublishing {

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

Lines changed: 26 additions & 24 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
@@ -81,20 +73,23 @@ if (!project.hasProperty("otel.release")) {
8173
// the japicmp "old" version is either the user-specified one, or the latest release.
8274
val apiBaseVersion: String? by project
8375
val baselineVersion = apiBaseVersion ?: latestReleasedVersion
84-
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-
},
93-
)
76+
// TODO: uncomment after first stable release
77+
// oldClasspath.from(
78+
// try {
79+
// files(findArtifact(baselineVersion))
80+
// } catch (e: Exception) {
81+
// // if we can't find the baseline artifact, this is probably one that's never been published before,
82+
// // so publish the whole API. We do that by flipping this flag, and comparing the current against nothing.
83+
// onlyModified.set(false)
84+
// files()
85+
// },
86+
// )
9487

9588
// Reproduce defaults from https://github.com/melix/japicmp-gradle-plugin/blob/09f52739ef1fccda6b4310cf3f4b19dc97377024/src/main/java/me/champeau/gradle/japicmp/report/ViolationsGenerator.java#L130
9689
// with some changes.
9790
val exclusions = mutableListOf<String>()
91+
// Generics are not detected correctly
92+
exclusions.add("CLASS_GENERIC_TEMPLATE_CHANGED")
9893
// Allow new default methods on interfaces
9994
exclusions.add("METHOD_NEW_DEFAULT")
10095
// Allow adding default implementations for default methods
@@ -115,7 +110,14 @@ if (!project.hasProperty("otel.release")) {
115110

116111
// this is needed so that we only consider the current artifact, and not dependencies
117112
ignoreMissingClasses.set(true)
118-
packageExcludes.addAll("*.internal", "*.internal.*")
113+
// TODO: remove exclusions after first stable release
114+
classExcludes.add("io.opentelemetry.semconv.ResourceAttributes")
115+
classExcludes.add("io.opentelemetry.semconv.SemanticAttributes")
116+
val baseVersionString = if (apiBaseVersion == null) "latest" else baselineVersion
117+
txtOutputFile.set(
118+
apiNewVersion?.let { file("$rootDir/docs/apidiffs/${apiNewVersion}_vs_$baselineVersion/${base.archivesName.get()}.txt") }
119+
?: file("$rootDir/docs/apidiffs/current_vs_$baseVersionString/${base.archivesName.get()}.txt"),
120+
)
119121
}
120122
// have the check task depend on the api comparison task, to make it more likely it will get used.
121123
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 {

0 commit comments

Comments
 (0)