KlibDump

Represents KLib ABI dump and allows manipulating it.

Usual KlibDump workflows consists of loading, updating and writing a dump back.

Creating a textual dump from a klib

val dump = KlibDump.fromKlib(File("/path/to/library.klib"))
dump.saveTo(File("/path/to/dump.klib.api"))

Loading a dump

val dump = KlibDump.from(File("/path/to/dump.klib.api"))

Merging multiple dumps into a new merged dump

val klibs = listOf(File("/path/to/library-linuxX64.klib"), File("/path/to/library-linuxArm64.klib"), ...)
val mergedDump = KlibDump()
klibs.forEach { mergedDump.mergeFromKlib(it) }
mergedDump.saveTo(File("/path/to/merged.klib.api"))

Updating an existing merged dump

val mergedDump = KlibDump.from(File("/path/to/merged.klib.api"))
val newTargetDump = KlibDump.fromKlib(File("/path/to/library-linuxX64.klib"))
mergedDump.remove(newTargetDump.targets)
mergedDump.merge(newTargetDump)
mergedDump.saveTo(File("/path/to/merged.klib.api"))

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Set of all targets for which this dump contains declarations.

Functions

Link copied to clipboard
fun copy(): KlibDump

Creates a copy of this dump.

Link copied to clipboard
fun merge(other: KlibDump)

Merges other dump with this one.

fun merge(dumpFile: File, configurableTargetName: String? = null)

Loads a textual KLib dump and merges it into this dump.

Link copied to clipboard
fun KlibDump.mergeFromKlib(klibFile: File, configurableTargetName: String? = null, filters: KlibDumpFilters = KlibDumpFilters.DEFAULT)

Dumps a public ABI of a klib represented by klibFile using filters and merges it into this dump.

Link copied to clipboard
fun remove(targets: Iterable<KlibTarget>)

Remove all declarations that do belong to specified targets and remove these targets from the dump.

Link copied to clipboard
fun retain(targets: Iterable<KlibTarget>)

Removes all declarations that do not belong to specified targets and removes these targets from the dump.

Link copied to clipboard

Serializes the dump and writes it to to.

Link copied to clipboard
fun KlibDump.saveTo(file: File)

Serializes the dump and writes it to file.