Skip to content

Introduce support for Clang/Swift compilation caching#10246

Open
owenv wants to merge 1 commit into
swiftlang:mainfrom
owenv:owenv/compilationcaching
Open

Introduce support for Clang/Swift compilation caching#10246
owenv wants to merge 1 commit into
swiftlang:mainfrom
owenv:owenv/compilationcaching

Conversation

@owenv

@owenv owenv commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Implements support for Clang/Swift compilation caching integration as described in the draft evolution proposal at https://gist.github.com/owenv/4d0f48e30df77a418eea1968223e8033

Caching can be configured either via CLI options of package-local/global configuration. Internally, it maps to Swift Build settings overrides which enable the feature in the underlying build system

@cachemeifyoucan

Copy link
Copy Markdown
Contributor

Generally LGTM. I don't mind just set explicit module by default in caching so there won't be a dependency on swift-build change.

Can we also wire up following swift-build config to a swiftpm argument?

  • COMPILATION_CACHE_REMOTE_SERVICE_PATH
  • COMPILATION_CACHE_PLUGIN_PATH
  • CLANG_ENABLE_PREFIX_MAPPING/SWIFT_ENABLE_PREFIX_MAPPING/CLANG_ENABLE_PROJECT_PREFIX_MAPPING/SWIFT_ENABLE_PROJECT_PREFIX_MAPPING

@owenv owenv force-pushed the owenv/compilationcaching branch 2 times, most recently from bcba441 to c987fa5 Compare July 1, 2026 17:26
@owenv owenv force-pushed the owenv/compilationcaching branch from c987fa5 to 0be7994 Compare July 4, 2026 20:22
@owenv owenv changed the title [WIP] Introduce support for Clang/Swift compilation caching Introduce support for Clang/Swift compilation caching Jul 4, 2026
@owenv

owenv commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Comment thread Tests/CommandsTests/PackageCommandTests.swift Outdated
Comment thread Tests/CommandsTests/PackageCommandTests.swift Outdated

// MARK: - Build cache

extension Workspace.Configuration {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Can we can automated tests that verify the newly added Workspace.Configuration code in isolation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this would be mostly redundant

Comment thread Tests/CommandsTests/PackageCommandTests.swift
Comment thread Tests/SwiftBuildSupportTests/SwiftBuildSystemTests.swift Outdated
Comment thread Sources/Commands/PackageCommands/BuildCacheCommand.swift Outdated
Comment thread Sources/Commands/PackageCommands/BuildCacheCommand.swift Outdated
Comment thread Sources/Workspace/Workspace+Configuration.swift Outdated
Comment thread Sources/PackageModel/BuildCacheConfiguration.swift Outdated
Comment thread Sources/PackageModel/BuildCacheConfiguration.swift Outdated
@owenv owenv force-pushed the owenv/compilationcaching branch from 0be7994 to 42dcdab Compare July 9, 2026 21:27
@owenv

owenv commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@swift-ci test

@owenv

owenv commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@swift-ci test windows

@cachemeifyoucan cachemeifyoucan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the config and build parameters. LGTM.

Only nit is if we need to warn if people selecting compilation cache and a non-swift-build build system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants