-
Notifications
You must be signed in to change notification settings - Fork 186
Implementation of #bundle #1274
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
Conversation
@swift-ci test please |
@swift-ci please test |
/// Code in a Swift Package target will return the resource bundle associated with that target. | ||
@available(macOS 10.0, iOS 2.0, tvOS 9.0, watchOS 2.0, *) | ||
@freestanding(expression) | ||
public macro bundle() -> Bundle = #externalMacro(module: "FoundationMacros", type: "BundleMacro") |
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.
@Tantalum73 @jmschonfeld should this go somewhere other than FoundationInternationalization
given that bundles are not just for internationalization? For example someone could easily use this to lookup an asset or some other resource.
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.
Right now, Bundle
does not exist in FoundationInternationalization
and this is just a FOUNDATION_FRAMEWORK
piece that will be picked up by the Foundation.framework
build. For this to be fully usable on non-Darwin, this macro
would currently need to be declared in the Foundation
module in the swift-corelibs-foundation repo as well / separately (which we can do next). Eventually, if we sink Bundle
down to swift-foundation this would remove the FOUNDATION_FRAMEWORK
ifdef and would go alongside wherever Bundle
is defined, but given that Bundle
does not currently exist in swift-foundation I'm ok leaving this here for now as just a piece for the Foundation.framework build to pickup and moving it whenever we decide where Bundle
will go later
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.
I had the same question as @matthewseaman when I read this. IMO Bundle
will very likely be in FoundationEssentials if/when we move it, so we'll likely move this there, though like Jeremy said it doesn't really matter now for swift-foundation when building as a package
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.
Agreed. Removed the declaration and now only the implementation in FoundationMacros remains.
FYI here is the SwiftPM implementation of the compile-time conditions: swiftlang/swift-package-manager#8556 |
@swift-ci please test |
This PR implements
#bundle
, as pitched here and proposed here