class Xcodeproj::XCScheme::BuildAction::Entry

Public Class Methods

new(target_or_node = nil) click to toggle source

@param [Xcodeproj::Project::Object::AbstractTarget, REXML::Element] target_or_node

Either the Xcode target to reference,
or an existing XML 'BuildActionEntry' node element to reference,
or nil to create an new, empty Entry with default values
# File lib/xcodeproj/scheme/build_action.rb, line 178
def initialize(target_or_node = nil)
  create_xml_element_with_fallback(target_or_node, 'BuildActionEntry') do
    # Check target type to configure the default entry attributes accordingly
    is_test_target = false
    is_app_target = false
    if target_or_node && target_or_node.is_a?(::Xcodeproj::Project::Object::PBXNativeTarget)
      test_types = [Constants::PRODUCT_TYPE_UTI[:octest_bundle],
                    Constants::PRODUCT_TYPE_UTI[:unit_test_bundle],
                    Constants::PRODUCT_TYPE_UTI[:ui_test_bundle]]
      app_types = [Constants::PRODUCT_TYPE_UTI[:application]]
      is_test_target = test_types.include?(target_or_node.product_type)
      is_app_target = app_types.include?(target_or_node.product_type)
    end

    self.build_for_testing   = is_test_target
    self.build_for_running   = is_app_target
    self.build_for_profiling = is_app_target
    self.build_for_archiving = is_app_target
    self.build_for_analyzing = true

    add_buildable_reference BuildableReference.new(target_or_node) if target_or_node
  end
end

Public Instance Methods

add_buildable_reference(ref) click to toggle source

@param [BuildableReference] ref

The BuildableReference to add to the list of targets this entry will build
# File lib/xcodeproj/scheme/build_action.rb, line 285
def add_buildable_reference(ref)
  @xml_element.add_element(ref.xml_element)
end
build_for_analyzing=(flag) click to toggle source

@param [Bool]

Set whether or not to build this target when building for Analyzing
# File lib/xcodeproj/scheme/build_action.rb, line 268
def build_for_analyzing=(flag)
  @xml_element.attributes['buildForAnalyzing'] = bool_to_string(flag)
end
build_for_analyzing?() click to toggle source

@return [Bool]

Whether or not to build this target when building for Analyzing
# File lib/xcodeproj/scheme/build_action.rb, line 261
def build_for_analyzing?
  string_to_bool(@xml_element.attributes['buildForAnalyzing'])
end
build_for_archiving=(flag) click to toggle source

@param [Bool]

Set whether or not to build this target when building for Archiving
# File lib/xcodeproj/scheme/build_action.rb, line 254
def build_for_archiving=(flag)
  @xml_element.attributes['buildForArchiving'] = bool_to_string(flag)
end
build_for_archiving?() click to toggle source

@return [Bool]

Whether or not to build this target when building for Archiving
# File lib/xcodeproj/scheme/build_action.rb, line 247
def build_for_archiving?
  string_to_bool(@xml_element.attributes['buildForArchiving'])
end
build_for_profiling=(flag) click to toggle source

@param [Bool]

Set whether or not to build this target when building for Profiling
# File lib/xcodeproj/scheme/build_action.rb, line 240
def build_for_profiling=(flag)
  @xml_element.attributes['buildForProfiling'] = bool_to_string(flag)
end
build_for_profiling?() click to toggle source

@return [Bool]

Whether or not to build this target when building for Profiling
# File lib/xcodeproj/scheme/build_action.rb, line 233
def build_for_profiling?
  string_to_bool(@xml_element.attributes['buildForProfiling'])
end
build_for_running=(flag) click to toggle source

@param [Bool]

Set whether or not to build this target when building for Running
# File lib/xcodeproj/scheme/build_action.rb, line 226
def build_for_running=(flag)
  @xml_element.attributes['buildForRunning'] = bool_to_string(flag)
end
build_for_running?() click to toggle source

@return [Bool]

Whether or not to build this target when building for Running
# File lib/xcodeproj/scheme/build_action.rb, line 219
def build_for_running?
  string_to_bool(@xml_element.attributes['buildForRunning'])
end
build_for_testing=(flag) click to toggle source

@param [Bool]

Set whether or not to build this target when building for Testing
# File lib/xcodeproj/scheme/build_action.rb, line 212
def build_for_testing=(flag)
  @xml_element.attributes['buildForTesting'] = bool_to_string(flag)
end
build_for_testing?() click to toggle source

@return [Bool]

Whether or not to build this target when building for Testing
# File lib/xcodeproj/scheme/build_action.rb, line 205
def build_for_testing?
  string_to_bool(@xml_element.attributes['buildForTesting'])
end
buildable_references() click to toggle source

@return [Array<BuildableReference>]

The list of BuildableReferences this entry will build.
(The list usually contains only one element)
# File lib/xcodeproj/scheme/build_action.rb, line 276
def buildable_references
  @xml_element.get_elements('BuildableReference').map do |node|
    BuildableReference.new(node)
  end
end
remove_buildable_reference(ref) click to toggle source

@param [BuildableReference] ref

The BuildableReference to remove from the list of targets this entry will build
# File lib/xcodeproj/scheme/build_action.rb, line 292
def remove_buildable_reference(ref)
  @xml_element.delete_element(ref.xml_element)
end