class Xcodeproj::XCScheme::BuildableReference
typically is synonymous for an Xcode target)
A BuildableReference is a reference to a buildable product (which is
This class wraps the BuildableReference node of a .xcscheme XML file
def buildable_name
-
(String)-
def buildable_name @xml_element.attributes['BuildableName'] end
def buildable_name=(value)
-
value(String) --
def buildable_name=(value) @xml_element.attributes['BuildableName'] = value end
def construct_buildable_name(build_target)
-
(String)- The buildable name of the scheme.
Parameters:
-
target(Xcodeproj::Project::Object::AbstractTarget) --
def construct_buildable_name(build_target) case build_target.isa when 'PBXNativeTarget' File.basename(build_target.product_reference.path) when 'PBXAggregateTarget' build_target.name else raise ArgumentError, "Unsupported build target type #{build_target.isa}" end end
def construct_referenced_container_uri(target, root_project = nil)
-
(String)- A string in the format "container:[path to the project
Parameters:
-
the(Xcodeproj::Project) -- root project to reference from -
target(Xcodeproj::Project::Object::AbstractTarget) --
def construct_referenced_container_uri(target, root_project = nil) target_project = target.project root_project ||= target_project root_project_dir_path = root_project.root_object.project_dir_path path = if !root_project_dir_path.to_s.empty? root_project.path + root_project_dir_path else root_project.project_dir end relative_path = target_project.path.relative_path_from(path).to_s relative_path = target_project.path.basename if relative_path == '.' "container:#{relative_path}" end
def initialize(target_or_node, root_project = nil)
-
the(Xcodeproj::Project) -- root project to reference from -
target_or_node(Xcodeproj::Project::Object::AbstractTarget, REXML::Element) --
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
def set_reference_target(target, override_buildable_name = false, root_project = nil)
-
override_buildable_name(Bool) -- -
the(Xcodeproj::Project) -- root project to reference from -
target(Xcodeproj::Project::Object::AbstractTarget) --
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
def target_name
-
(String)-
def target_name @xml_element.attributes['BlueprintName'] end
def target_referenced_container
-
(String)-
def target_referenced_container @xml_element.attributes['ReferencedContainer'] end
def target_uuid
- Note: - You can use this to `#find` the `Xcodeproj::Project::Object::AbstractTarget`
Returns:
-
(String)-
def target_uuid @xml_element.attributes['BlueprintIdentifier'] end