Skip to content

Commit 01a7c3d

Browse files
committed
Don't require objc in modulemaps generated for Swift compatibility headers
Let's remove the `requires objc` from the module map file generated for the compatibility header. This condition triggered an error when importing the compatibility header from a C source file. This declaration is superfluous, the compatibility header is already printed in a way where the Objective-C code is protected behind a language check. C clients can safely import the current compatibility header even if they may not see any content. Let's lift this restriction. It isn't currently necessary and we're adding C content to the compatibility header with the official support for `@cdecl` that is independent of Objective-C.
1 parent f69eff2 commit 01a7c3d

File tree

3 files changed

+0
-6
lines changed

3 files changed

+0
-6
lines changed

Sources/SWBTaskConstruction/TaskProducers/OtherTaskProducers/ModuleMapTaskProducer.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ final class ModuleMapTaskProducer: PhasedTaskProducer, TaskProducer {
404404
outputStream <<< "module \(try moduleName.asModuleIdentifierString()).Swift {\n"
405405
}
406406
outputStream <<< " header \"\(interfaceHeaderName.asCStringLiteralContent)\"\n"
407-
outputStream <<< " requires objc\n"
408407
outputStream <<< "}\n"
409408

410409
return outputStream.bytes

Tests/SWBTaskConstructionTests/ModuleMapTaskConstructionTests.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,6 @@ fileprivate struct ModuleMapTaskConstructionTests: CoreBasedTests {
584584
#expect(contents == (OutputByteStream()
585585
<<< "framework module SwiftOnly {\n"
586586
<<< " header \"SwiftOnly-Swift.h\"\n"
587-
<<< " requires objc\n"
588587
<<< "}\n").bytes)
589588
}
590589

@@ -629,7 +628,6 @@ fileprivate struct ModuleMapTaskConstructionTests: CoreBasedTests {
629628
<<< "\n"
630629
<<< "module ObjCCompatibilityHeader.Swift {\n"
631630
<<< " header \"ObjCCompatibilityHeader-Swift.h\"\n"
632-
<<< " requires objc\n"
633631
<<< "}\n").bytes)
634632
}
635633

@@ -978,7 +976,6 @@ fileprivate struct ModuleMapTaskConstructionTests: CoreBasedTests {
978976
<<< "\n"
979977
<<< "module \(targetName).Swift {\n"
980978
<<< " header \"\(targetName)-Swift.h\"\n"
981-
<<< " requires objc\n"
982979
<<< "}\n").bytes)
983980
}
984981

Tests/SWBTaskConstructionTests/SwiftTaskConstructionTests.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,6 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests {
606606
#expect(contents == (OutputByteStream()
607607
<<< "framework module CoreFoo {\n"
608608
<<< " header \"CoreFoo-Swift.h\"\n"
609-
<<< " requires objc\n"
610609
<<< "}\n").bytes)
611610
}
612611
}
@@ -1086,7 +1085,6 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests {
10861085
stream <<< "\n"
10871086
stream <<< "module CoreFoo.Swift {\n"
10881087
stream <<< " header \"CoreFoo-Swift.h\"\n"
1089-
stream <<< " requires objc\n"
10901088
stream <<< "}\n"
10911089
#expect(contents == stream.bytes)
10921090

0 commit comments

Comments
 (0)