Skip to content

Commit

Permalink
Disable jApiCmp for 1.x (#10293)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit authored Jan 23, 2024
1 parent 00b52a9 commit 96c2914
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions conventions/src/main/kotlin/otel.japicmp-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ fun findArtifact(version: String): File {
}
}

fun getMajorVersion(version: String): Int {
return version.substringBefore('.').toInt()
}

// generate the api diff report for any module that is stable
if (project.findProperty("otel.stable") == "true") {
afterEvaluate {
Expand All @@ -66,6 +70,14 @@ if (project.findProperty("otel.stable") == "true") {
// the japicmp "old" version is either the user-specified one, or the latest release.
val apiBaseVersion: String? by project
val baselineVersion = apiBaseVersion ?: latestReleasedVersion
if (apiBaseVersion == null && apiNewVersion == null) {
val baseMajor = getMajorVersion(baselineVersion)
val projectMajor = getMajorVersion(project.version as String)
// disable japicmp when project major version is behind major version of latest release,
// if that is the case we are building a patch for the previous release
enabled = projectMajor >= baseMajor
}

oldClasspath.from(
try {
files(findArtifact(baselineVersion))
Expand Down

0 comments on commit 96c2914

Please sign in to comment.