TL;DR: The very idea of pinning down a specific configuration and set of targets before you start working is wrong.
For any of you who care to see how convoluted my workflow is, here you go...
I try not to use build-script for anything except an initial CMake invocation:
build-script --release --llvm-assertions --swift-assertions --no-swift-stdlib-assertions --build-subdir=ra --skip-build -- --install-prefix=/usr --toolchain-prefix=/
It's very commmon for people to forget this flag: --no-swift-stdlib-assertions, and assume they meaningfully measure run time.
Initial build for basic testing:
$ ninja
Occasionally I need to build for iOS on top of the existing build:
$ ninja swift-stdlib-iphoneos-arm64
I often need to build the debug compiler on top of the existing build:
-
build-script --release --llvm-assertions --debug-swift --swift-assertions --no-swift-stdlib-assertions --build-subdir=d --skip-build
-
"Manually" copy the llvm release build directory into the debug llvm build dir.
-
Build the swift compiler:
$ ninja swift sil-opt
-
"Manually" copy stdlib and overlays from the Swift release build into the debug build dir.
I often need to build benchmarks on top of the existing build:
$ cmake <swift-source>/benchmark -G Ninja -DSWIFT_EXEC=<swift-build>/bin/swiftc -DONLY_PLATFORMS=macosx
$ ninja swift-benchmark-macosx-x86_64
- "Manually" copy swift dylibs into the benchmark directory
I sometimes need build other toolchain components. I usually can't get that to work without rerunning the build-script, so I reinvoke it, making sure the options are exactly the same, omitting '--skip-build', adding a ton of options:
$ build-script --release --llvm-assertions --swift-assertions --no-swift-stdlib-assertions --build-subdir=ra --ios --tvos --watchos --skip-build-ios-simulator --skip-build-tvos-simulator --skip-build-watchos-simulator --skip-build-benchmarks --llbuild --swiftpm --libcxx --compiler-vendor = apple -- --install-prefix=/usr --toolchain-prefix=/ --install-swift --install-llbuild --install-swiftpm --install-destdir=<dir> --swift-install-components=compiler;clang-resource-dir-symlink;stdlib;sdk-overlay;parser-lib;license;sourcekit-xpc-service;swift-remote-mirror;swift-remote-mirror-headers --llvm-install-components=llvm-cov;llvm-profdata;IndexStore;clang;clang-headers;compiler-rt;clangd <define a bunch of variables>
For some reason, I also need to add a bunch of "darwin-toolchain" variable definitions at the end of the build-script invocation for it to produce the toolchain.
It drives me crazy that our build script is a monolithic mess with no clean separation between targets, actions, and configuration. We should be able to incrementally build for additional targets/platforms and build products without starting over!