Sha256: 15e1ce485d8be95d767b314e2c1607598c21c6d05ad6b505a547462a6c897ab1

Contents?: true

Size: 1.45 KB

Versions: 1

Compression:

Stored size: 1.45 KB

Contents

module Pod
  class Podfile
    class TargetDefinition
      def detect_prebuilt_pod(name, requirements)
        @explicit_prebuilt_pod_names ||= []
        options = requirements.last || {}
        if Pod::Podfile::DSL.prebuild_all?
          @explicit_prebuilt_pod_names << Specification.root_name(name)
        elsif options.is_a?(Hash) && options[:binary]
          @explicit_prebuilt_pod_names << Specification.root_name(name)
        end
        options.delete(:binary) if options.is_a?(Hash)
        requirements.pop if options.empty?
      end

      # Returns the names of pod targets explicitly declared as prebuilt in Podfile
      # using `:binary => true`.
      # In case `prebuild_all` is ON via `config_cocoapods_binary_cache`, returns the
      # name of all pod targets
      def explicit_prebuilt_pod_names
        names = @explicit_prebuilt_pod_names || []
        names += parent.explicit_prebuilt_pod_names if !parent.nil? && parent.is_a?(TargetDefinition)
        names
      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)
        original_parse_inhibit_warnings.bind(self).call(name, requirements)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cocoapods-binary-cache-0.1.5 lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/target_definition.rb