module Pod class Podfile class TargetDefinition def detect_prebuilt_pod(name, requirements) options = requirements.last || {} # prebuild @explicit_prebuild_pod_names ||= [] @reject_prebuild_pod_names ||= [] if options.is_a?(Hash) && options.include?(:binary) @explicit_prebuild_pod_names << Specification.root_name(name) if options[:binary] @reject_prebuild_pod_names << Specification.root_name(name) unless options[:binary] end # header search path @explicit_header_search_pod_names ||= [] @reject_header_search_pod_names ||= [] if options.is_a?(Hash) && options.include?(:framework_header_search) @explicit_header_search_pod_names << Specification.root_name(name) if options[:framework_header_search] @reject_header_search_pod_names << Specification.root_name(name) unless options[:framework_header_search] end options.delete(:binary) if options.is_a?(Hash) options.delete(:framework_header_search) if options.is_a?(Hash) requirements.pop if options.empty? end # ---- patch method ---- # We want modify `store_pod` method, but it's hard to insert a line in the # implementation. So we patch a method called in `store_pod`. original_parse_inhibit_warnings = instance_method(:parse_inhibit_warnings) define_method(:parse_inhibit_warnings) do |name, requirements| detect_prebuilt_pod(name, requirements) # merge binary settings Jxedt.config.binary_settings.each { |name, val| next if @explicit_prebuild_pod_names.include?(name) # 配置:binary的组件优先级高 next if @reject_prebuild_pod_names.include?(name) next unless [true, false].include?(val) @explicit_prebuild_pod_names << name.to_s if val @reject_prebuild_pod_names << name.to_s unless val } original_parse_inhibit_warnings.bind(self).call(name, requirements) end end end end