From 03671e71b73d9d0dd1ae11b1cb5ba6adaded7c0a Mon Sep 17 00:00:00 2001 From: Bartosz Polaczyk Date: Tue, 17 May 2022 19:46:15 +0200 Subject: [PATCH] Support Vendored frameworks in the CocoaPods plugin --- cocoapods-plugin/README.md | 4 ---- .../lib/cocoapods-xcremotecache/command/hooks.rb | 16 ++++++++++++---- .../lib/cocoapods-xcremotecache/gem_version.rb | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/cocoapods-plugin/README.md b/cocoapods-plugin/README.md index ca2ad0e7..ed2bd3ad 100644 --- a/cocoapods-plugin/README.md +++ b/cocoapods-plugin/README.md @@ -63,7 +63,3 @@ To fully uninstall the plugin, call: ```bash gem uninstall cocoapods-xcremotecache ``` - -## Limitations - -* When `generate_multiple_pod_projects` mode is enabled, only first-party targets are cached by XCRemoteCache (all dependencies are compiled locally). diff --git a/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb b/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb index a3eb53ca..f155579d 100644 --- a/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb +++ b/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb @@ -27,8 +27,9 @@ module Hooks LLDB_INIT_COMMENT="#RemoteCacheCustomSourceMap" LLDB_INIT_PATH = "#{ENV['HOME']}/.lldbinit" FAT_ARCHIVE_NAME_INFIX = 'arm64-x86_64' + XCRC_COOCAPODS_ROOT_KEY = 'XCRC_COOCAPODS_ROOT' - # List of plugins' user properties that should be copied to .rcinfo + # List of plugins' user properties that should not be copied to .rcinfo CUSTOM_CONFIGURATION_KEYS = [ 'enabled', 'xcrc_location', @@ -38,9 +39,7 @@ module Hooks 'check_build_configuration', 'check_platform', 'modify_lldb_init', - 'prettify_meta_files', 'fake_src_root', - 'disable_certificate_verification' ] class XCRemoteCache @@ -64,9 +63,14 @@ def self.set_configuration_default_values 'exclude_targets' => [], 'prettify_meta_files' => false, 'fake_src_root' => "/#{'x' * 10 }", - 'disable_certificate_verification' => false + 'disable_certificate_verification' => false, + 'custom_rewrite_envs' => [] } @@configuration.merge! default_values.select { |k, v| !@@configuration.key?(k) } + # Always include XCRC_COOCAPODS_ROOT_KEY in custom_rewrite_envs + unless @@configuration['custom_rewrite_envs'].include?(XCRC_COOCAPODS_ROOT_KEY) + @@configuration['custom_rewrite_envs'] << XCRC_COOCAPODS_ROOT_KEY + end end def self.validate_configuration() @@ -109,6 +113,8 @@ def self.parent_dir(path, parent_count) # @param final_target [String] name of target that should trigger marking def self.enable_xcremotecache(target, repo_distance, xc_location, xc_cc_path, mode, exclude_build_configurations, final_target, fake_src_root) srcroot_relative_xc_location = parent_dir(xc_location, repo_distance) + # location of the entrite CocoaPods project, relative to SRCROOT + srcroot_relative_project_location = parent_dir('', repo_distance) target.build_configurations.each do |config| # apply only for relevant Configurations @@ -124,6 +130,7 @@ def self.enable_xcremotecache(target, repo_distance, xc_location, xc_cc_path, mo 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)"] + config.build_settings[XCRC_COOCAPODS_ROOT_KEY] = ["$SRCROOT/#{srcroot_relative_project_location}"] debug_prefix_map_replacement = '$(SRCROOT' + ':dir:standardizepath' * repo_distance + ')' add_cflags!(config.build_settings, '-fdebug-prefix-map', "#{debug_prefix_map_replacement}=$(XCREMOTE_CACHE_FAKE_SRCROOT)") add_swiftflags!(config.build_settings, '-debug-prefix-map', "#{debug_prefix_map_replacement}=$(XCREMOTE_CACHE_FAKE_SRCROOT)") @@ -204,6 +211,7 @@ def self.disable_xcremotecache_for_target(target) # Remove Fake src root for ObjC & Swift config.build_settings.delete('XCREMOTE_CACHE_FAKE_SRCROOT') config.build_settings.delete('XCRC_PLATFORM_PREFERRED_ARCH') + config.build_settings.delete(XCRC_COOCAPODS_ROOT_KEY) remove_cflags!(config.build_settings, '-fdebug-prefix-map') remove_swiftflags!(config.build_settings, '-debug-prefix-map') end diff --git a/cocoapods-plugin/lib/cocoapods-xcremotecache/gem_version.rb b/cocoapods-plugin/lib/cocoapods-xcremotecache/gem_version.rb index d582592d..bcfe6fe8 100644 --- a/cocoapods-plugin/lib/cocoapods-xcremotecache/gem_version.rb +++ b/cocoapods-plugin/lib/cocoapods-xcremotecache/gem_version.rb @@ -13,5 +13,5 @@ # limitations under the License. module CocoapodsXcremotecache - VERSION = "0.0.11" + VERSION = "0.0.12" end