mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
72c8c21104
Add a new --enable-caching option that enables compilation caching for both C/C++ (via clang-cache as compiler launcher) and Swift code (via -cache-compile-job flags when bootstrapping=hosttools). New options: - --enable-caching: main toggle, incompatible with --sccache/--distcc - --caching-cas-path: CAS directory (default: $BUILD_ROOT/cas) - --caching-depscan-socket: depscan daemon socket path - --caching-plugin-path: CAS plugin library path - --caching-plugin-option: CAS plugin options (repeatable) - --caching-prefix-map: enable source/SDK/toolchain prefix mapping - --caching-remote-service-path: remote caching service with auto plugin inference from Xcode and implied prefix mapping The build script starts a clang-cache depscan daemon with reliable cleanup via atexit and SIGTERM handlers. Per-product build directories get .cas-config and compilation-prefix-map.json files written automatically. Caching flags are applied to all Swift host compilation targets: compiler sources, pure-swift host libraries (ASTGen, macros), swift-syntax, and the new runtime build when --build-runtime-with-host-compiler is used. When not using --caching-remote-service-path, enables CAS backend (-Xfrontend -cas-backend -Xllvm -cas-friendly-debug-info) unless SWIFT_CACHE_DISABLE_MCCAS is set. A ninja wrapper is generated at build/<subdir>/build-utils/ninja for cached incremental builds outside the build-script. rdar://155876033 Assisted-By: Claude