SE-0271: Package Manager Resources

Does it mean that it will be available only in September? I mean it is very unlikely that Swift 6.0 (the next major release?) will make it to Xcode 11.x, or is there still a chance to see the feature before this summer?

Based only on the history of Swift and Xcode releases over at least the last three years, I would imagine the next release of Swift after 5.2 will be alongside a new version of Xcode in September.

2 Likes

That's likely going to be Swift 5.3 with Xcode 12. We're too far away from Swift 6 I think.

2 Likes

It’s just a tool update, so theoretically, it wouldn’t need to coincide with any OS update.

It’s up to Apple if they feel it’s worth releasing another interim XCode update. Perhaps if the community demand is strong, they might be persuaded to do it :man_shrugging:

Sure, but we're literally run out of time for that to happen before WWDC. And as history showed us, there was no new Xcode with a different Swift version released in between WWDC and the fall.

2 Likes

Then again, there might not be a WWDC this year...

I doubt that Apple won‘t even make everything virtual and prepare video sessions.

That release will be Swift 5.3. A release process blog post with branching schedule will be going up shortly.

33 Likes

Awesome news. This is the only thing preventing my company from moving to SPM.

1 Like

Is this usable now via Xcode importing a 5.3 Developer Snapshot? My mild experimentation says, "No" but greater minds than mine are abundant here!

As far as I can tell it is not. In my past experience, Xcode has never used the installed toolchain in the "Resolve Swift Packages" step, which is a little annoying. I filed FB7691693 suggesting that it would be good to have Xcode use the chosen toolchain to resolve swift packages.

To get resources working, I used Docker and the latest nightly Swift 5.3 image. If you have Docker installed and running, you can run swift test using the following script in your package directory:

docker run \
    --rm \
    --volume "$PWD:/package" \
    --workdir "/package" \
    swiftlang/swift:nightly-5.3 \
    /bin/bash \
    -c "swift test --build-path ./.build/linux"

(Hat tip to @samdeane for the original script.)

2 Likes

This is correct, the toolchain is only used to find the used compiler, linker, etc -- but we are not loading libSwiftPM from there. Only the built-in one is being used.

I'm trying it with Xcode 12 on mac and with swift 5.3 dev snapshot on linux. I'm using proposal itself as a documentation.

it works, tho i was very much confused on the usage. root directory for lookup is Sources/ProductName (if configured with default sources location). and from what I see in my tests you can not place any resource outside that directory - switpm just ignores that configuration

1 Like

That's correct, resources work very much like sources in that regard.

Is the Bundle.module implemented as of Xcode 12 beta 1 ?

Yes. It's implemented.

you mean in Xcode 12.1 beta? it's not public yet, right? The Bundle.module API does not exist in Xcode 12 beta toolchain

UPD. so it's available only if you open project via Package.swift file in Xcode and not if you generate Xcode project

I find that swift package generate-xcodeproj doesn't seem to include resources, build resource bundles or include the Bundle.module API. Is that a bug you know about?

swift package generate-xcodeproj doesn't support resources as it is kind of a legacy command that existed prior to Xcode supporting SwiftPM projects out of the box. Going forward, I would expect all features to work first and foremost by opening the SwiftPM project in Xcode, and not necessarily with generate-xcodeproj.

2 Likes

Just a note that Xcode CI “bots” still don’t support SwiftPM projects out of the box, and swift package generate-xcodeproj is currently IMO the easiest work-around.

Terms of Service

Privacy Policy

Cookie Policy