Commit Graph

20 Commits

Author SHA1 Message Date
Steven Wu 72c8c21104 [build-script] Add --enable-caching support with clang-cache and Swift compilation caching
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
2026-04-29 14:42:17 -07:00
Anthony Latsis a8c5f45da5 [docs] Suggest ninja bin/swift-frontend instead of ninja swift-frontend
...to cope with a bootstrapping quirk on arm64 Macs.
2023-02-06 13:09:28 +03:00
Anthony Latsis 7c84923239 [docs] Move instructions for using Ninja with Xcode to GettingStarted.md 2022-10-27 07:21:12 +03:00
Anthony Latsis 7532e1d92a [docs] Improve instructions for using Ninja with Xcode 2022-10-27 07:21:02 +03:00
Anthony Latsis a358701255 [docs] Fix a typo in an invocation 2022-10-25 09:29:01 +03:00
Jager-yoo d8b95440d3 [docs] Fix typo in DevelopmentTips.md 2022-08-21 23:53:44 +09:00
Casper Jeukendrup b57104961a Fix typo in docs/DevelopmentTips.md: boostrapping -> bootstrapping 2022-08-20 00:13:47 +02:00
Egor Zhdan b64c2b071a [SwiftCompilerSources][docs] Describe using hosttools builds with a locally built toolchain 2022-06-20 13:30:38 +01:00
Erik Eckstein c053ab623c docs: a few minor fixes/improvements in DevelopmentTips.md 2022-05-23 14:45:32 +02:00
Erik Eckstein eb51264f57 docs: add documentation about the bootstrapping modes 2022-05-23 10:46:32 +02:00
Erik Eckstein d97b786ca4 docs: document working with two build directories 2022-05-23 10:46:32 +02:00
Erik Eckstein 5566c7529e docs: describe how to use Xcode together with ninja 2022-05-23 10:46:32 +02:00
Josh Soref 0213f2dd88 Spelling docs (#42437)
* spelling: any

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: associated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: async

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: classes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: clonability

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: conspicuously

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: constituent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: constraint

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: contains

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: definition

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: digestible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: for

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: github

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: javascript

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: manually

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: much

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multi

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: occasionally

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: outputs

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: overriding

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: partition

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: propagation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: protocol

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: quandary

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: redundant

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: responsible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: right

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: specifically

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: suppose

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: that

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: the

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: with

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-19 14:04:59 -07:00
Dave Abrahams 94f2c0d020 Further clarification 2021-01-07 14:13:17 -08:00
Dave Abrahams 1ca367d4a0 sccache will start itself 2021-01-07 14:09:27 -08:00
Dave Abrahams fcd054f448 Clarify SWIFT_USE_SCCACHE meaning 2021-01-06 11:38:11 -08:00
Cassie Jones 6d92486c9a [build-script] Add SWIFT_ prefix to USE_SCCACHE env var 2020-09-30 19:37:25 -04:00
Cassie Jones e01893cb56 [build-script] Add a flag for sccache
This adds a flag to enable sccache in order to simplify the build-script
invocation, particularly for new contributors.
2020-09-30 16:49:34 -04:00
Roopesh Chander 5e2fe48d3a [docs] Add a 'Memory usage' section to DevelopmentTips.md 2020-02-11 06:14:56 +00:00
Varun Gandhi 2488f4801c [docs] Add a DevelopmentTips.md file. (#28248) 2019-11-18 10:39:14 -08:00