Class: Xcodeproj::XCScheme::BuildAction
- Inherits:
-
XMLElementWrapper
- Object
- XMLElementWrapper
- Xcodeproj::XCScheme::BuildAction
- 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
Instance Method Summary collapse
- #add_entry(entry) ⇒ Object
- #add_post_action(post_action) ⇒ Object
- #add_pre_action(pre_action) ⇒ Object
- #build_implicit_dependencies=(flag) ⇒ Object
-
#build_implicit_dependencies? ⇒ Bool
Whether or not to detect and build implicit dependencies for each target.
-
#entries ⇒ Array<BuildAction::Entry>
The list of BuildActionEntry nodes associated with this Build Action.
- #entries=(entries) ⇒ Object
-
#initialize(node = nil) ⇒ BuildAction
constructor
A new instance of BuildAction.
- #parallelize_buildables=(flag) ⇒ Object
-
#parallelize_buildables? ⇒ Bool
Whether or not to build the various targets in parallel.
-
#post_actions ⇒ Array<ExecutionAction>
The list of actions to run after this scheme action.
- #post_actions=(post_actions) ⇒ Object
-
#pre_actions ⇒ Array<ExecutionAction>
The list of actions to run before this scheme action.
- #pre_actions=(pre_actions) ⇒ Object
- #run_post_actions_on_failure=(flag) ⇒ Object
-
#run_post_actions_on_failure? ⇒ Bool
Whether or not to run post actions on build failure.
Methods inherited from XMLElementWrapper
Constructor Details
#initialize(node = nil) ⇒ BuildAction
Returns a new instance of BuildAction.
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
165 166 167 168 |
# File 'lib/xcodeproj/scheme/build_action.rb', line 165 def add_entry(entry) entries = @xml_element.elements['BuildActionEntries'] || @xml_element.add_element('BuildActionEntries') entries.add_element(entry.xml_element) end |
#add_post_action(post_action) ⇒ Object
131 132 133 134 |
# File 'lib/xcodeproj/scheme/build_action.rb', line 131 def add_post_action(post_action) post_actions = @xml_element.elements['PostActions'] || @xml_element.add_element('PostActions') post_actions.add_element(post_action.xml_element) end |
#add_pre_action(pre_action) ⇒ Object
95 96 97 98 |
# File 'lib/xcodeproj/scheme/build_action.rb', line 95 def add_pre_action(pre_action) pre_actions = @xml_element.elements['PreActions'] || @xml_element.add_element('PreActions') pre_actions.add_element(pre_action.xml_element) end |
#build_implicit_dependencies=(flag) ⇒ Object
60 61 62 |
# File 'lib/xcodeproj/scheme/build_action.rb', line 60 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.
53 54 55 |
# File 'lib/xcodeproj/scheme/build_action.rb', line 53 def build_implicit_dependencies? string_to_bool(@xml_element.attributes['buildImplicitDependencies']) end |
#entries ⇒ Array<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.
140 141 142 143 144 145 146 |
# File 'lib/xcodeproj/scheme/build_action.rb', line 140 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
151 152 153 154 155 156 157 158 159 160 |
# File 'lib/xcodeproj/scheme/build_action.rb', line 151 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
46 47 48 |
# File 'lib/xcodeproj/scheme/build_action.rb', line 46 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.
39 40 41 |
# File 'lib/xcodeproj/scheme/build_action.rb', line 39 def parallelize_buildables? string_to_bool(@xml_element.attributes['parallelizeBuildables']) end |
#post_actions ⇒ Array<ExecutionAction>
Returns The list of actions to run after this scheme action. Each entry can be either a ‘Run Script’ or a ‘Send Email’ action.
104 105 106 107 108 109 110 |
# File 'lib/xcodeproj/scheme/build_action.rb', line 104 def post_actions post_actions = @xml_element.elements['PostActions'] return nil unless post_actions post_actions.get_elements('ExecutionAction').map do |entry_node| ExecutionAction.new(entry_node) end end |
#post_actions=(post_actions) ⇒ Object
116 117 118 119 120 121 122 123 124 125 |
# File 'lib/xcodeproj/scheme/build_action.rb', line 116 def post_actions=(post_actions) @xml_element.delete_element('PostActions') unless post_actions.empty? post_actions_element = @xml_element.add_element('PostActions') post_actions.each do |entry_node| post_actions_element.add_element(entry_node.xml_element) end end post_actions end |
#pre_actions ⇒ Array<ExecutionAction>
Returns The list of actions to run before this scheme action. Each entry can be either a ‘Run Script’ or a ‘Send Email’ action.
68 69 70 71 72 73 74 |
# File 'lib/xcodeproj/scheme/build_action.rb', line 68 def pre_actions pre_actions = @xml_element.elements['PreActions'] return nil unless pre_actions pre_actions.get_elements('ExecutionAction').map do |entry_node| ExecutionAction.new(entry_node) end end |
#pre_actions=(pre_actions) ⇒ Object
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/xcodeproj/scheme/build_action.rb', line 80 def pre_actions=(pre_actions) @xml_element.delete_element('PreActions') unless pre_actions.empty? pre_actions_element = @xml_element.add_element('PreActions') pre_actions.each do |entry_node| pre_actions_element.add_element(entry_node.xml_element) end end pre_actions end |
#run_post_actions_on_failure=(flag) ⇒ Object
32 33 34 |
# File 'lib/xcodeproj/scheme/build_action.rb', line 32 def run_post_actions_on_failure=(flag) @xml_element.attributes['runPostActionsOnFailure'] = bool_to_string(flag) end |
#run_post_actions_on_failure? ⇒ Bool
Returns Whether or not to run post actions on build failure.
25 26 27 |
# File 'lib/xcodeproj/scheme/build_action.rb', line 25 def run_post_actions_on_failure? string_to_bool(@xml_element.attributes['runPostActionsOnFailure']) end |