Skip to content

Commit

Permalink
Remove japicmp exception for log SDK changes (open-telemetry#4977)
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-berg authored and dmarkwat committed Dec 30, 2022
1 parent 2badc29 commit 42437d0
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions buildSrc/src/main/kotlin/otel.japicmp-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import com.google.auto.value.AutoValue
import japicmp.model.JApiChangeStatus
import japicmp.model.JApiClass
import japicmp.model.JApiCompatibility
import japicmp.model.JApiCompatibilityChange
import japicmp.model.JApiConstructor
import japicmp.model.JApiMethod
import me.champeau.gradle.japicmp.JapicmpTask
import me.champeau.gradle.japicmp.report.Severity
Expand Down Expand Up @@ -40,9 +38,6 @@ class AllowDefaultMethodRule : AbstractRecordingSeenMembers() {
if (isAbstractMethodOnAutoValue(member, change)) {
continue
}
if (isLogRename(member)) {
continue
}
if (!change.isSourceCompatible) {
return Violation.error(member, "Not source compatible")
}
Expand All @@ -64,35 +59,6 @@ class AllowDefaultMethodRule : AbstractRecordingSeenMembers() {
member is JApiMethod &&
member.getjApiClass().newClass.get().getAnnotation(AutoValue::class.java) != null
}

/**
* Check if the change is related to log related renames.
*/
// TODO(jack-berg): remove after 1.19.0.
fun isLogRename(member: JApiCompatibility): Boolean {
try {
if (member is JApiMethod) {
val longName = member.oldMethod.get().longName
return longName.matches(".*OpenTelemetrySdk\\.getSdkLogEmitterProvider.*".toRegex()) ||
longName.matches(".*OpenTelemetrySdkBuilder\\.setLogEmitterProvider.*".toRegex()) ||
longName.matches(".*AutoConfigurationCustomizer\\.addLogExporterCustomizer.*".toRegex()) ||
longName.matches(".*AutoConfigurationCustomizer\\.addLogEmitterProviderCustomizer.*".toRegex()) ||
longName.matches(".*ConfigurableLogExporterProvider.*".toRegex()) ||
longName.matches(".*SystemOutLogExporter.*".toRegex()) ||
longName.matches(".*OtlpJsonLoggingLogExporter.*".toRegex())
} else if (member is JApiClass) {
val fqcn = member.fullyQualifiedName
return fqcn.matches(".*SystemOutLogExporter".toRegex()) ||
fqcn.matches(".*ConfigurableLogExporterProvider".toRegex()) ||
fqcn.matches(".*OtlpJsonLoggingLogExporter".toRegex())
} else if (member is JApiConstructor) {
return member.oldConstructor.get().longName.matches(".*SystemOutLogExporter.*".toRegex())
}
return false
} catch (e: IllegalStateException) {
return false
}
}
}

/**
Expand Down

0 comments on commit 42437d0

Please sign in to comment.