Kotlin / binary-compatibility-validator

Public API management tool
Apache License 2.0
800 stars 59 forks source link

Support KLib validation #153

Closed fzhinkin closed 8 months ago

fzhinkin commented 11 months ago

Supported Klib ABI validation.

The validation is disabled by default and requires the following settings to be turned on:

apiValidation {
    klibValidationEnabled = true
}

KLib validation supports ignoredPackages, ignoredClasses and nonPublicMarkers options the same way classfiles validation does, but all public* options are unsupported and will be ignored.

As with the JVM API validation, ABI is dumped into a text file. There's a separate dump file for each native target, each located in a directory named after the target. Here's an example of a file tree for kotlinx-io's core module:

kotlinx-io
    core
        api
            androidNativeArm32
                kotlinx-io-core.api
            androidNativeArm64
                kotlinx-io-core.api
...
            jvm
                kotlinx-io-core.api
...
            linuxArm64
                kotlinx-io-core.api
...

One of the disadvantages of such a scheme for storing dumps is that once something is changed in the common sourceset, api-files for all targets will reflect that change. It's an open question if some other scheme to represent the native ABI should be used.