Class: Pod::Podfile::TargetDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-core/podfile/target_definition.rb

Overview

The TargetDefinition stores the information of a CocoaPods static library. The target definition can be linked with one or more targets of the user project.

Target definitions can be nested and by default inherit the dependencies of the parent.

Attributes collapse

PLATFORM_DEFAULTS =

————————————–#

{ :ios => '4.3', :osx => '10.6', :tvos => '9.0', :watchos => '2.0' }.freeze

Representations collapse

HASH_KEYS =

Returns The keys used by the hash representation of the target definition.

Returns:

  • (Array)

    The keys used by the hash representation of the target definition.

%w(
  name
  platform
  podspecs
  exclusive
  link_with
  link_with_first_target
  inhibit_warnings
  use_modular_headers
  user_project_path
  build_configurations
  dependencies
  script_phases
  children
  configuration_pod_whitelist
  uses_frameworks
  inheritance
  abstract
  swift_version
).freeze

Instance Attribute Summary collapse

Attributes collapse

Representations collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, parent, internal_hash = nil) ⇒ TargetDefinition

Returns a new instance of TargetDefinition.

Parameters:



22
23
24
25
26
27
28
29
30
31
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 22

def initialize(name, parent, internal_hash = nil)
  @internal_hash = internal_hash || {}
  @parent = parent
  @children = []
  @label = nil
  self.name ||= name
  if parent.is_a?(TargetDefinition)
    parent.children << self
  end
end

Instance Attribute Details

#childrenArray<TargetDefinition>

Returns the children target definitions.

Returns:



35
36
37
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 35

def children
  @children
end

#parentTargetDefinition, Podfile (readonly)

Returns the parent target definition or the Podfile if the receiver is root.

Returns:



14
15
16
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 14

def parent
  @parent
end

Class Method Details

.from_hash(hash, parent) ⇒ TargetDefinition

Configures a new target definition from the given hash.

Parameters:

  • the (Hash)

    hash which contains the information of the Podfile.

Returns:



758
759
760
761
762
763
764
765
766
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 758

def self.from_hash(hash, parent)
  internal_hash = hash.dup
  children_hashes = internal_hash.delete('children') || []
  definition = TargetDefinition.new(nil, parent, internal_hash)
  children_hashes.each do |child_hash|
    TargetDefinition.from_hash(child_hash, definition)
  end
  definition
end

Instance Method Details

#abstract=(abstract) ⇒ void

This method returns an undefined value.

Sets whether this target definition is abstract.

Parameters:

  • abstract (Boolean)

    whether this target definition is abstract.



168
169
170
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 168

def abstract=(abstract)
  set_hash_value('abstract', abstract)
end

#abstract?Boolean

Returns whether this target definition is abstract.

Returns:

  • (Boolean)

    whether this target definition is abstract.



157
158
159
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 157

def abstract?
  get_hash_value('abstract', root?)
end

#all_whitelisted_configurationsArray<String>

Returns unique list of all configurations for which pods have been whitelisted.

Returns:

  • (Array<String>)

    unique list of all configurations for which pods have been whitelisted.



453
454
455
456
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 453

def all_whitelisted_configurations
  parent_configurations = (root? || inheritance == 'none') ? [] : parent.all_whitelisted_configurations
  (configuration_pod_whitelist.keys + parent_configurations).uniq
end

#build_configurationsHash{String => symbol}

Returns A hash where the keys are the name of the build configurations and the values a symbol that represents their type (‘:debug` or `:release`).

Returns:

  • (Hash{String => symbol})

    A hash where the keys are the name of the build configurations and the values a symbol that represents their type (‘:debug` or `:release`).



269
270
271
272
273
274
275
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 269

def build_configurations
  if root?
    get_hash_value('build_configurations')
  else
    get_hash_value('build_configurations') || parent.build_configurations
  end
end

#build_configurations=(hash) ⇒ Hash{String => Symbol}, void

Sets the build configurations for this target.

Returns:

  • (Hash{String => Symbol})

    hash A hash where the keys are the name of the build configurations and the values the type.

  • (void)


285
286
287
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 285

def build_configurations=(hash)
  set_hash_value('build_configurations', hash) unless hash.empty?
end

#build_pod_as_module?(pod_name) ⇒ Bool

Whether the target definition should use modular headers for a single pod. If use_modular_headers! is true, it will return true for any asked pod.

Returns:

  • (Bool)

    whether the target definition should use modular headers for a single pod. If use_modular_headers! is true, it will return true for any asked pod.



500
501
502
503
504
505
506
507
508
509
510
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 500

def build_pod_as_module?(pod_name)
  if Array(use_modular_headers_hash['not_for_pods']).include?(pod_name)
    false
  elsif use_modular_headers_hash['all']
    true
  elsif !root? && parent.build_pod_as_module?(pod_name)
    true
  else
    Array(use_modular_headers_hash['for_pods']).include? pod_name
  end
end

#dependenciesArray<Dependency>

Returns The list of the dependencies of the target definition including the inherited ones.

Returns:

  • (Array<Dependency>)

    The list of the dependencies of the target definition including the inherited ones.



70
71
72
73
74
75
76
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 70

def dependencies
  if exclusive?
    non_inherited_dependencies
  else
    non_inherited_dependencies + parent.dependencies
  end
end

#empty?Bool

Returns Whether the target definition has at least one dependency, excluding inherited ones.

Returns:

  • (Bool)

    Whether the target definition has at least one dependency, excluding inherited ones.



102
103
104
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 102

def empty?
  non_inherited_dependencies.empty?
end

#exclusive?Bool

Note:

A target is always ‘exclusive` if it is root.

Note:

A target is always ‘exclusive` if the `platform` does not match the parent’s ‘platform`.

Returns whether the target definition should inherit the dependencies of the parent.

Returns:

  • (Bool)

    whether is exclusive.



216
217
218
219
220
221
222
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 216

def exclusive?
  if root?
    true
  else
    !matches_platform?(parent) || (inheritance != 'complete')
  end
end

#inheritanceString

Returns the inheritance mode for this target definition.

Returns:

  • (String)

    the inheritance mode for this target definition.



176
177
178
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 176

def inheritance
  get_hash_value('inheritance', 'complete')
end

#inheritance=(inheritance) ⇒ void

This method returns an undefined value.

Sets the inheritance mode for this target definition.

Parameters:

  • inheritance (#to_s)

    the inheritance mode for this target definition.

Raises:

  • (Informative)

    if this target definition is a root target definition or if the ‘inheritance` value is unknown.



190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 190

def inheritance=(inheritance)
  inheritance = inheritance.to_s
  unless %w(none search_paths complete).include?(inheritance)
    raise Informative, "Unrecognized inheritance option `#{inheritance}` specified for target `#{name}`."
  end
  if root?
    raise Informative, 'Cannot set inheritance for the root target definition.'
  end
  if abstract?
    raise Informative, 'Cannot set inheritance for abstract target definition.'
  end
  set_hash_value('inheritance', inheritance)
end

#inhibit_all_warnings=(flag) ⇒ void

This method returns an undefined value.

Sets whether the target definition should inhibit the warnings during compilation for all pods.

Parameters:

  • flag (Bool)

    Whether the warnings should be suppressed.



323
324
325
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 323

def inhibit_all_warnings=(flag)
  raw_inhibit_warnings_hash['all'] = flag
end

#inhibits_warnings_for_pod?(pod_name) ⇒ Bool

Whether the target definition should inhibit warnings for a single pod. If inhibit_all_warnings is true, it will return true for any asked pod.

Returns:

  • (Bool)

    whether the target definition should inhibit warnings for a single pod. If inhibit_all_warnings is true, it will return true for any asked pod.



303
304
305
306
307
308
309
310
311
312
313
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 303

def inhibits_warnings_for_pod?(pod_name)
  if Array(inhibit_warnings_hash['not_for_pods']).include?(pod_name)
    false
  elsif inhibit_warnings_hash['all']
    true
  elsif !root? && parent.inhibits_warnings_for_pod?(pod_name)
    true
  else
    Array(inhibit_warnings_hash['for_pods']).include? pod_name
  end
end

#inspectString

Returns A string representation suitable for debug.

Returns:

  • (String)

    A string representation suitable for debug.



123
124
125
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 123

def inspect
  "#<#{self.class} label=#{label}>"
end

#labelString Also known as: to_s

Returns The label of the target definition according to its name.

Returns:

  • (String)

    The label of the target definition according to its name.



109
110
111
112
113
114
115
116
117
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 109

def label
  @label ||= if root? && name == 'Pods'
               'Pods'
             elsif exclusive? || parent.nil?
               "Pods-#{name}"
             else
               "#{parent.label}-#{name}"
             end
end

#matches_platform?(target_definition) ⇒ Boolean

Returns whether this target definition matches the platform of ‘target_definition`.

Parameters:

  • target_definition (TargetDefinition, Nil)

    the target definition to check for platform compatibility.

Returns:

  • (Boolean)

    whether this target definition matches the platform of ‘target_definition`.



231
232
233
234
235
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 231

def matches_platform?(target_definition)
  return false unless target_definition
  return true if target_definition.platform == platform
  !target_definition.platform && target_definition.abstract?
end

#nameString

Returns the path of the project this target definition should link with.

Returns:

  • (String)

    the path of the project this target definition should link with.



136
137
138
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 136

def name
  get_hash_value('name')
end

#name=(name) ⇒ void

This method returns an undefined value.

Sets the path of the user project this target definition should link with.

Parameters:

  • path (String)

    The path of the project.



148
149
150
151
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 148

def name=(name)
  @label = nil
  set_hash_value('name', name)
end

#non_inherited_dependenciesArray

Returns The list of the dependencies of the target definition, excluding inherited ones.

Returns:

  • (Array)

    The list of the dependencies of the target definition, excluding inherited ones.



95
96
97
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 95

def non_inherited_dependencies
  pod_dependencies.concat(podspec_dependencies)
end

#platformPlatform

Note:

If no deployment target has been specified a default value is provided.

Returns the platform of the target definition.

Returns:

  • (Platform)

    the platform of the target definition.



557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 557

def platform
  name_or_hash = get_hash_value('platform')
  if name_or_hash
    if name_or_hash.is_a?(Hash)
      name = name_or_hash.keys.first.to_sym
      target = name_or_hash.values.first
    else
      name = name_or_hash.to_sym
    end
    target ||= PLATFORM_DEFAULTS[name]
    Platform.new(name, target)
  else
    parent.platform unless root?
  end
end

#pod_whitelisted_for_configuration?(pod_name, configuration_name) ⇒ Bool

Note:

Build configurations are case compared case-insensitively in CocoaPods.

Whether a specific pod should be linked to the target when building for a specific configuration. If a pod has not been explicitly whitelisted for any configuration, it is implicitly whitelisted.

Parameters:

  • pod_name (String)

    The pod that we’re querying about inclusion for in the given configuration.

  • configuration_name (String)

    The configuration that we’re querying about inclusion of the pod in.

Returns:

  • (Bool)

    flag Whether the pod should be linked with the target



416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 416

def pod_whitelisted_for_configuration?(pod_name, configuration_name)
  found = false
  configuration_pod_whitelist.each do |configuration, pods|
    if pods.include?(pod_name)
      found = true
      if configuration.downcase == configuration_name.to_s.downcase
        return true
      end
    end
  end
  !found && (root? || (inheritance != 'none' && parent.pod_whitelisted_for_configuration?(pod_name, configuration_name)))
end

#podfilePodfile

Returns The podfile that contains the specification for this target definition.

Returns:

  • (Podfile)

    The podfile that contains the specification for this target definition.



63
64
65
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 63

def podfile
  root.parent
end

#recursive_childrenArray<TargetDefinition>

Returns the targets definition descending from this one.

Returns:

  • (Array<TargetDefinition>)

    the targets definition descending from this one.



40
41
42
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 40

def recursive_children
  (children + children.map(&:recursive_children)).flatten
end

#rootTargetDefinition

Returns The root target definition.

Returns:



52
53
54
55
56
57
58
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 52

def root
  if root?
    self
  else
    parent.root
  end
end

#root?Bool

Returns Whether the target definition is root.

Returns:

  • (Bool)

    Whether the target definition is root.



46
47
48
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 46

def root?
  parent.is_a?(Podfile) || parent.nil?
end

#script_phasesArray<Hash>

Returns The list of the script phases of the target definition.

Returns:

  • (Array<Hash>)

    The list of the script phases of the target definition.



293
294
295
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 293

def script_phases
  get_hash_value('script_phases') || []
end

#set_inhibit_warnings_for_pod(pod_name, should_inhibit) ⇒ void

This method returns an undefined value.

Inhibits warnings for a specific pod during compilation.

Parameters:

  • pod_name (String)

    Name of the pod for which the warnings will be inhibited or not.

  • should_inhibit (Bool)

    Whether the warnings should be inhibited or not for given pod.



337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 337

def set_inhibit_warnings_for_pod(pod_name, should_inhibit)
  hash_key = case should_inhibit
             when true
               'for_pods'
             when false
               'not_for_pods'
             when nil
               return
             else
               raise ArgumentError, "Got `#{should_inhibit.inspect}`, should be a boolean"
             end
  raw_inhibit_warnings_hash[hash_key] ||= []
  raw_inhibit_warnings_hash[hash_key] << pod_name
end

#set_platform(name, target = nil) ⇒ void

This method returns an undefined value.

Sets the platform of the target definition.

Parameters:

  • name (Symbol)

    The name of the platform.

  • target (String) (defaults to: nil)

    The deployment target of the platform.

Raises:

  • When the name of the platform is unsupported.



585
586
587
588
589
590
591
592
593
594
595
596
597
598
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 585

def set_platform(name, target = nil)
  name = :osx if name == :macos
  unless [:ios, :osx, :tvos, :watchos].include?(name)
    raise StandardError, "Unsupported platform `#{name}`. Platform " \
      'must be `:ios`, `:osx`, `:tvos`, or `:watchos`.'
  end

  if target
    value = { name.to_s => target }
  else
    value = name.to_s
  end
  set_hash_value('platform', value)
end

#set_platform!(name, target = nil) ⇒ void

This method returns an undefined value.

Sets the platform of the target definition.

Raises:

  • When the target definition already has a platform set.

See Also:



608
609
610
611
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 608

def set_platform!(name, target = nil)
  raise StandardError, "The target `#{label}` already has a platform set." if get_hash_value('platform')
  set_platform(name, target)
end

#set_use_modular_headers_for_pod(pod_name, flag) ⇒ void

This method returns an undefined value.

Use modular headers for a specific pod during compilation.

Parameters:

  • pod_name (String)

    Name of the pod for which modular headers will be used.

  • flag (Bool)

    Whether modular headers should be used.



533
534
535
536
537
538
539
540
541
542
543
544
545
546
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 533

def set_use_modular_headers_for_pod(pod_name, flag)
  hash_key = case flag
             when true
               'for_pods'
             when false
               'not_for_pods'
             when nil
               return
             else
               raise ArgumentError, "Got `#{flag.inspect}`, should be a boolean"
             end
  raw_use_modular_headers_hash[hash_key] ||= []
  raw_use_modular_headers_hash[hash_key] << pod_name
end

#store_pod(name, *requirements) ⇒ void

TODO:

This needs urgently a rename.

Note:

The dependencies are stored as an array. To simplify the YAML representation if they have requirements they are represented as a Hash, otherwise only the String of the name is added to the array.

This method returns an undefined value.

Stores the dependency for a Pod with the given name.

Parameters:

  • name (String)

    The name of the Pod

  • requirements (Array<String, Hash>)

    The requirements and the options of the dependency.



632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 632

def store_pod(name, *requirements)
  return if parse_subspecs(name, requirements) # This parse method must be called first
  parse_inhibit_warnings(name, requirements)
  parse_modular_headers(name, requirements)
  parse_configuration_whitelist(name, requirements)

  if requirements && !requirements.empty?
    pod = { name => requirements }
  else
    pod = name
  end

  get_hash_value('dependencies', []) << pod
  nil
end

#store_podspec(options = nil) ⇒ void

TODO:

This urgently needs a rename.

Note:

The storage of this information is optimized for YAML readability.

This method returns an undefined value.

Stores the podspec whose dependencies should be included by the target.

Parameters:

  • options (Hash) (defaults to: nil)

    The options used to find the podspec (either by name or by path). If nil the podspec is auto-detected (i.e. the first one in the folder of the Podfile)



665
666
667
668
669
670
671
672
673
674
675
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 665

def store_podspec(options = nil)
  if options
    unless options.keys.all? { |key| [:name, :path].include?(key) }
      raise StandardError, 'Unrecognized options for the podspec ' \
        "method `#{options}`"
    end
    get_hash_value('podspecs', []) << options
  else
    get_hash_value('podspecs', []) << { :autodetect => true }
  end
end

#store_script_phase(options) ⇒ void

This method returns an undefined value.

Stores the script phase to add for this target definition.

Parameters:

  • options (Hash)

    The options to use for this script phase. The required keys are: ‘:name`, `:script`, while the optional keys are: `:shell_path`, `:input_files`, `:output_files`, `:show_env_vars_in_log` and `:execution_position`.



688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 688

def store_script_phase(options)
  option_keys = options.keys
  unrecognized_keys = option_keys - Specification::ALL_SCRIPT_PHASE_KEYS
  unless unrecognized_keys.empty?
    raise StandardError, "Unrecognized options `#{unrecognized_keys}` in shell script `#{options[:name]}` within `#{name}` target. " \
      "Available options are `#{Specification::ALL_SCRIPT_PHASE_KEYS}`."
  end
  missing_required_keys = Specification::SCRIPT_PHASE_REQUIRED_KEYS - option_keys
  unless missing_required_keys.empty?
    raise StandardError, "Missing required shell script phase options `#{missing_required_keys.join(', ')}`"
  end
  script_phases_hash = get_hash_value('script_phases', [])
  if script_phases_hash.map { |script_phase_options| script_phase_options[:name] }.include?(options[:name])
    raise StandardError, "Script phase with name `#{options[:name]}` name already present for target `#{name}`."
  end
  options[:execution_position] = :any unless options.key?(:execution_position)
  unless Specification::EXECUTION_POSITION_KEYS.include?(options[:execution_position])
    raise StandardError, "Invalid execution position value `#{options[:execution_position]}` in shell script `#{options[:name]}` within `#{name}` target. " \
      "Available options are `#{Specification::EXECUTION_POSITION_KEYS}`."
  end
  script_phases_hash << options
end

#swift_versionString

Returns the Swift version that the target definition should use.

Returns:

  • (String)

    the Swift version that the target definition should use.



392
393
394
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 392

def swift_version
  get_hash_value('swift_version')
end

#swift_version=(version) ⇒ void

This method returns an undefined value.

Sets the Swift version that the target definition should use.

Parameters:

  • version (String)

    The Swift version that the target definition should use.



385
386
387
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 385

def swift_version=(version)
  set_hash_value('swift_version', version)
end

#targets_to_inherit_search_pathsArray<TargetDefinition>

Returns the targets from which this target definition should inherit only search paths.

Returns:

  • (Array<TargetDefinition>)

    the targets from which this target definition should inherit only search paths.



81
82
83
84
85
86
87
88
89
90
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 81

def targets_to_inherit_search_paths
  can_inherit = !root? && matches_platform?(parent)
  if inheritance == 'search_paths' # && can_inherit
    parent.targets_to_inherit_search_paths << parent
  elsif can_inherit
    parent.targets_to_inherit_search_paths
  else
    []
  end
end

#to_hashHash

Returns The hash representation of the target definition.

Returns:

  • (Hash)

    The hash representation of the target definition.



743
744
745
746
747
748
749
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 743

def to_hash
  hash = internal_hash.dup
  unless children.empty?
    hash['children'] = children.map(&:to_hash)
  end
  hash
end

#use_frameworks!(flag = true) ⇒ void

This method returns an undefined value.

Sets whether the target definition should build a framework.

Parameters:

  • flag (Bool) (defaults to: true)

    Whether a framework should be built.



361
362
363
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 361

def use_frameworks!(flag = true)
  set_hash_value('uses_frameworks', flag)
end

#use_modular_headers_for_all_pods=(flag) ⇒ void

This method returns an undefined value.

Sets whether the target definition should use modular headers for all pods.

Parameters:

  • flag (Bool)

    Whether the warnings should be suppressed.



519
520
521
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 519

def use_modular_headers_for_all_pods=(flag)
  raw_use_modular_headers_hash['all'] = flag
end

#use_modular_headers_hashHash<String, Array>

Returns the use_modular_headers hash pre-populated with default values.

Returns:

  • (Hash<String, Array>)

    Hash with :all key for building all pods as modules, :for_pods key for building as module per Pod, and :not_for_pods key for not biulding as module per Pod.



471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 471

def use_modular_headers_hash
  raw_hash = raw_use_modular_headers_hash
  if exclusive?
    raw_hash
  else
    parent_hash = parent.send(:use_modular_headers_hash).dup
    if parent_hash['not_for_pods']
      # Remove pods that are set to not use modular headers inside parent
      # if they are set to use modular headers inside current target.
      parent_hash['not_for_pods'] -= Array(raw_hash['for_pods'])
    end
    if parent_hash['for_pods']
      # Remove pods that are set to use modular headers inside parent if they are set to not use modular headers inside current target.
      parent_hash['for_pods'] -= Array(raw_hash['for_pods'])
    end
    if raw_hash['all']
      # Clean pods that are set to not use modular headers inside parent if use_modular_headers! was set.
      parent_hash['not_for_pods'] = nil
    end
    parent_hash.merge(raw_hash) do |_, l, r|
      Array(l).concat(r).uniq
    end
  end
end

#user_project_pathString

Returns the path of the project this target definition should link with.

Returns:

  • (String)

    the path of the project this target definition should link with.



242
243
244
245
246
247
248
249
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 242

def user_project_path
  path = get_hash_value('user_project_path')
  if path
    Pathname(path).sub_ext('.xcodeproj').to_path
  else
    parent.user_project_path unless root?
  end
end

#user_project_path=(path) ⇒ void

This method returns an undefined value.

Sets the path of the user project this target definition should link with.

Parameters:

  • path (String)

    The path of the project.



259
260
261
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 259

def user_project_path=(path)
  set_hash_value('user_project_path', path)
end

#uses_frameworks?Bool

Returns whether the target definition should build a framework.

Returns:

  • (Bool)

    whether the target definition should build a framework.



368
369
370
371
372
373
374
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 368

def uses_frameworks?
  if internal_hash['uses_frameworks'].nil?
    root? ? false : parent.uses_frameworks?
  else
    get_hash_value('uses_frameworks')
  end
end

#whitelist_pod_for_configuration(pod_name, configuration_name) ⇒ void

Note:

Build configurations are stored as a String.

This method returns an undefined value.

Whitelists a pod for a specific configuration. If a pod is whitelisted for any configuration, it will only be linked with the target in the configuration(s) specified. If it is not whitelisted for any configuration, it is implicitly included in all configurations.

Parameters:

  • pod_name (String)

    The pod that should be included in the given configuration.

  • configuration_name (String, Symbol)

    The configuration that the pod should be included in



444
445
446
447
448
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 444

def whitelist_pod_for_configuration(pod_name, configuration_name)
  configuration_name = configuration_name.to_s
  list = raw_configuration_pod_whitelist[configuration_name] ||= []
  list << pod_name
end