ObjCExport: enable unitSuspendFunctionObjCExport=proper by default
For Unit-returning suspend functions ObjCExport now generates completion handlers without redundant `KotlinUnit*` result parameter. So Swift (5.5+) can import these functions as Void-returning async functions. unitSuspendFunctionObjCExport=legacy binary option can be used to enable the legacy behaviour. It will be removed in a future release. ^KT-49928 Fixed
This commit is contained in:
committed by
Space
parent
c7e594fc7f
commit
19d13bb8bf
+1
-1
@@ -314,7 +314,7 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
|
||||
}
|
||||
|
||||
internal val unitSuspendFunctionObjCExport: UnitSuspendFunctionObjCExport
|
||||
get() = configuration.get(BinaryOptions.unitSuspendFunctionObjCExport) ?: UnitSuspendFunctionObjCExport.LEGACY
|
||||
get() = configuration.get(BinaryOptions.unitSuspendFunctionObjCExport) ?: UnitSuspendFunctionObjCExport.DEFAULT
|
||||
|
||||
internal val testDumpFile: File? = configuration[KonanConfigKeys.TEST_DUMP_OUTPUT_PATH]?.let(::File)
|
||||
}
|
||||
|
||||
+5
@@ -23,4 +23,9 @@ enum class UnitSuspendFunctionObjCExport {
|
||||
* async functions with `Void` return type
|
||||
*/
|
||||
PROPER,
|
||||
;
|
||||
|
||||
companion object {
|
||||
val DEFAULT = PROPER
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -90,7 +90,7 @@ fun createNamer(
|
||||
): ObjCExportNamer = ObjCExportNamerImpl(
|
||||
(exportedDependencies + moduleDescriptor).toSet(),
|
||||
moduleDescriptor.builtIns,
|
||||
ObjCExportMapper(local = true, unitSuspendFunctionExport = UnitSuspendFunctionObjCExport.LEGACY),
|
||||
ObjCExportMapper(local = true, unitSuspendFunctionExport = UnitSuspendFunctionObjCExport.DEFAULT),
|
||||
topLevelNamePrefix,
|
||||
local = true
|
||||
)
|
||||
|
||||
@@ -5353,7 +5353,7 @@ if (isAppleTarget(project)) {
|
||||
framework(frameworkName) {
|
||||
sources = ['objcexport']
|
||||
library = libraryName
|
||||
opts = ["-Xemit-lazy-objc-header=$lazyHeader", "-Xexport-kdoc", "-Xbundle-id=foo.bar", "-Xbinary=unitSuspendFunctionObjCExport=proper"]
|
||||
opts = ["-Xemit-lazy-objc-header=$lazyHeader", "-Xexport-kdoc", "-Xbundle-id=foo.bar"]
|
||||
}
|
||||
swiftSources = ['objcexport']
|
||||
if (isNoopGC) {
|
||||
@@ -5407,7 +5407,7 @@ if (isAppleTarget(project)) {
|
||||
sources = ['objcexport']
|
||||
artifact = frameworkArtifactName
|
||||
library = libraryName
|
||||
opts = ["-Xemit-lazy-objc-header=$lazyHeader", "-Xno-objc-generics", "-Xbinary=unitSuspendFunctionObjCExport=proper"]
|
||||
opts = ["-Xemit-lazy-objc-header=$lazyHeader", "-Xno-objc-generics"]
|
||||
}
|
||||
swiftSources = ['objcexport']
|
||||
swiftExtraOpts = [ '-D', 'NO_GENERICS' ]
|
||||
@@ -5462,7 +5462,7 @@ if (isAppleTarget(project)) {
|
||||
sources = ['objcexport']
|
||||
artifact = frameworkArtifactName
|
||||
library = libraryName
|
||||
opts = ["-Xemit-lazy-objc-header=$lazyHeader"]
|
||||
opts = ["-Xemit-lazy-objc-header=$lazyHeader", "-Xbinary=unitSuspendFunctionObjCExport=legacy"]
|
||||
}
|
||||
swiftSources = ['objcexport']
|
||||
swiftExtraOpts = [ '-D', 'LEGACY_SUSPEND_UNIT_FUNCTION_EXPORT' ]
|
||||
@@ -5497,7 +5497,6 @@ if (isAppleTarget(project)) {
|
||||
artifact = frameworkArtifactName
|
||||
library = libraryName
|
||||
isStatic = true
|
||||
opts = ["-Xbinary=unitSuspendFunctionObjCExport=proper"]
|
||||
}
|
||||
swiftSources = ['objcexport']
|
||||
if (isNoopGC) {
|
||||
|
||||
Reference in New Issue
Block a user