Skip to content

Extend API compatibility check to detect removed KMP targets as breaking #512

Description

@hdcodedev

Problem

The API compatibility check (apiCompatibilityCheck in buildSrc/src/main/kotlin/charts.api-compatibility.gradle.kts) uses japicmp to diff JVM jars only against a baseline ref (.github/api-compatibility-baseline.txt). It cannot detect the removal of a Kotlin Multiplatform target (e.g. dropping the legacy js target in #511), even though a target removal is a breaking change for consumers on that target.

Current behavior

  • Only JVM binary/source compatibility is verified.
  • Removed targets (or API drift on wasmJs/iOS metadata/klibs) are invisible to CI.
  • Breaking changes are surfaced only via release-note migration fragments, which are not enforced.

Proposed solutions

Option A (cheap, targeted): Compare the published target set per module (e.g. kotlin.targets or publication names) between the baseline ref and the current tree, and feed the existing breaking-change label gating in .github/workflows/api-compatibility.yml — fail when a target disappears without the label.

Option B (thorough, larger effort): Adopt the Kotlin binary-compatibility-validator plugin, which produces per-target .api dumps, detects removed targets (dump file disappears) and API drift on non-JVM targets. Overlaps with the existing japicmp setup and requires an api/*.api migration.

Recommendation

Option A is a proportionate safeguard for the current small, intentional target set; Option B is the long-term end-state if per-target API drift protection is wanted.

Acceptance criteria

  • A removed KMP target without the breaking-change label fails the API compatibility job.
  • Intentional removals pass when the label (and migration fragment) are present.
  • Existing label/categorization output in the workflow is preserved or improved.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions