[K/N] Fix lazy header export in one-shot compilation mode
This commit is contained in:
committed by
Space Team
parent
e35a28d36d
commit
b6060f8440
+2
-2
@@ -19,7 +19,7 @@ import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver
|
||||
internal fun StorageComponentContainer.initContainer(config: KonanConfig) {
|
||||
useImpl<FrontendServices>()
|
||||
|
||||
if (config.configuration.get(KonanConfigKeys.EMIT_LAZY_OBJC_HEADER_FILE) != null) {
|
||||
if (!config.configuration.get(KonanConfigKeys.EMIT_LAZY_OBJC_HEADER_FILE).isNullOrEmpty()) {
|
||||
useImpl<ObjCExportLazyImpl>()
|
||||
useInstance(object : ObjCExportProblemCollector {
|
||||
override fun reportWarning(text: String) {}
|
||||
@@ -55,7 +55,7 @@ internal fun StorageComponentContainer.initContainer(config: KonanConfig) {
|
||||
internal fun ComponentProvider.postprocessComponents(context: FrontendContext, files: Collection<KtFile>) {
|
||||
context.frontendServices = this.get<FrontendServices>()
|
||||
|
||||
context.config.configuration.get(KonanConfigKeys.EMIT_LAZY_OBJC_HEADER_FILE)?.let {
|
||||
context.config.configuration.get(KonanConfigKeys.EMIT_LAZY_OBJC_HEADER_FILE)?.takeIf { it.isNotEmpty() }?.let {
|
||||
this.get<ObjCExportLazy>().dumpObjCHeader(files, it, context.shouldExportKDoc())
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -162,6 +162,9 @@ class KonanDriver(
|
||||
put(KonanConfigKeys.REPOSITORIES, configuration.getNotNull(KonanConfigKeys.REPOSITORIES))
|
||||
configuration.get(KonanConfigKeys.FRIEND_MODULES)?.let { put(KonanConfigKeys.FRIEND_MODULES, it) }
|
||||
configuration.get(KonanConfigKeys.REFINES_MODULES)?.let { put(KonanConfigKeys.REFINES_MODULES, it) }
|
||||
configuration.get(KonanConfigKeys.EMIT_LAZY_OBJC_HEADER_FILE)?.let { put(KonanConfigKeys.EMIT_LAZY_OBJC_HEADER_FILE, it)}
|
||||
configuration.get(KonanConfigKeys.FULL_EXPORTED_NAME_PREFIX)?.let { put(KonanConfigKeys.FULL_EXPORTED_NAME_PREFIX, it)}
|
||||
configuration.get(KonanConfigKeys.EXPORT_KDOC)?.let { put(KonanConfigKeys.EXPORT_KDOC, it)}
|
||||
}
|
||||
|
||||
// For the second stage, remove already compiled source files from the configuration.
|
||||
@@ -170,6 +173,9 @@ class KonanDriver(
|
||||
configuration.put(CommonConfigurationKeys.USE_FIR, false)
|
||||
// For the second stage, provide just compiled intermediate KLib as "-Xinclude=" param.
|
||||
require(intermediateKLib.exists) { "Intermediate KLib $intermediateKLib must have been created by successful first compilation stage" }
|
||||
// We need to remove this flag, as it would otherwise override header written previously.
|
||||
// Unfortunately, there is no way to remove the flag, so empty string is put instead
|
||||
configuration.get(KonanConfigKeys.EMIT_LAZY_OBJC_HEADER_FILE)?.let { configuration.put(KonanConfigKeys.EMIT_LAZY_OBJC_HEADER_FILE, "") }
|
||||
configuration.put(KonanConfigKeys.INCLUDED_LIBRARIES,
|
||||
configuration.get(KonanConfigKeys.INCLUDED_LIBRARIES).orEmpty() + listOf(intermediateKLib.absolutePath))
|
||||
compilationSpawner.spawn(configuration) // Need to spawn a new compilation to create fresh environment (without sources).
|
||||
|
||||
@@ -5350,7 +5350,8 @@ Task objcExportTest(
|
||||
opts += [
|
||||
"-Xexport-kdoc",
|
||||
"-Xbinary=bundleId=foo.bar",
|
||||
"-Xexport-library=test-no-enum-entries-${libraryName}.klib"
|
||||
"-Xexport-library=test-no-enum-entries-${libraryName}.klib",
|
||||
"-module-name", "Kt"
|
||||
]
|
||||
opts += frameworkOpts
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user