Skip to content

Commit 96c2914

Browse files
authored
Disable jApiCmp for 1.x (#10293)
1 parent 00b52a9 commit 96c2914

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

+12
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ fun findArtifact(version: String): File {
4747
}
4848
}
4949

50+
fun getMajorVersion(version: String): Int {
51+
return version.substringBefore('.').toInt()
52+
}
53+
5054
// generate the api diff report for any module that is stable
5155
if (project.findProperty("otel.stable") == "true") {
5256
afterEvaluate {
@@ -66,6 +70,14 @@ if (project.findProperty("otel.stable") == "true") {
6670
// the japicmp "old" version is either the user-specified one, or the latest release.
6771
val apiBaseVersion: String? by project
6872
val baselineVersion = apiBaseVersion ?: latestReleasedVersion
73+
if (apiBaseVersion == null && apiNewVersion == null) {
74+
val baseMajor = getMajorVersion(baselineVersion)
75+
val projectMajor = getMajorVersion(project.version as String)
76+
// disable japicmp when project major version is behind major version of latest release,
77+
// if that is the case we are building a patch for the previous release
78+
enabled = projectMajor >= baseMajor
79+
}
80+
6981
oldClasspath.from(
7082
try {
7183
files(findArtifact(baselineVersion))

0 commit comments

Comments
 (0)