Class: Xcodeproj::XCScheme::BuildAction

Inherits:
XMLElementWrapper show all
Defined in:
lib/xcodeproj/scheme/build_action.rb

Overview

This class wraps the BuildAction node of a .xcscheme XML file

Note: It's not a AbstractSchemeAction like the others because it is a special case of action (with no build_configuration, etc)

Defined Under Namespace

Classes: Entry

Instance Attribute Summary

Attributes inherited from XMLElementWrapper

#xml_element

Instance Method Summary collapse

Methods inherited from XMLElementWrapper

#to_s

Constructor Details

#initialize(node = nil) ⇒ BuildAction

Returns a new instance of BuildAction.

Parameters:

  • node (REXML::Element) (defaults to: nil)

    The 'BuildAction' XML node that this object will wrap. If nil, will create a default XML node to use.


15
16
17
18
19
20
# File 'lib/xcodeproj/scheme/build_action.rb', line 15

def initialize(node = nil)
  create_xml_element_with_fallback(node, 'BuildAction') do
    self.parallelize_buildables = true
    self.build_implicit_dependencies = true
  end
end

Instance Method Details

#add_entry(entry) ⇒ Object

Parameters:

  • entry (BuildAction::Entry)

    The BuildActionEntry to add to the list of targets to build for the various actions


79
80
81
82
# File 'lib/xcodeproj/scheme/build_action.rb', line 79

def add_entry(entry)
  entries = @xml_element.elements['BuildActionEntries'] || @xml_element.add_element('BuildActionEntries')
  entries.add_element(entry.xml_element)
end

#build_implicit_dependencies=(flag) ⇒ Object

Parameters:

  • flag (Bool)

    Whether or not to detect and build implicit dependencies for each target


46
47
48
# File 'lib/xcodeproj/scheme/build_action.rb', line 46

def build_implicit_dependencies=(flag)
  @xml_element.attributes['buildImplicitDependencies'] = bool_to_string(flag)
end

#build_implicit_dependencies?Bool

Returns Whether or not to detect and build implicit dependencies for each target.

Returns:

  • (Bool)

    Whether or not to detect and build implicit dependencies for each target


39
40
41
# File 'lib/xcodeproj/scheme/build_action.rb', line 39

def build_implicit_dependencies?
  string_to_bool(@xml_element.attributes['buildImplicitDependencies'])
end

#entriesArray<BuildAction::Entry>

Returns The list of BuildActionEntry nodes associated with this Build Action. Each entry represent a target to build and tells for which action it's needed to be built.

Returns:

  • (Array<BuildAction::Entry>)

    The list of BuildActionEntry nodes associated with this Build Action. Each entry represent a target to build and tells for which action it's needed to be built.


54
55
56
57
58
59
60
# File 'lib/xcodeproj/scheme/build_action.rb', line 54

def entries
  entries = @xml_element.elements['BuildActionEntries']
  return nil unless entries
  entries.get_elements('BuildActionEntry').map do |entry_node|
    BuildAction::Entry.new(entry_node)
  end
end

#entries=(entries) ⇒ Object

Parameters:

  • entries (Array<BuildAction::Entry>)

    Sets the list of BuildActionEntry nodes associated with this Build Action.


65
66
67
68
69
70
71
72
73
74
# File 'lib/xcodeproj/scheme/build_action.rb', line 65

def entries=(entries)
  @xml_element.delete_element('BuildActionEntries')
  unless entries.empty?
    entries_element = @xml_element.add_element('BuildActionEntries')
    entries.each do |entry_node|
      entries_element.add_element(entry_node.xml_element)
    end
  end
  entries
end

#parallelize_buildables=(flag) ⇒ Object

Parameters:

  • flag (Bool)

    Set whether or not to build the various targets in parallel


32
33
34
# File 'lib/xcodeproj/scheme/build_action.rb', line 32

def parallelize_buildables=(flag)
  @xml_element.attributes['parallelizeBuildables'] = bool_to_string(flag)
end

#parallelize_buildables?Bool

Returns Whether or not to build the various targets in parallel.

Returns:

  • (Bool)

    Whether or not to build the various targets in parallel


25
26
27
# File 'lib/xcodeproj/scheme/build_action.rb', line 25

def parallelize_buildables?
  string_to_bool(@xml_element.attributes['parallelizeBuildables'])
end