module Pod::Generator::XCConfig::XCConfigHelper
Public Class Methods
search_paths_for_dependent_targets(target, dependent_targets, test_xcconfig = false)
click to toggle source
override
Manually checked the 1.5.3/ 1.5.2/ 1.5.1, they are all the same. So it's safe. 1.5.0 is slightly different at Line 147 (`dependent_targets.uniq.combination(2) do |a, b|`) with no `uniq`, but I think it's not a problem.
# File lib/cocoapods-fix-module/patch1.5.rb, line 163 def self.search_paths_for_dependent_targets(target, dependent_targets, test_xcconfig = false) ## ---- modified # dependent_targets = dependent_targets.select(&:should_build?) dependent_targets = dependent_targets.select { |target| target.should_build? || target.should_generate_module_map_for_a_pod_should_not_build? } ## ---- modifed end # # contentx below is copied from original method # Filter out dependent targets that are subsets of another target. subset_targets = [] dependent_targets.uniq.combination(2) do |a, b| if (a.specs - b.specs).empty? subset_targets << a elsif (b.specs - a.specs).empty? subset_targets << b end end dependent_targets -= subset_targets # Alias build dirs to avoid recursive definitions for pod targets and depending # on build settings which could be overwritten in the user target. build_settings = { BUILD_DIR_VARIABLE[2..-2] => '${BUILD_DIR}', CONFIGURATION_BUILD_DIR_VARIABLE[2..-2] => "#{BUILD_DIR_VARIABLE}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)", } # Scope pod targets as long as they are not test targets. if !test_xcconfig && target.respond_to?(:configuration_build_dir) build_settings['CONFIGURATION_BUILD_DIR'] = target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE) end module_map_files = [] unless dependent_targets.empty? framework_search_paths = [] library_search_paths = [] swift_import_paths = [] dependent_targets.each do |dependent_target| if dependent_target.requires_frameworks? framework_search_paths << dependent_target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE) else ### -------------- modified --------------- # library_search_paths << dependent_target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE) # --- to ---- if dependent_target.should_build? library_search_paths << dependent_target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE) end ### -------------- \modified --------------- if dependent_target.defines_module? module_map_file = if dependent_target.uses_swift? # for swift, we have a custom build phase that copies in the module map, appending the .Swift module "${PODS_CONFIGURATION_BUILD_DIR}/#{dependent_target.label}/#{dependent_target.product_module_name}.modulemap" else "${PODS_ROOT}/#{dependent_target.module_map_path.relative_path_from(dependent_target.sandbox.root)}" end module_map_files << %(-fmodule-map-file="#{module_map_file}") swift_import_paths << dependent_target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE) if dependent_target.uses_swift? end end end build_settings['FRAMEWORK_SEARCH_PATHS'] = XCConfigHelper.quote(framework_search_paths.uniq) build_settings['LIBRARY_SEARCH_PATHS'] = XCConfigHelper.quote(library_search_paths.uniq) build_settings['SWIFT_INCLUDE_PATHS'] = XCConfigHelper.quote(swift_import_paths.uniq) end other_swift_flags = module_map_files.tap(&:uniq!).flat_map { |f| ['-Xcc', f] } if target.is_a?(PodTarget) && !target.requires_frameworks? && target.defines_module? && !test_xcconfig # make it possible for a mixed swift/objc static library to be able to import the objc from within swift other_swift_flags += ['-import-underlying-module', '-Xcc', '-fmodule-map-file="${SRCROOT}/${MODULEMAP_FILE}"'] end # unconditionally set these, because of (the possibility of) having to add the pod targets own module map file build_settings['OTHER_CFLAGS'] = module_map_files.join(' ') build_settings['OTHER_SWIFT_FLAGS'] = other_swift_flags.join(' ') build_settings end