I noticed today that currently it doesn't seem possible to build to a macOS
target with a deployment target greater than 10.10 with swiftpm, since 10.10 is
currently hardcoded in the swiftpm source.
This means that right now if you attempt to do something like:
$ swift build --verbose -Xswiftc -target -Xswiftc x86_64-apple-macosx10.11
You'll notice that this target is not sent to the first invocation of swiftc
(I'm not sure if this is a problem or not):
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --driver-mode=swift -I /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm -L /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm -lPackageDescription -target x86_64-apple-macosx10.10 ...
And you'll see that the 10.11 target specification is overridden with the
default value when sent to swift-build-tool:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f ... -v /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc ... -target x86_64-apple-macosx10.11 -target x86_64-apple-macosx10.10 ...
I have a few questions about this:
- In the long term what's the plan for moving this out of being hard coded in
swiftpm? If there is one, are there some starter tasks I could grab?
- In the short term would it make sense for us to reorder the user's args vs the
default args in the few uses of these hardcoded args?
Lastly if there has been any discussion about this previously I'd love to see it!
Thanks for reading!