swift
01329546 - [build-script] Skip standalone swift/lldb passes under unified LLVM layout

Commit
61 days ago
[build-script] Skip standalone swift/lldb passes under unified LLVM layout When the preset enables `-DLLVM_EXTERNAL_PROJECTS=swift` (i.e. `unified_llvm`), LLVM's ninja graph already compiles swift-frontend, the host stdlib, and LLDB. The subsequent build-script-impl swift and lldb passes reconfigure and recompile the same thing in `swift-<host>/` and `lldb-<host>/`, wasting ~20-30 min on the critical path. Skipping both drops that duplicate work. To keep downstream products (swiftpm, swiftsyntax, sourcekit-lsp, …) working, `install-llvm` has to hand them a complete Swift install under `<install_destdir>/…/usr` rather than the tiny llvm-only component set the preset asks for. Achieved with three coupled tweaks: * Add Swift.is_unified_llvm_build(args) — detects the layout by scanning args.extra_llvm_cmake_options for `-DLLVM_EXTERNAL_PROJECTS=<...>swift<...>`. * In build_script_invocation, when the layout is on, set args.build_swift = False and args.build_lldb = False so build-script-impl gets `--skip-build-{swift,lldb}` and drops those products entirely. Skipping lldb also sidesteps a LLDBStandalone CMake failure that looks for swift-<host>/lib/cmake/swift/SwiftConfig.cmake, which no longer exists once the swift pass is skipped. * Fold `--swift-install-components=…` (from the preset) into args.llvm_install_components so `install-llvm` runs each swift component's `install-<component>` target off the unified ninja graph. Auto-add `compiler-swift-syntax-lib` and `swift-syntax-lib` whenever `compiler` is present, matching the dependency SwiftComponents.cmake normally adds itself; and pass `-DSWIFT_INSTALL_COMPONENTS=<merged list>` into args.extra_llvm_cmake_options so the swift subproject inside LLVM's CMake sees the full component list. Without that last step the cached SWIFT_INSTALL_COMPONENTS omits entries like `clang-resource-dir-symlink`, their install actions become no-ops via `swift_is_installing_component`, and the install step silently completes without producing e.g. the `lib/swift/clang` symlink or the plugin dylibs. Verified locally: with the change, the swift and lldb build phases are dropped, `install-llvm` places `swiftc`, `libTestingMacros.dylib`, `lib_CompilerSwiftIDEUtils.dylib`, and the `lib/swift/clang -> ../clang/21` symlink in the install destdir, and downstream products configure against that toolchain unchanged.
Author
Committer
Parents
Loading