Class: Xcodeproj::Project::Object::PBXTargetDependency

Inherits:
AbstractObject
  • Object
show all
Defined in:
lib/xcodeproj/project/object/target_dependency.rb

Overview

Represents a dependency of a target on another one.

Attributes collapse

Attributes inherited from AbstractObject

#isa, #project, #uuid

AbstractObject Hooks collapse

Methods inherited from AbstractObject

#<=>, #==, #inspect, isa, #nested_object_for_hash, #pretty_print, #remove_from_project, #sort, #to_ascii_plist, #to_hash

Instance Attribute Details

#nameString

Note:

This seems only to be used when the target dependency is a target from a nested Xcode project.

Returns the name of the target.

Returns:

  • (String)

    the name of the target.



27
# File 'lib/xcodeproj/project/object/target_dependency.rb', line 27

attribute :name, String

#platform_filterString

Returns the platform filter for this target dependency.

Returns:

  • (String)

    the platform filter for this target dependency.



31
# File 'lib/xcodeproj/project/object/target_dependency.rb', line 31

attribute :platform_filter, String

#platform_filtersArray<String>

Returns the platform filters for this target dependency.

Returns:

  • (Array<String>)

    the platform filters for this target dependency.



35
# File 'lib/xcodeproj/project/object/target_dependency.rb', line 35

attribute :platform_filters, Array

#product_refString

Returns the product reference for this target dependency.

Returns:

  • (String)

    the product reference for this target dependency.



39
# File 'lib/xcodeproj/project/object/target_dependency.rb', line 39

attribute :product_ref, String

#targetPBXNativeTarget

Returns the target that needs to be built to satisfy the dependency.

Returns:

  • (PBXNativeTarget)

    the target that needs to be built to satisfy the dependency.



12
# File 'lib/xcodeproj/project/object/target_dependency.rb', line 12

has_one :target, AbstractTarget

#target_proxyPBXContainerItemProxy

Note:

Apparently to support targets in other projects of the same workspace.

Returns a proxy for the target that needs to be built.

Returns:



20
# File 'lib/xcodeproj/project/object/target_dependency.rb', line 20

has_one :target_proxy, PBXContainerItemProxy

Instance Method Details

#ascii_plist_annotationObject



54
55
56
# File 'lib/xcodeproj/project/object/target_dependency.rb', line 54

def ascii_plist_annotation
  " #{isa} "
end

#display_nameString

Returns The name of the dependency.

Returns:

  • (String)

    The name of the dependency.



48
49
50
51
52
# File 'lib/xcodeproj/project/object/target_dependency.rb', line 48

def display_name
  return name if name
  return target.name if target
  return target_proxy.remote_info if target_proxy
end

#native_target_uuidString

Returns uuid of the target, if the dependency is a native target, otherwise the uuid of the target in the sub-project if the dependency is a target proxy.

Returns:

  • (String)

    uuid of the target, if the dependency is a native target, otherwise the uuid of the target in the sub-project if the dependency is a target proxy



63
64
65
66
67
68
# File 'lib/xcodeproj/project/object/target_dependency.rb', line 63

def native_target_uuid
  return target.uuid if target
  return target_proxy.remote_global_id_string if target_proxy
  raise "Expected target or target_proxy, from which to fetch a uuid for target '#{display_name}'." \
    "Find and clear the PBXTargetDependency entry with uuid '#{@uuid}' in your .xcodeproj."
end

#sort_recursively(_options = nil) ⇒ Object

Note:

This is a no-op, because the targets could theoretically depend on each other, leading to a stack level too deep error.



89
90
# File 'lib/xcodeproj/project/object/target_dependency.rb', line 89

def sort_recursively(_options = nil)
end

#to_tree_hashHash<String => String>

Note:

This override is necessary because Xcode allows for circular target dependencies.

Returns a cascade representation of the object without UUIDs.

Returns:

  • (Hash<String => String>)

    Returns a cascade representation of the object without UUIDs.



76
77
78
79
80
81
82
# File 'lib/xcodeproj/project/object/target_dependency.rb', line 76

def to_tree_hash
  hash = {}
  hash['displayName'] = display_name
  hash['isa'] = isa
  hash['targetProxy'] = target_proxy.to_tree_hash
  hash
end