You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: conventions/src/main/kotlin/otel.japicmp-conventions.gradle.kts
+48-45Lines changed: 48 additions & 45 deletions
Original file line number
Diff line number
Diff line change
@@ -51,57 +51,60 @@ fun findArtifact(version: String): File {
51
51
// generate the api diff report for any module that is stable
52
52
if (project.findProperty("otel.stable") =="true") {
53
53
afterEvaluate {
54
-
tasks {
55
-
val jApiCmp by registering(JapicmpTask::class) {
56
-
dependsOn("jar")
54
+
// Only apply japicmp to projects that have a jar task (i.e. not BOMs or platforms)
55
+
tasks.findByName("jar")?.let {
56
+
tasks {
57
+
val jApiCmp by registering(JapicmpTask::class) {
58
+
dependsOn("jar")
57
59
58
-
// the japicmp "new" version is either the user-specified one, or the locally built jar.
59
-
val apiNewVersion:String? by project
60
-
val newArtifact = apiNewVersion?.let { findArtifact(it) }
61
-
?: file(getByName<Jar>("jar").archiveFile)
62
-
newClasspath.from(files(newArtifact))
60
+
// the japicmp "new" version is either the user-specified one, or the locally built jar.
61
+
val apiNewVersion:String? by project
62
+
val newArtifact = apiNewVersion?.let { findArtifact(it) }
63
+
?: file(getByName<Jar>("jar").archiveFile)
64
+
newClasspath.from(files(newArtifact))
63
65
64
-
// only output changes, not everything
65
-
onlyModified.set(true)
66
+
// only output changes, not everything
67
+
onlyModified.set(true)
66
68
67
-
// the japicmp "old" version is either the user-specified one, or the latest release.
68
-
val apiBaseVersion:String? by project
69
-
val baselineVersion = apiBaseVersion ?: latestReleasedVersion
70
-
oldClasspath.from(
71
-
try {
72
-
files(findArtifact(baselineVersion))
73
-
} catch (e:Exception) {
74
-
// if we can't find the baseline artifact, this is probably one that's never been published before,
75
-
// so publish the whole API. We do that by flipping this flag, and comparing the current against nothing.
76
-
onlyModified.set(false)
77
-
files()
69
+
// the japicmp "old" version is either the user-specified one, or the latest release.
70
+
val apiBaseVersion:String? by project
71
+
val baselineVersion = apiBaseVersion ?: latestReleasedVersion
72
+
oldClasspath.from(
73
+
try {
74
+
files(findArtifact(baselineVersion))
75
+
} catch (e:Exception) {
76
+
// if we can't find the baseline artifact, this is probably one that's never been published before,
77
+
// so publish the whole API. We do that by flipping this flag, and comparing the current against nothing.
78
+
onlyModified.set(false)
79
+
files()
80
+
}
81
+
)
82
+
83
+
// Reproduce defaults from https://github.com/melix/japicmp-gradle-plugin/blob/09f52739ef1fccda6b4310cf3f4b19dc97377024/src/main/java/me/champeau/gradle/japicmp/report/ViolationsGenerator.java#L130
84
+
// only changing the BinaryIncompatibleRule to our custom one that allows new default methods
85
+
// on interfaces, and adding default implementations to interface methods previously
// Reproduce defaults from https://github.com/melix/japicmp-gradle-plugin/blob/09f52739ef1fccda6b4310cf3f4b19dc97377024/src/main/java/me/champeau/gradle/japicmp/report/ViolationsGenerator.java#L130
82
-
// only changing the BinaryIncompatibleRule to our custom one that allows new default methods
83
-
// on interfaces, and adding default implementations to interface methods previously
0 commit comments