xcodeproj 1.19.0 → 1.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -4
  3. data/lib/xcodeproj/command/sort.rb +12 -1
  4. data/lib/xcodeproj/command.rb +6 -3
  5. data/lib/xcodeproj/config/other_linker_flags_parser.rb +5 -0
  6. data/lib/xcodeproj/config.rb +12 -2
  7. data/lib/xcodeproj/constants.rb +14 -5
  8. data/lib/xcodeproj/differ.rb +33 -2
  9. data/lib/xcodeproj/gem_version.rb +1 -1
  10. data/lib/xcodeproj/project/object/build_configuration.rb +1 -1
  11. data/lib/xcodeproj/project/object/build_file.rb +7 -1
  12. data/lib/xcodeproj/project/object/build_phase.rb +21 -0
  13. data/lib/xcodeproj/project/object/build_rule.rb +7 -0
  14. data/lib/xcodeproj/project/object/file_reference.rb +3 -2
  15. data/lib/xcodeproj/project/object/group.rb +30 -9
  16. data/lib/xcodeproj/project/object/helpers/file_references_factory.rb +6 -6
  17. data/lib/xcodeproj/project/object/helpers/groupable_helper.rb +1 -1
  18. data/lib/xcodeproj/project/object/native_target.rb +43 -0
  19. data/lib/xcodeproj/project/object/reference_proxy.rb +19 -0
  20. data/lib/xcodeproj/project/object/swift_package_product_dependency.rb +10 -0
  21. data/lib/xcodeproj/project/object/swift_package_remote_reference.rb +14 -0
  22. data/lib/xcodeproj/project/object/target_dependency.rb +13 -6
  23. data/lib/xcodeproj/project/project_helper.rb +6 -6
  24. data/lib/xcodeproj/project.rb +9 -6
  25. data/lib/xcodeproj/scheme/abstract_scheme_action.rb +72 -0
  26. data/lib/xcodeproj/scheme/build_action.rb +87 -1
  27. data/lib/xcodeproj/scheme/execution_action.rb +86 -0
  28. data/lib/xcodeproj/scheme/launch_action.rb +17 -2
  29. data/lib/xcodeproj/scheme/location_scenario_reference.rb +49 -0
  30. data/lib/xcodeproj/scheme/profile_action.rb +5 -5
  31. data/lib/xcodeproj/scheme/send_email_action_content.rb +84 -0
  32. data/lib/xcodeproj/scheme/shell_script_action_content.rb +77 -0
  33. data/lib/xcodeproj/scheme/test_action.rb +45 -3
  34. data/lib/xcodeproj/scheme.rb +5 -1
  35. metadata +21 -3
@@ -41,17 +41,17 @@ module Xcodeproj
41
41
  #
42
42
  # @return [PBXNativeTarget] the target.
43
43
  #
44
- def self.new_target(project, type, name, platform, deployment_target, product_group, language)
44
+ def self.new_target(project, type, name, platform, deployment_target, product_group, language, product_basename)
45
45
  # Target
46
46
  target = project.new(PBXNativeTarget)
47
47
  project.targets << target
48
48
  target.name = name
49
- target.product_name = name
49
+ target.product_name = product_basename
50
50
  target.product_type = Constants::PRODUCT_TYPE_UTI[type]
51
51
  target.build_configuration_list = configuration_list(project, platform, deployment_target, type, language)
52
52
 
53
53
  # Product
54
- product = product_group.new_product_ref_for_target(name, type)
54
+ product = product_group.new_product_ref_for_target(target.product_name, type)
55
55
  target.product_reference = product
56
56
 
57
57
  # Build phases
@@ -88,12 +88,12 @@ module Xcodeproj
88
88
  #
89
89
  # @return [PBXNativeTarget] the target.
90
90
  #
91
- def self.new_resources_bundle(project, name, platform, product_group)
91
+ def self.new_resources_bundle(project, name, platform, product_group, product_basename)
92
92
  # Target
93
93
  target = project.new(PBXNativeTarget)
94
94
  project.targets << target
95
95
  target.name = name
96
- target.product_name = name
96
+ target.product_name = product_basename
97
97
  target.product_type = Constants::PRODUCT_TYPE_UTI[:bundle]
98
98
 
99
99
  # Configuration List
@@ -111,7 +111,7 @@ module Xcodeproj
111
111
  target.build_configuration_list = cl
112
112
 
113
113
  # Product
114
- product = product_group.new_bundle(name)
114
+ product = product_group.new_bundle(target.product_name)
115
115
  target.product_reference = product
116
116
 
117
117
  # Build phases
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'atomos'
2
3
  require 'fileutils'
3
4
  require 'securerandom'
@@ -220,11 +221,11 @@ module Xcodeproj
220
221
  end
221
222
 
222
223
  if archive_version.to_i > Constants::LAST_KNOWN_ARCHIVE_VERSION
223
- raise '[Xcodeproj] Unknown archive version.'
224
+ raise "[Xcodeproj] Unknown archive version (#{archive_version.to_i})."
224
225
  end
225
226
 
226
227
  if object_version.to_i > Constants::LAST_KNOWN_OBJECT_VERSION
227
- raise '[Xcodeproj] Unknown object version.'
228
+ raise "[Xcodeproj] Unknown object version (#{object_version.to_i})."
228
229
  end
229
230
 
230
231
  # Projects can have product_ref_groups that are not listed in the main_groups["Products"]
@@ -711,9 +712,10 @@ module Xcodeproj
711
712
  #
712
713
  # @return [PBXNativeTarget] the target.
713
714
  #
714
- def new_target(type, name, platform, deployment_target = nil, product_group = nil, language = nil)
715
+ def new_target(type, name, platform, deployment_target = nil, product_group = nil, language = nil, product_basename = nil)
715
716
  product_group ||= products_group
716
- ProjectHelper.new_target(self, type, name, platform, deployment_target, product_group, language)
717
+ product_basename ||= name
718
+ ProjectHelper.new_target(self, type, name, platform, deployment_target, product_group, language, product_basename)
717
719
  end
718
720
 
719
721
  # Creates a new resource bundles target and adds it to the project.
@@ -731,9 +733,10 @@ module Xcodeproj
731
733
  #
732
734
  # @return [PBXNativeTarget] the target.
733
735
  #
734
- def new_resources_bundle(name, platform, product_group = nil)
736
+ def new_resources_bundle(name, platform, product_group = nil, product_basename = nil)
735
737
  product_group ||= products_group
736
- ProjectHelper.new_resources_bundle(self, name, platform, product_group)
738
+ product_basename ||= name
739
+ ProjectHelper.new_resources_bundle(self, name, platform, product_group, product_basename)
737
740
  end
738
741
 
739
742
  # Creates a new target and adds it to the project.
@@ -23,6 +23,78 @@ module Xcodeproj
23
23
  def build_configuration=(config_name)
24
24
  @xml_element.attributes['buildConfiguration'] = config_name
25
25
  end
26
+
27
+ # @return [Array<ExecutionAction>]
28
+ # The list of actions to run before this scheme action.
29
+ # Each entry can be either a 'Run Script' or a 'Send Email' action.
30
+ #
31
+ def pre_actions
32
+ pre_actions = @xml_element.elements['PreActions']
33
+ return nil unless pre_actions
34
+ pre_actions.get_elements('ExecutionAction').map do |entry_node|
35
+ ExecutionAction.new(entry_node)
36
+ end
37
+ end
38
+
39
+ # @param [Array<ExecutionAction>] pre_actions
40
+ # Set the list of actions to run before this scheme action.
41
+ # Each entry can be either a 'Run Script' or a 'Send Email' action.
42
+ #
43
+ def pre_actions=(pre_actions)
44
+ @xml_element.delete_element('PreActions')
45
+ unless pre_actions.empty?
46
+ pre_actions_element = @xml_element.add_element('PreActions')
47
+ pre_actions.each do |entry_node|
48
+ pre_actions_element.add_element(entry_node.xml_element)
49
+ end
50
+ end
51
+ pre_actions
52
+ end
53
+
54
+ # @param [ExecutionAction] pre_action
55
+ # Add an action to the list of actions to run before this scheme action.
56
+ # It can be either a 'Run Script' or a 'Send Email' action.
57
+ #
58
+ def add_pre_action(pre_action)
59
+ pre_actions = @xml_element.elements['PreActions'] || @xml_element.add_element('PreActions')
60
+ pre_actions.add_element(pre_action.xml_element)
61
+ end
62
+
63
+ # @return [Array<ExecutionAction>]
64
+ # The list of actions to run after this scheme action.
65
+ # Each entry can be either a 'Run Script' or a 'Send Email' action.
66
+ #
67
+ def post_actions
68
+ post_actions = @xml_element.elements['PostActions']
69
+ return nil unless post_actions
70
+ post_actions.get_elements('ExecutionAction').map do |entry_node|
71
+ ExecutionAction.new(entry_node)
72
+ end
73
+ end
74
+
75
+ # @param [Array<ExecutionAction>] post_actions
76
+ # Set the list of actions to run after this scheme action.
77
+ # Each entry can be either a 'Run Script' or a 'Send Email' action.
78
+ #
79
+ def post_actions=(post_actions)
80
+ @xml_element.delete_element('PostActions')
81
+ unless post_actions.empty?
82
+ post_actions_element = @xml_element.add_element('PostActions')
83
+ post_actions.each do |entry_node|
84
+ post_actions_element.add_element(entry_node.xml_element)
85
+ end
86
+ end
87
+ post_actions
88
+ end
89
+
90
+ # @param [ExecutionAction] post_action
91
+ # Add an action to the list of actions to run after this scheme action.
92
+ # It can be either a 'Run Script' or a 'Send Email' action.
93
+ #
94
+ def add_post_action(post_action)
95
+ post_actions = @xml_element.elements['PostActions'] || @xml_element.add_element('PostActions')
96
+ post_actions.add_element(post_action.xml_element)
97
+ end
26
98
  end
27
99
  end
28
100
  end
@@ -19,6 +19,20 @@ module Xcodeproj
19
19
  end
20
20
  end
21
21
 
22
+ # @return [Bool]
23
+ # Whether or not to run post actions on build failure
24
+ #
25
+ def run_post_actions_on_failure?
26
+ string_to_bool(@xml_element.attributes['runPostActionsOnFailure'])
27
+ end
28
+
29
+ # @param [Bool] flag
30
+ # Set whether or not to run post actions on build failure
31
+ #
32
+ def run_post_actions_on_failure=(flag)
33
+ @xml_element.attributes['runPostActionsOnFailure'] = bool_to_string(flag)
34
+ end
35
+
22
36
  # @return [Bool]
23
37
  # Whether or not to build the various targets in parallel
24
38
  #
@@ -47,6 +61,78 @@ module Xcodeproj
47
61
  @xml_element.attributes['buildImplicitDependencies'] = bool_to_string(flag)
48
62
  end
49
63
 
64
+ # @return [Array<ExecutionAction>]
65
+ # The list of actions to run before this scheme action.
66
+ # Each entry can be either a 'Run Script' or a 'Send Email' action.
67
+ #
68
+ def pre_actions
69
+ pre_actions = @xml_element.elements['PreActions']
70
+ return nil unless pre_actions
71
+ pre_actions.get_elements('ExecutionAction').map do |entry_node|
72
+ ExecutionAction.new(entry_node)
73
+ end
74
+ end
75
+
76
+ # @param [Array<ExecutionAction>] pre_actions
77
+ # Set the list of actions to run before this scheme action.
78
+ # Each entry can be either a 'Run Script' or a 'Send Email' action.
79
+ #
80
+ def pre_actions=(pre_actions)
81
+ @xml_element.delete_element('PreActions')
82
+ unless pre_actions.empty?
83
+ pre_actions_element = @xml_element.add_element('PreActions')
84
+ pre_actions.each do |entry_node|
85
+ pre_actions_element.add_element(entry_node.xml_element)
86
+ end
87
+ end
88
+ pre_actions
89
+ end
90
+
91
+ # @param [ExecutionAction] pre_action
92
+ # Add an action to the list of actions to run before this scheme action.
93
+ # It can be either a 'Run Script' or a 'Send Email' action.
94
+ #
95
+ def add_pre_action(pre_action)
96
+ pre_actions = @xml_element.elements['PreActions'] || @xml_element.add_element('PreActions')
97
+ pre_actions.add_element(pre_action.xml_element)
98
+ end
99
+
100
+ # @return [Array<ExecutionAction>]
101
+ # The list of actions to run after this scheme action.
102
+ # Each entry can be either a 'Run Script' or a 'Send Email' action.
103
+ #
104
+ def post_actions
105
+ post_actions = @xml_element.elements['PostActions']
106
+ return nil unless post_actions
107
+ post_actions.get_elements('ExecutionAction').map do |entry_node|
108
+ ExecutionAction.new(entry_node)
109
+ end
110
+ end
111
+
112
+ # @param [Array<ExecutionAction>] post_actions
113
+ # Set the list of actions to run after this scheme action.
114
+ # Each entry can be either a 'Run Script' or a 'Send Email' action.
115
+ #
116
+ def post_actions=(post_actions)
117
+ @xml_element.delete_element('PostActions')
118
+ unless post_actions.empty?
119
+ post_actions_element = @xml_element.add_element('PostActions')
120
+ post_actions.each do |entry_node|
121
+ post_actions_element.add_element(entry_node.xml_element)
122
+ end
123
+ end
124
+ post_actions
125
+ end
126
+
127
+ # @param [ExecutionAction] post_action
128
+ # Add an action to the list of actions to run after this scheme action.
129
+ # It can be either a 'Run Script' or a 'Send Email' action.
130
+ #
131
+ def add_post_action(post_action)
132
+ post_actions = @xml_element.elements['PostActions'] || @xml_element.add_element('PostActions')
133
+ post_actions.add_element(post_action.xml_element)
134
+ end
135
+
50
136
  # @return [Array<BuildAction::Entry>]
51
137
  # The list of BuildActionEntry nodes associated with this Build Action.
52
138
  # Each entry represent a target to build and tells for which action it's needed to be built.
@@ -103,11 +189,11 @@ module Xcodeproj
103
189
  is_app_target = app_types.include?(target_or_node.product_type)
104
190
  end
105
191
 
106
- self.build_for_analyzing = true
107
192
  self.build_for_testing = is_test_target
108
193
  self.build_for_running = is_app_target
109
194
  self.build_for_profiling = is_app_target
110
195
  self.build_for_archiving = is_app_target
196
+ self.build_for_analyzing = true
111
197
 
112
198
  add_buildable_reference BuildableReference.new(target_or_node) if target_or_node
113
199
  end
@@ -0,0 +1,86 @@
1
+ module Xcodeproj
2
+ class XCScheme
3
+ # This class wraps the ExecutionAction node of a .xcscheme XML file
4
+ #
5
+ class ExecutionAction < XMLElementWrapper
6
+ # @param [REXML::Element] node
7
+ # The 'ExecutionAction' XML node that this object will wrap.
8
+ # If nil, will create an empty one
9
+ #
10
+ # @param [Symbol] action_type
11
+ # One of `EXECUTION_ACTION_TYPE.keys`
12
+ #
13
+ def initialize(node = nil, action_type = nil)
14
+ create_xml_element_with_fallback(node, 'ExecutionAction') do
15
+ type = action_type || node.action_type
16
+ raise "[Xcodeproj] Invalid ActionType `#{type}`" unless Constants::EXECUTION_ACTION_TYPE.keys.include?(type)
17
+ @xml_element.attributes['ActionType'] = Constants::EXECUTION_ACTION_TYPE[type]
18
+ end
19
+ end
20
+
21
+ # @return [String]
22
+ # The ActionType of this ExecutionAction. One of two values:
23
+ #
24
+ # Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction,
25
+ # Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.SendEmailAction
26
+ #
27
+ def action_type
28
+ @xml_element.attributes['ActionType']
29
+ end
30
+
31
+ # @return [ShellScriptActionContent]
32
+ # If action_type is 'Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction'
33
+ # returns the contents of the shell script to run pre/post action.
34
+ #
35
+ # @return [SendEmailActionContent]
36
+ # If action_type is 'Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.SendEmailAction'
37
+ # returns the contents of the email to send pre/post action.
38
+ #
39
+ def action_content
40
+ case action_type
41
+ when Constants::EXECUTION_ACTION_TYPE[:shell_script]
42
+ ShellScriptActionContent.new(@xml_element.elements['ActionContent'])
43
+ when Constants::EXECUTION_ACTION_TYPE[:send_email]
44
+ SendEmailActionContent.new(@xml_element.elements['ActionContent'])
45
+ else
46
+ raise "[Xcodeproj] Invalid ActionType `#{action_type}`"
47
+ end
48
+ end
49
+
50
+ # @param [ShellScriptActionContent, SendEmailActionContent] value
51
+ # Set either the contents of the shell script to run pre/post action
52
+ # or the contents of the email to send pre/post action.
53
+ #
54
+ def action_content=(value)
55
+ raise "[Xcodeproj] Invalid ActionContent `#{value.class}` for " \
56
+ "ActionType `#{action_type}`" unless valid_action_content?(value)
57
+
58
+ @xml_element.delete_element('ActionContent')
59
+ @xml_element.add_element(value.xml_element)
60
+ end
61
+
62
+ #-------------------------------------------------------------------------#
63
+
64
+ private
65
+
66
+ # @!group Private helpers
67
+
68
+ # @return [Bool]
69
+ # True if value (ActionContent) is valid for current action_type
70
+ #
71
+ # @param [ShellScriptActionContent, SendEmailActionContent] value
72
+ # Checks if value matches the expected action_type if present.
73
+ #
74
+ def valid_action_content?(value)
75
+ case action_type
76
+ when Constants::EXECUTION_ACTION_TYPE[:shell_script]
77
+ value.is_a?(ShellScriptActionContent)
78
+ when Constants::EXECUTION_ACTION_TYPE[:send_email]
79
+ value.is_a?(SendEmailActionContent)
80
+ else
81
+ false
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -11,6 +11,8 @@ module Xcodeproj
11
11
  #
12
12
  def initialize(node = nil)
13
13
  create_xml_element_with_fallback(node, 'LaunchAction') do
14
+ self.build_configuration = 'Debug'
15
+
14
16
  # Add some attributes (that are not handled by this wrapper class yet but expected in the XML)
15
17
  @xml_element.attributes['selectedDebuggerIdentifier'] = 'Xcode.DebuggerFoundation.Debugger.LLDB'
16
18
  @xml_element.attributes['selectedLauncherIdentifier'] = 'Xcode.DebuggerFoundation.Launcher.LLDB'
@@ -19,10 +21,8 @@ module Xcodeproj
19
21
  @xml_element.attributes['ignoresPersistentStateOnLaunch'] = bool_to_string(false)
20
22
  @xml_element.attributes['debugDocumentVersioning'] = bool_to_string(true)
21
23
  @xml_element.attributes['debugServiceExtension'] = 'internal'
22
- @xml_element.add_element('AdditionalOptions')
23
24
 
24
25
  # Setup default values for other (handled) attributes
25
- self.build_configuration = 'Debug'
26
26
  self.allow_location_simulation = true
27
27
  end
28
28
  end
@@ -47,6 +47,21 @@ module Xcodeproj
47
47
  @xml_element.attributes['allowLocationSimulation'] = bool_to_string(flag)
48
48
  end
49
49
 
50
+ # @return [LocationScenarioReference]
51
+ # The LocationScenarioReference to simulate a GPS location when executing the Launch Action
52
+ #
53
+ def location_scenario_reference?
54
+ LocationScenarioReference.new(@xml_element.elements['LocationScenarioReference'])
55
+ end
56
+
57
+ # @return [LocationScenarioReference]
58
+ # Set the LocationScenarioReference which simulates a GPS location when executing the Launch Action
59
+ #
60
+ def location_scenario_reference=(reference)
61
+ @xml_element.delete_element('LocationScenarioReference')
62
+ @xml_element.add_element(reference.xml_element) if reference
63
+ end
64
+
50
65
  # @return [Bool]
51
66
  # Whether this Build Action should disable detection of UI API misuse
52
67
  # from background threads
@@ -0,0 +1,49 @@
1
+ module Xcodeproj
2
+ class XCScheme
3
+ # This class wraps the LocationScenarioReference node of a .xcscheme XML file
4
+ #
5
+ # A LocationScenarioReference is a reference to a simulated GPS location associated
6
+ # with a scheme's launch action
7
+ #
8
+ class LocationScenarioReference < XMLElementWrapper
9
+ # @param [Xcodeproj::Project::Object::AbstractTarget, REXML::Element] target_or_node
10
+ # Either the Xcode target to reference,
11
+ # or an existing XML 'LocationScenarioReference' node element to reference
12
+ #
13
+ def initialize(target_or_node)
14
+ create_xml_element_with_fallback(target_or_node, 'LocationScenarioReference') do
15
+ self.identifier = ''
16
+ self.reference_type = '0'
17
+ end
18
+ end
19
+
20
+ # @return [String]
21
+ # The identifier of a built-in location scenario reference, or a path to a GPX file
22
+ #
23
+ def identifier
24
+ @xml_element.attributes['identifier']
25
+ end
26
+
27
+ # @param [String] value
28
+ # Set the identifier for the location scenario reference
29
+ #
30
+ def identifier=(value)
31
+ @xml_element.attributes['identifier'] = value
32
+ end
33
+
34
+ # @return [String]
35
+ # The reference type is 0 when using a custom GPX file, or 1 when using a built-in location reference
36
+ #
37
+ def reference_type
38
+ @xml_element.attributes['referenceType']
39
+ end
40
+
41
+ # @param [String] value
42
+ # Set the reference type for the location scenario reference
43
+ #
44
+ def reference_type=(value)
45
+ @xml_element.attributes['referenceType'] = value
46
+ end
47
+ end
48
+ end
49
+ end
@@ -11,14 +11,14 @@ module Xcodeproj
11
11
  #
12
12
  def initialize(node = nil)
13
13
  create_xml_element_with_fallback(node, 'ProfileAction') do
14
+ # Setup default values for other (handled) attributes
15
+ self.build_configuration = 'Release'
16
+ self.should_use_launch_scheme_args_env = true
17
+
14
18
  # Add some attributes (that are not handled by this wrapper class yet but expected in the XML)
15
19
  @xml_element.attributes['savedToolIdentifier'] = ''
16
20
  @xml_element.attributes['useCustomWorkingDirectory'] = bool_to_string(false)
17
21
  @xml_element.attributes['debugDocumentVersioning'] = bool_to_string(true)
18
-
19
- # Setup default values for other (handled) attributes
20
- self.build_configuration = 'Release'
21
- self.should_use_launch_scheme_args_env = true
22
22
  end
23
23
  end
24
24
 
@@ -42,7 +42,7 @@ module Xcodeproj
42
42
  # The BuildableProductRunnable to launch when launching the Profile action
43
43
  #
44
44
  def buildable_product_runnable
45
- BuildableProductRunnable.new @xml_element.elements['BuildableProductRunnable']
45
+ BuildableProductRunnable.new @xml_element.elements['BuildableProductRunnable'], 0
46
46
  end
47
47
 
48
48
  # @param [BuildableProductRunnable] runnable
@@ -0,0 +1,84 @@
1
+ module Xcodeproj
2
+ class XCScheme
3
+ # This class wraps a 'ActionContent' node of type
4
+ # 'Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.SendEmailAction' of a .xcscheme XML file
5
+ #
6
+ class SendEmailActionContent < XMLElementWrapper
7
+ # @param [REXML::Element] node
8
+ # The 'ActionContent' XML node that this object will wrap.
9
+ # If nil, will create a default XML node to use.
10
+ #
11
+ def initialize(node = nil)
12
+ create_xml_element_with_fallback(node, 'ActionContent') do
13
+ self.title = 'Send Email'
14
+ # For some reason this is not visible in Xcode's UI and it's always set to 'NO'
15
+ # couldn't find much documentation on it so it might be safer to keep it read only
16
+ @xml_element.attributes['attachLogToEmail'] = 'NO'
17
+ end
18
+ end
19
+
20
+ # @return [Bool]
21
+ # Whether or not this action should attach log to email
22
+ #
23
+ def attach_log_to_email?
24
+ string_to_bool(@xml_element.attributes['attachLogToEmail'])
25
+ end
26
+
27
+ # @return [String]
28
+ # The title of this ActionContent
29
+ #
30
+ def title
31
+ @xml_element.attributes['title']
32
+ end
33
+
34
+ # @param [String] value
35
+ # Set the title of this ActionContent
36
+ #
37
+ def title=(value)
38
+ @xml_element.attributes['title'] = value
39
+ end
40
+
41
+ # @return [String]
42
+ # The email recipient of this ActionContent
43
+ #
44
+ def email_recipient
45
+ @xml_element.attributes['emailRecipient']
46
+ end
47
+
48
+ # @param [String] value
49
+ # Set the email recipient of this ActionContent
50
+ #
51
+ def email_recipient=(value)
52
+ @xml_element.attributes['emailRecipient'] = value
53
+ end
54
+
55
+ # @return [String]
56
+ # The email subject of this ActionContent
57
+ #
58
+ def email_subject
59
+ @xml_element.attributes['emailSubject']
60
+ end
61
+
62
+ # @param [String] value
63
+ # Set the email subject of this ActionContent
64
+ #
65
+ def email_subject=(value)
66
+ @xml_element.attributes['emailSubject'] = value
67
+ end
68
+
69
+ # @return [String]
70
+ # The email body of this ActionContent
71
+ #
72
+ def email_body
73
+ @xml_element.attributes['emailBody']
74
+ end
75
+
76
+ # @param [String] value
77
+ # Set the email body of this ActionContent
78
+ #
79
+ def email_body=(value)
80
+ @xml_element.attributes['emailBody'] = value
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,77 @@
1
+ module Xcodeproj
2
+ class XCScheme
3
+ # This class wraps a 'ActionContent' node of type
4
+ # 'Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction' of a .xcscheme XML file
5
+ #
6
+ class ShellScriptActionContent < XMLElementWrapper
7
+ # @param [REXML::Element] node
8
+ # The 'ActionContent' XML node that this object will wrap.
9
+ # If nil, will create a default XML node to use.
10
+ #
11
+ def initialize(node = nil)
12
+ create_xml_element_with_fallback(node, 'ActionContent') do
13
+ self.title = 'Run Script'
14
+ end
15
+ end
16
+
17
+ # @return [String]
18
+ # The title of this ActionContent
19
+ #
20
+ def title
21
+ @xml_element.attributes['title']
22
+ end
23
+
24
+ # @param [String] value
25
+ # Set the title of this ActionContent
26
+ #
27
+ def title=(value)
28
+ @xml_element.attributes['title'] = value
29
+ end
30
+
31
+ # @return [String]
32
+ # The contents of the shell script represented by this ActionContent
33
+ #
34
+ def script_text
35
+ @xml_element.attributes['scriptText']
36
+ end
37
+
38
+ # @param [String] value
39
+ # Set the contents of the shell script represented by this ActionContent
40
+ #
41
+ def script_text=(value)
42
+ @xml_element.attributes['scriptText'] = value
43
+ end
44
+
45
+ # @return [String]
46
+ # The preferred shell to invoke with this ActionContent
47
+ #
48
+ def shell_to_invoke
49
+ @xml_element.attributes['shellToInvoke']
50
+ end
51
+
52
+ # @param [String] value
53
+ # Set the preferred shell to invoke with this ActionContent
54
+ #
55
+ def shell_to_invoke=(value)
56
+ @xml_element.attributes['shellToInvoke'] = value
57
+ end
58
+
59
+ # @return [BuildableReference]
60
+ # The BuildableReference (Xcode target) associated with this ActionContent
61
+ #
62
+ def buildable_reference
63
+ BuildableReference.new(@xml_element.elements['EnvironmentBuildable'].elements['BuildableReference'])
64
+ end
65
+
66
+ # @param [BuildableReference] ref
67
+ # Set the BuildableReference (Xcode target) associated with this ActionContent
68
+ #
69
+ def buildable_reference=(ref)
70
+ @xml_element.delete_element('EnvironmentBuildable')
71
+
72
+ env_buildable = @xml_element.add_element('EnvironmentBuildable')
73
+ env_buildable.add_element(ref.xml_element)
74
+ end
75
+ end
76
+ end
77
+ end