Just some shims, hacks, etc., so that portions of the standard library can be built via an SPM package.
This package was developed using the Xcode-10 beta. It uses shims and other functionality that's recently been committed to master but is not on a release branch yet, so download a recent toolchain:
Download and install a toolchain from swift.org. Choose "Trunk Development (master)".
This package assumes you have a swift checkout with utf-8 string support in a neighboring folder utf8-swift
, and are using the milseman/utf8string
branch. To set that up from a top-level directory:
git clone [email protected]:milseman/UTF8String.git
mkdir utf8-swift
cd utf8-swift
git clone --single-branch -b utf8string [email protected]:milseman/swift.git
cd ../UTF8String
open UTF8String.xcodeproj
All code can be built 2-ways, through this package or as part of a real standard library build. For the latter, build the branch with compatible LLVM and Clang hashes.
That branch is tied to late-July 2018 hashes from when it branched off. To automatically set all the branches to the correct state run this command (note that "swift" will be checked out to whatever is at the top of milseman/utf8string):
cd UTF8String && utils/update-checkout-to-utf8string-shas
This general technique should apply to anyone wanting to work on portions of the stdlib as though it were a standalone SPM package. It does have some tradeoffs though:
- Anything present is shadowed
- Literals will get their default type from the toolchain and not the shadow.
- Limited by access control when using anything not shadowed
- Toolchain definitions still available
- Test that compare behavior differences between shadowed functionality and the toolchain's
The checkout can be built as a 64-bit standard library normally. We recommend one of the following invocations:
- Debugging:
build-script -r --debug-swift-stdlib
- Swift compiler is built with optimizations and assertions, but stdlib is full-debug
- Testing:
build-script -r
- Swift compiler and stdlib is built with both optimizations and assertions
- Benchmarking:
build-script -R --no-assertions
- Full optimizations, no debug info, no assertions
This is currently unsupported as we don't build on 32-bit platforms yet. Once we do, we will likely not have complete correctness of 32-bit until 64-bit is tackled.