-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Introduce new defines to enable #bundle in Swift Packages #8556
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
base: main
Are you sure you want to change the base?
Conversation
if bundlePath != nil { | ||
compilationConditions += ["-DSWIFT_MODULE_RESOURCE_BUNDLE_AVAILABLE=1"] | ||
} else { | ||
compilationConditions += ["-DSWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE=1"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this trigger
warning: conditional compilation flags do not have values in Swift; they are either present or absent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh good catch! I was copying the wrong pattern from the Clang version.
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a bunch of tests need updating.
@swift-ci please test |
96c5bae
to
c052c54
Compare
@swift-ci please test |
@swift-ci test windows |
Introduce Swift compilation conditions to support
#bundle
in Foundation.Motivation:
This is the SwiftPM companion to
#bundle
.Pitch: https://forums.swift.org/t/pitch-introduce-bundle-macro/79288
Proposal: swiftlang/swift-foundation#1251
Implementation: swiftlang/swift-foundation#1274
Modifications:
Define
SWIFT_MODULE_RESOURCE_BUNDLE_AVAILABLE
when we'd like#bundle
to call our generatedBundle.module
.Define
SWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE
when there are no resources and#bundle
should complain about that.Leave them both undefined when we'd like
#bundle
to keep its default behavior of using the same bundle where the source code lives.Result:
#bundle
will point to the correct resource bundle when called from Swift Packages.