Skip to content

Commit 45ba668

Browse files
Tantalum73Andreas Neusuess
andauthored
Use __BundleLookupHelper.self when building mergable library (#1389)
Co-authored-by: Andreas Neusuess <[email protected]>
1 parent 6a7f64f commit 45ba668

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Sources/FoundationMacros/BundleMacro.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public struct BundleMacro: SwiftSyntaxMacros.ExpressionMacro, Sendable {
2222
return Bundle.module
2323
#elseif SWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE
2424
#error("No resource bundle is available for this module. If resources are included elsewhere, specify the bundle manually.")
25+
#elseif SWIFT_BUNDLE_LOOKUP_HELPER_AVAILABLE
26+
return Bundle(for: __BundleLookupHelper.self)
2527
#else
2628
return Bundle(_dsoHandle: #dsohandle) ?? .main
2729
#endif

Tests/FoundationMacrosTests/BundleMacroTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ private struct BundleMacroTests {
2828
return Bundle.module
2929
#elseif SWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE
3030
#error("No resource bundle is available for this module. If resources are included elsewhere, specify the bundle manually.")
31+
#elseif SWIFT_BUNDLE_LOOKUP_HELPER_AVAILABLE
32+
return Bundle(for: __BundleLookupHelper.self)
3133
#else
3234
return Bundle(_dsoHandle: #dsohandle) ?? .main
3335
#endif
@@ -48,6 +50,8 @@ private struct BundleMacroTests {
4850
return Bundle.module
4951
#elseif SWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE
5052
#error("No resource bundle is available for this module. If resources are included elsewhere, specify the bundle manually.")
53+
#elseif SWIFT_BUNDLE_LOOKUP_HELPER_AVAILABLE
54+
return Bundle(for: __BundleLookupHelper.self)
5155
#else
5256
return Bundle(_dsoHandle: #dsohandle) ?? .main
5357
#endif

0 commit comments

Comments
 (0)