Skip to content

Use __BundleLookupHelper.self when building mergable library #1389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Sources/FoundationMacros/BundleMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public struct BundleMacro: SwiftSyntaxMacros.ExpressionMacro, Sendable {
return Bundle.module
#elseif SWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE
#error("No resource bundle is available for this module. If resources are included elsewhere, specify the bundle manually.")
#elseif SWIFT_BUNDLE_LOOKUP_HELPER_AVAILABLE
return Bundle(for: __BundleLookupHelper.self)
#else
return Bundle(_dsoHandle: #dsohandle) ?? .main
#endif
Expand Down
4 changes: 4 additions & 0 deletions Tests/FoundationMacrosTests/BundleMacroTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ private struct BundleMacroTests {
return Bundle.module
#elseif SWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE
#error("No resource bundle is available for this module. If resources are included elsewhere, specify the bundle manually.")
#elseif SWIFT_BUNDLE_LOOKUP_HELPER_AVAILABLE
return Bundle(for: __BundleLookupHelper.self)
#else
return Bundle(_dsoHandle: #dsohandle) ?? .main
#endif
Expand All @@ -48,6 +50,8 @@ private struct BundleMacroTests {
return Bundle.module
#elseif SWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE
#error("No resource bundle is available for this module. If resources are included elsewhere, specify the bundle manually.")
#elseif SWIFT_BUNDLE_LOOKUP_HELPER_AVAILABLE
return Bundle(for: __BundleLookupHelper.self)
#else
return Bundle(_dsoHandle: #dsohandle) ?? .main
#endif
Expand Down
Loading