Class: Pod::Generator::XCConfig::AggregateXCConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-podtarget-optimize.rb

Overview

Generates the xcconfigs for the aggregate targets.

Instance Method Summary collapse

Instance Method Details

#generateObject



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/cocoapods-podtarget-optimize.rb', line 106

def generate
  header_search_path_flags = target.sandbox.public_headers.search_paths(target.platform)
  @xcconfig = Xcodeproj::Config.new(
      'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target),
      'OTHER_LIBTOOLFLAGS' => '$(OTHER_LDFLAGS)',
      'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(header_search_path_flags),
      'PODS_ROOT' => target.relative_pods_root,
      'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
      'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_path_flags, '-isystem')
  )

  target.pod_targets.each do |pod_target|
    next unless pod_target.include_in_build_config?(@configuration_name)

    pod_target.file_accessors.each do |file_accessor|
      XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, @xcconfig)
      file_accessor.vendored_frameworks.each do |vendored_framework|
        XCConfigHelper.add_framework_build_settings(vendored_framework, @xcconfig, target.sandbox.root)
      end
      file_accessor.vendored_libraries.each do |vendored_library|
        XCConfigHelper.add_library_build_settings(vendored_library, @xcconfig, target.sandbox.root)
      end
    end

    # Add pod static lib to list of libraries that are to be linked with
    # the user’s project.

    ########################## Added ############################
    # only config when the target is exist
    next if pod_target.native_target.nil?
    ########################## Added ############################

    @xcconfig.merge!('OTHER_LDFLAGS' => %(-l "#{pod_target.name}"))
  end

  # TODO Need to decide how we are going to ensure settings like these
  # are always excluded from the user's project.
  #
  # See https://github.com/CocoaPods/CocoaPods/issues/1216
  @xcconfig.attributes.delete('USE_HEADERMAP')

  @xcconfig
end