How I keep my compiler up-to-date

Here’s my day-to-day workflow with some tricks that I have discovered.

I have a checkout of the compiler, which I set up using the instructions in “Building Swift for TensorFlow” ( up to and including the “Getting Sources for Swift and Related Projects”. I do not use any of the build commands that are suggested in that document though.

For my first build, I run SWIFT_PACKAGE=tensorflow_linux,no_test swift/utils/build-toolchain local.swift (from the parent directory of the swift repo).

For subsequent incremental builds, I cd into build/buildbot_linux/swift-linux-x86_64 and run ninja. TIP: You can run ninja swift to build just the compiler, which saves a lot of time if you don’t need to rebuild the standard library.

To get new changes I cd into swift and git pull origin tensorflow. If this changes any of the dependency references in update-checkout-config.json, I also cd into the parent and run swift/utils/update-checkout --scheme tensorflow --skip-repo swift. If it fails to update any repos, cd’ing into that repo and running git fetch origin usually fixes it.

If incremental compiles seem not to be working, I rm -rf build and then rerun the SWIFT_PACKAGE=tensorflow_linux,no_test swift/utils/build-toolchain local.swift.

Jupyter can be hooked up to the local build using python3 --sys-prefix --swift-build ~/swift-base/build/buildbot_linux/.