require_relative './target_definition' module Pod class Podfile class TargetDefinition # Returns the names of pod targets explicitly declared as prebuilt in Podfile using `:binary => true`. def explicit_prebuild_pod_names names = @explicit_prebuild_pod_names || [] names += parent.explicit_prebuild_pod_names if !parent.nil? && parent.is_a?(TargetDefinition) names end def reject_prebuild_pod_names names = @reject_prebuild_pod_names || [] names += parent.reject_prebuild_pod_names if !parent.nil? && parent.is_a?(TargetDefinition) names end def explicit_header_search_pod_names names = @explicit_header_search_pod_names || [] names += parent.explicit_header_search_pod_names if !parent.nil? && parent.is_a?(TargetDefinition) names end def reject_header_search_pod_names names = @reject_header_search_pod_names || [] names += parent.reject_header_search_pod_names if !parent.nil? && parent.is_a?(TargetDefinition) names end end end end module Pod class Installer # Returns the names of pod targets detected as prebuilt, including # those declared in Podfile and their dependencies def prebuild_pod_names prebuilt_pod_targets.map(&:name).to_set end # Returns the pod targets detected as prebuilt, including # those declared in Podfile and their dependencies def prebuilt_pod_targets @prebuilt_pod_targets ||= begin explicit_prebuild_pod_names = aggregate_targets.flat_map { |target| target.target_definition.explicit_prebuild_pod_names }.uniq reject_prebuild_pod_names = aggregate_targets.flat_map { |target| target.target_definition.reject_prebuild_pod_names }.uniq available_pod_names = [] check_sandbox = Jxedt::Sandbox.from_sandbox(self.sandbox) available_pod_names = check_sandbox.target_paths.map {|path| path.basename.to_s } if Jxedt.config.all_binary_enabled? explicit_prebuild_pod_names = available_pod_names else explicit_prebuild_pod_names = (explicit_prebuild_pod_names & available_pod_names).uniq end explicit_prebuild_pod_names -= reject_prebuild_pod_names targets = pod_targets.select { |target| explicit_prebuild_pod_names.include?(target.pod_name) } targets = targets.reject { |target| sandbox.local?(target.pod_name) } unless Jxedt.config.dev_pods_enabled? targets.reject! { |target| Jxedt.config.excluded_pods.include?(target.pod_name) } targets.map { |target| target.use_binary = true } targets end end end end module Pod class Target attr_accessor :use_binary def frame_header_search_paths_enable? return false if reject_header_search_pod_names.include? self.name return true if explicit_header_search_pod_names.include? self.name self.use_binary && Jxedt.config.framework_header_search_enabled? end def explicit_header_search_pod_names @explicit_header_search_pod_names ||= begin target_definitions.flat_map { |target_definition| target_definition.explicit_header_search_pod_names }.uniq end end def reject_header_search_pod_names @reject_header_search_pod_names ||= begin target_definitions.flat_map { |target_definition| target_definition.reject_header_search_pod_names }.uniq end end end end module Pod class Lockfile def spec_checksums_hash_key(name) # git分支或commit依赖的组件的checksum值是用podspec文件做的hash,hash可能不变,所以有commitid时校验commitid checkout_options = self.internal_data["CHECKOUT OPTIONS"] || {} checksum = checkout_options[name][:commit] unless checkout_options[name].nil? return checksum unless checksum.nil? checksums_hash = self.internal_data["SPEC CHECKSUMS"] return checksums_hash[name] if checksums_hash.include?("#{name}") end end end