From fbc2982aa3882674fa483b54d9fb67bb01ce9b08 Mon Sep 17 00:00:00 2001 From: Bartosz Polaczyk Date: Sat, 18 Jun 2022 17:43:33 +0200 Subject: [PATCH 1/2] [Xcode 14.0] Disable Swift integration driver --- README.md | 1 + .../Prepare/Integrate/BuildSettingsIntegrateAppender.swift | 1 + cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb | 2 ++ 3 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 55d42e80..55476b55 100755 --- a/README.md +++ b/README.md @@ -197,6 +197,7 @@ Configure Xcode targets that **should use** XCRemoteCache: * `LIBTOOL` - location of `xclibtool` (e.g. `xcremotecache/xclibtool`) * `LD` - location of `xcld` (e.g. `xcremotecache/xcld`) * `XCRC_PLATFORM_PREFERRED_ARCH` - `$(LINK_FILE_LIST_$(CURRENT_VARIANT)_$(PLATFORM_PREFERRED_ARCH):dir:standardizepath:file:default=arm64)` +* `SWIFT_USE_INTEGRATED_DRIVER` - `NO` (required in Xcode 14.0+)
Screenshot diff --git a/Sources/XCRemoteCache/Commands/Prepare/Integrate/BuildSettingsIntegrateAppender.swift b/Sources/XCRemoteCache/Commands/Prepare/Integrate/BuildSettingsIntegrateAppender.swift index 64bdbdd1..85d08cb5 100644 --- a/Sources/XCRemoteCache/Commands/Prepare/Integrate/BuildSettingsIntegrateAppender.swift +++ b/Sources/XCRemoteCache/Commands/Prepare/Integrate/BuildSettingsIntegrateAppender.swift @@ -44,6 +44,7 @@ class XcodeProjBuildSettingsIntegrateAppender: BuildSettingsIntegrateAppender { func appendToBuildSettings(buildSettings: BuildSettings, wrappers: XCRCBinariesPaths) -> BuildSettings { var result = buildSettings result["SWIFT_EXEC"] = wrappers.swiftc.path + result["SWIFT_USE_INTEGRATED_DRIVER"] = "NO" // When generating artifacts, no need to shell-out all compilation commands to our wrappers if case .consumer = mode { result["CC"] = wrappers.cc.path diff --git a/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb b/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb index f155579d..cead22ad 100644 --- a/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb +++ b/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb @@ -127,6 +127,7 @@ def self.enable_xcremotecache(target, repo_distance, xc_location, xc_cc_path, mo config.build_settings['SWIFT_EXEC'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xcswiftc"] config.build_settings['LIBTOOL'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xclibtool"] config.build_settings['LD'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xcld"] + config.build_settings['SWIFT_USE_INTEGRATED_DRIVER'] = ['NO'] config.build_settings['XCREMOTE_CACHE_FAKE_SRCROOT'] = fake_src_root config.build_settings['XCRC_PLATFORM_PREFERRED_ARCH'] = ["$(LINK_FILE_LIST_$(CURRENT_VARIANT)_$(PLATFORM_PREFERRED_ARCH):dir:standardizepath:file:default=arm64)"] @@ -208,6 +209,7 @@ def self.disable_xcremotecache_for_target(target) config.build_settings.delete('SWIFT_EXEC') if config.build_settings.key?('SWIFT_EXEC') config.build_settings.delete('LIBTOOL') if config.build_settings.key?('LIBTOOL') config.build_settings.delete('LD') if config.build_settings.key?('LD') + config.build_settings.delete('SWIFT_USE_INTEGRATED_DRIVER') if config.build_settings.key?('SWIFT_USE_INTEGRATED_DRIVER') # Remove Fake src root for ObjC & Swift config.build_settings.delete('XCREMOTE_CACHE_FAKE_SRCROOT') config.build_settings.delete('XCRC_PLATFORM_PREFERRED_ARCH') From e978eb182ccc2603e8fe8c14ce261d42226e00e8 Mon Sep 17 00:00:00 2001 From: Bartosz Polaczyk Date: Sat, 18 Jun 2022 17:51:54 +0200 Subject: [PATCH 2/2] Add limitation --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7428e505..fdf8e7e9 100755 --- a/README.md +++ b/README.md @@ -418,6 +418,7 @@ Note: This setup is not recommended and may not be supported in future XCRemoteC * Swift Package Manager (SPM) dependencies are not supported. _Because SPM does not allow customizing Build Settings, XCRemoteCache cannot specify `clang` and `swiftc` wrappers that control if the local compilation should be skipped (cache hit) or not (cache miss)_ * Filenames with `_vers.c` suffix are reserved and cannot be used as a source file * All compilation files should be referenced via the git repo root. Referencing `/AbsolutePath/someOther.swift` or `../../someOther.swift` that resolve to the location outside of the git repo root is prohibited. +* The new Swift driver (introduced by default in Xcode 14.0) is not supported and has to be disabled when using XCRemoteCache ## FAQ