[Native] Explicitly use Foundation in ObjC export. (#4762)
This enables using exported Frameworks with `-fmodules-decluse`. One use-case for this is ensuring that distributed builds are explicitly providing all required modules; this is important for reproducibility. For more background on `use` declarations, see: https://clang.llvm.org/docs/Modules.html#use-declaration The easiest way to reproduce this locally is by compiling a framework, and emitting a pcm file with `swiftc`. Note that this requires a reference to a pcm for Foundation, which can be found in the clang ModuleCache. ``` kotlin-native/dist/bin/kotlinc-native ~/test.kt -produce framework -o /tmp/TestFramework.framework swiftc -emit-pcm -module-name TestFramework -o /tmp/TestFramework.pcm /tmp/TestFramework.framework/Modules/module.modulemap -Xcc -fmodules-decluse -Xcc -fmodule-file=Foundation=$HOME/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1IQ2SWDEIAPH0/Foundation-2FJBXN8U6QRTS.pcm ```
This commit is contained in:
+2
@@ -135,6 +135,8 @@ internal class ObjCExport(val context: Context, symbolTable: SymbolTable) {
|
||||
|
|
||||
| export *
|
||||
| module * { export * }
|
||||
|
|
||||
| use Foundation
|
||||
|}
|
||||
""".trimMargin()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user