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
|
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)
|
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
|
* async functions with `Void` return type
|
||||||
*/
|
*/
|
||||||
PROPER,
|
PROPER,
|
||||||
|
;
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
val DEFAULT = PROPER
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -90,7 +90,7 @@ fun createNamer(
|
|||||||
): ObjCExportNamer = ObjCExportNamerImpl(
|
): ObjCExportNamer = ObjCExportNamerImpl(
|
||||||
(exportedDependencies + moduleDescriptor).toSet(),
|
(exportedDependencies + moduleDescriptor).toSet(),
|
||||||
moduleDescriptor.builtIns,
|
moduleDescriptor.builtIns,
|
||||||
ObjCExportMapper(local = true, unitSuspendFunctionExport = UnitSuspendFunctionObjCExport.LEGACY),
|
ObjCExportMapper(local = true, unitSuspendFunctionExport = UnitSuspendFunctionObjCExport.DEFAULT),
|
||||||
topLevelNamePrefix,
|
topLevelNamePrefix,
|
||||||
local = true
|
local = true
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5353,7 +5353,7 @@ if (isAppleTarget(project)) {
|
|||||||
framework(frameworkName) {
|
framework(frameworkName) {
|
||||||
sources = ['objcexport']
|
sources = ['objcexport']
|
||||||
library = libraryName
|
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']
|
swiftSources = ['objcexport']
|
||||||
if (isNoopGC) {
|
if (isNoopGC) {
|
||||||
@@ -5407,7 +5407,7 @@ if (isAppleTarget(project)) {
|
|||||||
sources = ['objcexport']
|
sources = ['objcexport']
|
||||||
artifact = frameworkArtifactName
|
artifact = frameworkArtifactName
|
||||||
library = libraryName
|
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']
|
swiftSources = ['objcexport']
|
||||||
swiftExtraOpts = [ '-D', 'NO_GENERICS' ]
|
swiftExtraOpts = [ '-D', 'NO_GENERICS' ]
|
||||||
@@ -5462,7 +5462,7 @@ if (isAppleTarget(project)) {
|
|||||||
sources = ['objcexport']
|
sources = ['objcexport']
|
||||||
artifact = frameworkArtifactName
|
artifact = frameworkArtifactName
|
||||||
library = libraryName
|
library = libraryName
|
||||||
opts = ["-Xemit-lazy-objc-header=$lazyHeader"]
|
opts = ["-Xemit-lazy-objc-header=$lazyHeader", "-Xbinary=unitSuspendFunctionObjCExport=legacy"]
|
||||||
}
|
}
|
||||||
swiftSources = ['objcexport']
|
swiftSources = ['objcexport']
|
||||||
swiftExtraOpts = [ '-D', 'LEGACY_SUSPEND_UNIT_FUNCTION_EXPORT' ]
|
swiftExtraOpts = [ '-D', 'LEGACY_SUSPEND_UNIT_FUNCTION_EXPORT' ]
|
||||||
@@ -5497,7 +5497,6 @@ if (isAppleTarget(project)) {
|
|||||||
artifact = frameworkArtifactName
|
artifact = frameworkArtifactName
|
||||||
library = libraryName
|
library = libraryName
|
||||||
isStatic = true
|
isStatic = true
|
||||||
opts = ["-Xbinary=unitSuspendFunctionObjCExport=proper"]
|
|
||||||
}
|
}
|
||||||
swiftSources = ['objcexport']
|
swiftSources = ['objcexport']
|
||||||
if (isNoopGC) {
|
if (isNoopGC) {
|
||||||
|
|||||||
Reference in New Issue
Block a user