jApiCmp exclusions (#4746)

* Demonstrate failing japicmp

* Exclude allowable compatiblity changes

* Rollback temp change to MetricExporter
This commit is contained in:
jack-berg 2022-09-09 18:33:58 -05:00 committed by GitHub
parent d069e1b473
commit 1697130f0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 15 deletions

View File

@ -22,7 +22,7 @@ dependencies {
implementation("com.squareup.wire:wire-gradle-plugin:4.3.0")
implementation("gradle.plugin.com.google.protobuf:protobuf-gradle-plugin:0.8.18")
implementation("gradle.plugin.io.morethan.jmhreport:gradle-jmh-report:0.9.0")
implementation("me.champeau.gradle:japicmp-gradle-plugin:0.4.0")
implementation("me.champeau.gradle:japicmp-gradle-plugin:0.4.1")
implementation("me.champeau.jmh:jmh-gradle-plugin:0.6.6")
implementation("net.ltgt.gradle:gradle-errorprone-plugin:2.0.2")
implementation("net.ltgt.gradle:gradle-nullaway-plugin:1.3.0")

View File

@ -35,17 +35,6 @@ val latestReleasedVersion: String by lazy {
class AllowDefaultMethodRule : AbstractRecordingSeenMembers() {
override fun maybeAddViolation(member: JApiCompatibility): Violation? {
for (change in member.compatibilityChanges) {
if (change == JApiCompatibilityChange.METHOD_NEW_DEFAULT) {
// JApiCmp treats this as incompatible for the situation where an existing subclass may have
// a method with the same name and different signature. We accept this corner case for
// semver.
continue
}
if (change == JApiCompatibilityChange.METHOD_ABSTRACT_NOW_DEFAULT) {
// Adding default implementations to interface methods previously abstract is not a breaking
// change.
continue
}
if (isAbstractMethodOnAutoValue(member, change)) {
continue
}
@ -125,9 +114,10 @@ if (!project.hasProperty("otel.release") && !project.name.startsWith("bom")) {
)
// Reproduce defaults from https://github.com/melix/japicmp-gradle-plugin/blob/09f52739ef1fccda6b4310cf3f4b19dc97377024/src/main/java/me/champeau/gradle/japicmp/report/ViolationsGenerator.java#L130
// only changing the BinaryIncompatibleRule to our custom one that allows new default methods
// on interfaces, and adding default implementations to interface methods previously
// abstract.
// but allow new default methods on interfaces, adding default implementations to
// interface methods previously abstract, and select additional customizations defined in
// AllowDefaultMethodRule.
compatibilityChangeExcludes.set(listOf("METHOD_NEW_DEFAULT", "METHOD_ABSTRACT_NOW_DEFAULT"))
richReport {
addSetupRule(RecordSeenMembersSetup::class.java)
addRule(JApiChangeStatus.NEW, SourceCompatibleRule::class.java)