Class: Xcodeproj::XCScheme::BuildableReference
- Inherits:
-
XMLElementWrapper
- Object
- XMLElementWrapper
- Xcodeproj::XCScheme::BuildableReference
- Defined in:
- lib/xcodeproj/scheme/buildable_reference.rb
Overview
This class wraps the BuildableReference node of a .xcscheme XML file
A BuildableReference is a reference to a buildable product (which is typically is synonymous for an Xcode target)
Instance Attribute Summary
Attributes inherited from XMLElementWrapper
Instance Method Summary collapse
-
#buildable_name ⇒ String
The name of the final product when building this Buildable Reference.
- #buildable_name=(value) ⇒ Object
-
#initialize(target_or_node, root_project = nil) ⇒ BuildableReference
constructor
A new instance of BuildableReference.
-
#set_reference_target(target, override_buildable_name = false, root_project = nil) ⇒ Object
Set the BlueprintIdentifier (target.uuid), BlueprintName (target.name) and TerefencedContainer (URI pointing to target’s projet) all at once.
-
#target_name ⇒ String
The name of the target this Buildable Reference points to.
-
#target_referenced_container ⇒ String
The string representing the container of that target.
-
#target_uuid ⇒ String
The Unique Identifier of the target (target.uuid) this Buildable Reference points to.
Methods inherited from XMLElementWrapper
Constructor Details
#initialize(target_or_node, root_project = nil) ⇒ BuildableReference
Returns a new instance of BuildableReference.
16 17 18 19 20 21 |
# File 'lib/xcodeproj/scheme/buildable_reference.rb', line 16 def initialize(target_or_node, root_project = nil) create_xml_element_with_fallback(target_or_node, 'BuildableReference') do @xml_element.attributes['BuildableIdentifier'] = 'primary' set_reference_target(target_or_node, true, root_project) if target_or_node end end |
Instance Method Details
#buildable_name ⇒ String
Returns The name of the final product when building this Buildable Reference.
73 74 75 |
# File 'lib/xcodeproj/scheme/buildable_reference.rb', line 73 def buildable_name @xml_element.attributes['BuildableName'] end |
#buildable_name=(value) ⇒ Object
80 81 82 |
# File 'lib/xcodeproj/scheme/buildable_reference.rb', line 80 def buildable_name=(value) @xml_element.attributes['BuildableName'] = value end |
#set_reference_target(target, override_buildable_name = false, root_project = nil) ⇒ Object
Set the BlueprintIdentifier (target.uuid), BlueprintName (target.name)
and TerefencedContainer (URI pointing to target's projet) all at once
61 62 63 64 65 66 67 68 |
# File 'lib/xcodeproj/scheme/buildable_reference.rb', line 61 def set_reference_target(target, override_buildable_name = false, root_project = nil) # note, the order of assignment here is important, it determines the order of serialization in the xml # this matches the order that Xcode generates @xml_element.attributes['BlueprintIdentifier'] = target.uuid self.buildable_name = construct_buildable_name(target) if override_buildable_name @xml_element.attributes['BlueprintName'] = target.name @xml_element.attributes['ReferencedContainer'] = construct_referenced_container_uri(target, root_project) end |
#target_name ⇒ String
Returns The name of the target this Buildable Reference points to.
26 27 28 |
# File 'lib/xcodeproj/scheme/buildable_reference.rb', line 26 def target_name @xml_element.attributes['BlueprintName'] end |
#target_referenced_container ⇒ String
Returns The string representing the container of that target. Typically in the form of ‘container:xxxx.xcodeproj’.
45 46 47 |
# File 'lib/xcodeproj/scheme/buildable_reference.rb', line 45 def target_referenced_container @xml_element.attributes['ReferencedContainer'] end |
#target_uuid ⇒ String
You can use this to ‘#find` the `Xcodeproj::Project::Object::AbstractTarget` instance in your Xcodeproj::Project object. e.g. `project.targets.find { |t| t.uuid == ref.target_uuid }`
Returns The Unique Identifier of the target (target.uuid) this Buildable Reference points to.
37 38 39 |
# File 'lib/xcodeproj/scheme/buildable_reference.rb', line 37 def target_uuid @xml_element.attributes['BlueprintIdentifier'] end |