Sha256: 3b7604628c35ff907fb36b41ffa5f8466331a17fccbbf907df3c178abff8a405

Contents?: true

Size: 1.76 KB

Versions: 1

Compression:

Stored size: 1.76 KB

Contents

module Pod

  class Static
    def self.keyword
      :static
    end
  end

  class Podfile

    class TargetDefinition

      def parse_force_static_framework(name, requirements)
        options = requirements.last
        if options.is_a?(Hash) && options[Pod::Static.keyword] != nil
          should_static = options.delete(Pod::Static.keyword)
          requirements.pop if options.empty?
          pod_name = Specification.root_name(name)
          if should_static
            @force_static_framework_names ||= []
            @force_static_framework_names.push pod_name
          end
        end
      end

      def force_static_framework_names
        names = @force_static_framework_names || []
        if parent != nil and parent.kind_of? TargetDefinition
            names += parent.force_static_framework_names
        end
        names
      end

      old_method = instance_method(:parse_inhibit_warnings)

      define_method(:parse_inhibit_warnings) do |name, requirements|
        parse_force_static_framework(name, requirements)
        old_method.bind(self).(name, requirements)
      end

    end
  end

  class PodTarget

    old_method = instance_method(:initialize)

    define_method(:initialize) do |sandbox, host_requires_frameworks, user_build_configurations, archs, platform, specs, target_definitions, file_accessors, scope_suffix, build_type|
      reval = build_type[:build_type]
      if target_definitions.first.force_static_framework_names.include?(Specification.root_name(specs.first.name))
        reval = Target::BuildType.static_framework
      end
      old_method.bind(self).(sandbox, host_requires_frameworks, user_build_configurations, archs, platform, specs, target_definitions, file_accessors, scope_suffix, :build_type => reval)
    end
    
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cocoapods-force-static-framework-0.0.3 lib/cocoapods-force-static-framework/command/framework.rb