Skip to content

Commit

Permalink
Merge pull request #136 from polac24/20220517-fix-vendored-frameworks
Browse files Browse the repository at this point in the history
Support Vendored frameworks in the CocoaPods development pod
  • Loading branch information
polac24 authored May 19, 2022
2 parents 91505a5 + 03671e7 commit 75bef0b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 0 additions & 4 deletions cocoapods-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
16 changes: 12 additions & 4 deletions cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -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)")
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.

module CocoapodsXcremotecache
VERSION = "0.0.11"
VERSION = "0.0.12"
end

0 comments on commit 75bef0b

Please sign in to comment.