Getting Swift sources and setting up build environment to implement Swift Local Refactoring action.
When it comes to cloning source code and building it, there’s not that much that I can add to the Swift repository README, but I’ll try to highlight some moments that I find to be important.
I can’t stress enough how important this step is!
If you use wrong version of Xcode you will be banging your head against the wall trying to figure out why the build is OK, the tests pass, but you changes do not show up in the Xcode when you choose your new toolchain.
Don’t forget to use latest Xcode when building from command line, for example, if you installed latest Xcode 10.2 beta to
/Applications/Xcode-10.2.app, then run this in terminal
If you want to use source code that has passed Swift CI then, after pulling in all the code, you can customize your
update-checkout command like so
If the build was tagged, it means it passed all the tests and had a successful Xcode toolchain build. It may be a good idea to work on top of a stable code.
Building Xcode Toolchain
Apple docs just tell you to run
./utils/build-toolchain $BUNDLE_PREFIX command to build a new toolchain. It works, however, the command takes really long time and doesn’t seem to take advantage of incremental builds when you re-run it.
Instead, you can package a toolchain using build artifacts created with
Once the build is over, you can use this script to create a toolchain in just few seconds.
SWIFT_SOURCE_PATH to root of your Swift sources location and run the script from that location. Optionally customize