Skip to content

Commit 2a9875b

Browse files
authored
Pin japicmp baseline with apidiff snapshots (#527)
1 parent 1e40956 commit 2a9875b

3 files changed

Lines changed: 11 additions & 13 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,11 @@ jobs:
188188
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
189189
run: |
190190
./gradlew japicmp -PapiBaseVersion=$PRIOR_VERSION -PapiNewVersion=$VERSION
191+
# Pin the apidiff baseline to the just-released version.
192+
sed -i "s/^val apidiffBaselineVersion = .*/val apidiffBaselineVersion = \"$VERSION\"/" build.gradle.kts
191193
./gradlew --refresh-dependencies japicmp
192194
git add docs/apidiffs
195+
git add build.gradle.kts
193196
194197
- name: Use CLA approved bot
195198
run: .github/scripts/use-cla-approved-bot.sh

build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ plugins {
1010
// start - updated by ./.github/workflows/prepare-release-branch.yml
1111
val snapshot = true
1212
// end
13+
val apidiffBaselineVersion = "1.43.0"
1314

1415
// The release version of https://github.com/open-telemetry/semantic-conventions used to generate classes
1516
var semanticConventionsVersion = "1.43.0"
@@ -51,6 +52,7 @@ allprojects {
5152
ver += "-SNAPSHOT"
5253
}
5354
version = ver
55+
extra["apidiffBaselineVersion"] = apidiffBaselineVersion
5456
}
5557

5658
nexusPublishing {

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

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,11 @@ plugins {
1111
}
1212

1313
/**
14-
* The latest *released* version of the project. Evaluated lazily so the work is only done if necessary.
14+
* The baseline version japicmp compares against. Pinned in build.gradle.kts and bumped
15+
* atomically with docs/apidiffs/current_vs_latest/ by the post-release PR opened from
16+
* .github/workflows/release.yml.
1517
*/
16-
val latestReleasedVersion: String by lazy {
17-
// hack to find the current released version of the project
18-
val temp: Configuration = configurations.create("tempConfig")
19-
temp.resolutionStrategy.cacheDynamicVersionsFor(0, TimeUnit.SECONDS)
20-
dependencies.add(temp.name, "io.opentelemetry.semconv:opentelemetry-semconv:latest.release")
21-
val moduleVersion = configurations["tempConfig"].resolvedConfiguration.firstLevelModuleDependencies.elementAt(0).moduleVersion
22-
configurations.remove(temp)
23-
logger.debug("Discovered latest release version: " + moduleVersion)
24-
moduleVersion
25-
}
18+
val apidiffBaselineVersion = rootProject.extra["apidiffBaselineVersion"] as String
2619

2720
class SourceIncompatibleRule : AbstractRecordingSeenMembers() {
2821
override fun maybeAddViolation(member: JApiCompatibility): Violation? {
@@ -71,9 +64,9 @@ if (!project.hasProperty("otel.release")) {
7164
// only output changes, not everything
7265
onlyModified.set(true)
7366

74-
// the japicmp "old" version is either the user-specified one, or the latest release.
67+
// the japicmp "old" version is either the user-specified one, or the pinned baseline.
7568
val apiBaseVersion: String? by project
76-
val baselineVersion = apiBaseVersion ?: latestReleasedVersion
69+
val baselineVersion = apiBaseVersion ?: apidiffBaselineVersion
7770
oldClasspath.from(
7871
try {
7972
files(findArtifact(baselineVersion))

0 commit comments

Comments
 (0)