Skip to content

Commit 7e67a9f

Browse files
authored
Pin japicmp baseline in version.gradle.kts (atomic with apidiff snapshots) (#18391)
1 parent 47d8391 commit 7e67a9f

3 files changed

Lines changed: 12 additions & 14 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ jobs:
250250
PRIOR_VERSION: ${{ needs.release.outputs.prior-version }}
251251
run: |
252252
./gradlew japicmp -PapiBaseVersion=$PRIOR_VERSION -PapiNewVersion=$VERSION
253+
# Pin the apidiff baseline to the just-released version.
254+
sed -i "s/^val apidiffBaselineVersion = .*/val apidiffBaselineVersion = \"$VERSION\"/" version.gradle.kts
253255
./gradlew --refresh-dependencies japicmp
254256
255257
- name: Use CLA approved bot
@@ -274,6 +276,7 @@ jobs:
274276
git checkout -b $branch
275277
git add CHANGELOG.md
276278
git add docs/apidiffs
279+
git add version.gradle.kts
277280
git commit -m "$message"
278281
git push --set-upstream origin $branch
279282
gh pr create --title "$message" \

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,12 @@ 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 version.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-
// pick the bom, since we don't use dependency substitution on it.
21-
dependencies.add(temp.name, "io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:latest.release")
22-
val moduleVersion = configurations["tempConfig"].resolvedConfiguration.firstLevelModuleDependencies.elementAt(0).moduleVersion
23-
24-
configurations.remove(temp)
25-
logger.info("Discovered latest release version: $moduleVersion")
26-
moduleVersion
27-
}
18+
val apidiffBaselineVersion: String =
19+
rootProject.extra["apidiffBaselineVersion"] as String
2820

2921
/**
3022
* Locate the project's artifact of a particular version.
@@ -68,7 +60,7 @@ if (project.findProperty("otel.stable") == "true" && project.path != ":javaagent
6860

6961
// the japicmp "old" version is either the user-specified one, or the latest release.
7062
val apiBaseVersion: String? by project
71-
val baselineVersion = apiBaseVersion ?: latestReleasedVersion
63+
val baselineVersion = apiBaseVersion ?: apidiffBaselineVersion
7264
oldClasspath.from(
7365
try {
7466
files(findArtifact(baselineVersion))

version.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
val stableVersion = "2.28.0-SNAPSHOT"
22
val alphaVersion = "2.28.0-alpha-SNAPSHOT"
33

4+
val apidiffBaselineVersion = "2.27.0"
5+
46
allprojects {
57
if (findProperty("otel.stable") != "true") {
68
version = alphaVersion
79
} else {
810
version = stableVersion
911
}
12+
extra["apidiffBaselineVersion"] = apidiffBaselineVersion
1013
}

0 commit comments

Comments
 (0)