Skip to content

milseman/UTF8String

Repository files navigation

UTF8String

Just some shims, hacks, etc., so that portions of the standard library can be built via an SPM package.

Set up

1. Install a recent trunk development toolchain (master)

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)".

2. Clone the repos

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

Using as a Full-Fledged Standard Library

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

Commentary

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:

Downsides

  • 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

Upsides

  • Toolchain definitions still available
    • Test that compare behavior differences between shadowed functionality and the toolchain's

Building as a Standard Library

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

Building as a Toolchain

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published