[klib] Add an option to write out header klibs

The header klib is supposed to only contain the public abi of the module
similar to jvm-abi-gen. It is intended to be used as a dependency for other
klib compilations instead of the full klib for compilation avoidance.

^KT-60807
This commit is contained in:
Johan Bay
2023-05-09 14:29:21 +02:00
committed by Space Team
parent 829e0675f4
commit 0a612e4268
90 changed files with 1374 additions and 76 deletions
@@ -45,6 +45,7 @@ fun copyK2NativeCompilerArguments(from: K2NativeCompilerArguments, to: K2NativeC
to.generateNoExitTestRunner = from.generateNoExitTestRunner
to.generateTestRunner = from.generateTestRunner
to.generateWorkerTestRunner = from.generateWorkerTestRunner
to.headerKlibPath = from.headerKlibPath
to.includeBinaries = from.includeBinaries?.copyOf()
to.includes = from.includes?.copyOf()
to.incrementalCacheDir = from.incrementalCacheDir
@@ -104,4 +105,4 @@ fun copyK2NativeCompilerArguments(from: K2NativeCompilerArguments, to: K2NativeC
to.workerExceptionHandling = from.workerExceptionHandling
return to
}
}
@@ -372,6 +372,12 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xmetadata-klib", description = "Produce a klib that only contains the declarations metadata")
var metadataKlib: Boolean = false
@Argument(
value = "-Xheader-klib-path",
description = "Save a klib that only contains the public abi to the given path"
)
var headerKlibPath: String? = null
@Argument(value = "-Xdebug-prefix-map", valueDescription = "<old1=new1,old2=new2,...>", description = "Remap file source directory paths in debug info")
var debugPrefixMap: Array<String>? = null