xcodeproj 1.14.0 → 1.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/xcodeproj/command/sort.rb +12 -1
- data/lib/xcodeproj/config/other_linker_flags_parser.rb +5 -0
- data/lib/xcodeproj/config.rb +12 -2
- data/lib/xcodeproj/constants.rb +63 -49
- data/lib/xcodeproj/gem_version.rb +1 -1
- data/lib/xcodeproj/project/object/build_configuration.rb +33 -8
- data/lib/xcodeproj/project/object/build_file.rb +7 -1
- data/lib/xcodeproj/project/object/build_phase.rb +31 -0
- data/lib/xcodeproj/project/object/group.rb +11 -9
- data/lib/xcodeproj/project/object/helpers/file_references_factory.rb +8 -6
- data/lib/xcodeproj/project/object/helpers/groupable_helper.rb +2 -2
- data/lib/xcodeproj/project/object/native_target.rb +43 -0
- data/lib/xcodeproj/project/object/swift_package_product_dependency.rb +10 -0
- data/lib/xcodeproj/project/object/swift_package_remote_reference.rb +14 -0
- data/lib/xcodeproj/project/object/target_dependency.rb +1 -0
- data/lib/xcodeproj/project/project_helper.rb +6 -6
- data/lib/xcodeproj/project.rb +9 -6
- data/lib/xcodeproj/scheme/abstract_scheme_action.rb +72 -0
- data/lib/xcodeproj/scheme/build_action.rb +108 -1
- data/lib/xcodeproj/scheme/execution_action.rb +86 -0
- data/lib/xcodeproj/scheme/launch_action.rb +33 -2
- data/lib/xcodeproj/scheme/location_scenario_reference.rb +49 -0
- data/lib/xcodeproj/scheme/profile_action.rb +5 -5
- data/lib/xcodeproj/scheme/send_email_action_content.rb +84 -0
- data/lib/xcodeproj/scheme/shell_script_action_content.rb +77 -0
- data/lib/xcodeproj/scheme/test_action.rb +26 -3
- data/lib/xcodeproj/scheme.rb +5 -1
- data/lib/xcodeproj/workspace/file_reference.rb +1 -1
- data/lib/xcodeproj/workspace.rb +3 -2
- metadata +26 -8
@@ -552,6 +552,49 @@ module Xcodeproj
|
|
552
552
|
end
|
553
553
|
end
|
554
554
|
|
555
|
+
# Adds on demand resources to the resources build phase of the target.
|
556
|
+
#
|
557
|
+
# @param {String => [Array<PBXFileReference>]} on_demand_resource_tag_files
|
558
|
+
# the files references of the on demand resources to add to the target keyed by the tag.
|
559
|
+
#
|
560
|
+
# @return [void]
|
561
|
+
#
|
562
|
+
def add_on_demand_resources(on_demand_resource_tag_files)
|
563
|
+
on_demand_resource_tag_files.each do |tag, file_refs|
|
564
|
+
file_refs.each do |file_ref|
|
565
|
+
if resources_build_phase.include?(file_ref)
|
566
|
+
existing_build_file = resources_build_phase.build_file(file_ref)
|
567
|
+
existing_build_file.settings ||= {}
|
568
|
+
existing_build_file.settings['ASSET_TAGS'] ||= []
|
569
|
+
existing_build_file.settings['ASSET_TAGS'] << tag
|
570
|
+
existing_build_file.settings['ASSET_TAGS'].uniq!
|
571
|
+
next
|
572
|
+
end
|
573
|
+
build_file = resources_build_phase.add_file_reference(file_ref, true)
|
574
|
+
build_file.settings = (build_file.settings ||= {}).merge('ASSET_TAGS' => [tag])
|
575
|
+
end
|
576
|
+
end
|
577
|
+
end
|
578
|
+
|
579
|
+
# Remove on demand resources from the resources build phase of the target.
|
580
|
+
#
|
581
|
+
# @param {String => [Array<PBXFileReference>]} on_demand_resource_tag_files
|
582
|
+
# the files references of the on demand resources to add to the target keyed by the tag.
|
583
|
+
#
|
584
|
+
# @return [void]
|
585
|
+
#
|
586
|
+
def remove_on_demand_resources(on_demand_resource_tag_files)
|
587
|
+
on_demand_resource_tag_files.each do |tag, file_refs|
|
588
|
+
file_refs.each do |file_ref|
|
589
|
+
build_file = resources_build_phase.build_file(file_ref)
|
590
|
+
next if build_file.nil?
|
591
|
+
asset_tags = build_file.settings['ASSET_TAGS']
|
592
|
+
asset_tags.delete(tag)
|
593
|
+
resources_build_phase.remove_file_reference(file_ref) if asset_tags.empty?
|
594
|
+
end
|
595
|
+
end
|
596
|
+
end
|
597
|
+
|
555
598
|
# Finds or creates the headers build phase of the target.
|
556
599
|
#
|
557
600
|
# @note A target should have only one headers build phase.
|
@@ -13,6 +13,16 @@ module Xcodeproj
|
|
13
13
|
# @return [String] the product name of this Swift package.
|
14
14
|
#
|
15
15
|
attribute :product_name, String
|
16
|
+
|
17
|
+
# @!group AbstractObject Hooks
|
18
|
+
#--------------------------------------#
|
19
|
+
|
20
|
+
# @return [String] the name of the Swift package.
|
21
|
+
#
|
22
|
+
def display_name
|
23
|
+
return product_name if product_name
|
24
|
+
super
|
25
|
+
end
|
16
26
|
end
|
17
27
|
end
|
18
28
|
end
|
@@ -13,6 +13,20 @@ module Xcodeproj
|
|
13
13
|
# @return [Hash] the version requirements for this Swift package.
|
14
14
|
#
|
15
15
|
attribute :requirement, Hash
|
16
|
+
|
17
|
+
# @!group AbstractObject Hooks
|
18
|
+
#--------------------------------------#
|
19
|
+
|
20
|
+
def ascii_plist_annotation
|
21
|
+
" #{isa} \"#{File.basename(display_name)}\" "
|
22
|
+
end
|
23
|
+
|
24
|
+
# @return [String] the name of the Swift package repository.
|
25
|
+
#
|
26
|
+
def display_name
|
27
|
+
return repositoryURL if repositoryURL
|
28
|
+
super
|
29
|
+
end
|
16
30
|
end
|
17
31
|
end
|
18
32
|
end
|
@@ -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 =
|
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(
|
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 =
|
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(
|
114
|
+
product = product_group.new_bundle(target.product_name)
|
115
115
|
target.product_reference = product
|
116
116
|
|
117
117
|
# Build phases
|
data/lib/xcodeproj/project.rb
CHANGED
@@ -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
|
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
|
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
|
-
|
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
|
-
|
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.
|
@@ -59,6 +145,20 @@ module Xcodeproj
|
|
59
145
|
end
|
60
146
|
end
|
61
147
|
|
148
|
+
# @param [Array<BuildAction::Entry>] entries
|
149
|
+
# Sets the list of BuildActionEntry nodes associated with this Build Action.
|
150
|
+
#
|
151
|
+
def entries=(entries)
|
152
|
+
@xml_element.delete_element('BuildActionEntries')
|
153
|
+
unless entries.empty?
|
154
|
+
entries_element = @xml_element.add_element('BuildActionEntries')
|
155
|
+
entries.each do |entry_node|
|
156
|
+
entries_element.add_element(entry_node.xml_element)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
entries
|
160
|
+
end
|
161
|
+
|
62
162
|
# @param [BuildAction::Entry] entry
|
63
163
|
# The BuildActionEntry to add to the list of targets to build for the various actions
|
64
164
|
#
|
@@ -89,11 +189,11 @@ module Xcodeproj
|
|
89
189
|
is_app_target = app_types.include?(target_or_node.product_type)
|
90
190
|
end
|
91
191
|
|
92
|
-
self.build_for_analyzing = true
|
93
192
|
self.build_for_testing = is_test_target
|
94
193
|
self.build_for_running = is_app_target
|
95
194
|
self.build_for_profiling = is_app_target
|
96
195
|
self.build_for_archiving = is_app_target
|
196
|
+
self.build_for_analyzing = true
|
97
197
|
|
98
198
|
add_buildable_reference BuildableReference.new(target_or_node) if target_or_node
|
99
199
|
end
|
@@ -185,6 +285,13 @@ module Xcodeproj
|
|
185
285
|
def add_buildable_reference(ref)
|
186
286
|
@xml_element.add_element(ref.xml_element)
|
187
287
|
end
|
288
|
+
|
289
|
+
# @param [BuildableReference] ref
|
290
|
+
# The BuildableReference to remove from the list of targets this entry will build
|
291
|
+
#
|
292
|
+
def remove_buildable_reference(ref)
|
293
|
+
@xml_element.delete_element(ref.xml_element)
|
294
|
+
end
|
188
295
|
end
|
189
296
|
end
|
190
297
|
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
|
@@ -143,6 +158,22 @@ module Xcodeproj
|
|
143
158
|
@xml_element.add_element(arguments.xml_element) if arguments
|
144
159
|
arguments
|
145
160
|
end
|
161
|
+
|
162
|
+
# @return [Array<MacroExpansion>]
|
163
|
+
# The list of MacroExpansion bound with this LaunchAction
|
164
|
+
#
|
165
|
+
def macro_expansions
|
166
|
+
@xml_element.get_elements('MacroExpansion').map do |node|
|
167
|
+
MacroExpansion.new(node)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# @param [MacroExpansion] macro_expansion
|
172
|
+
# Add a MacroExpansion to this LaunchAction
|
173
|
+
#
|
174
|
+
def add_macro_expansion(macro_expansion)
|
175
|
+
@xml_element.add_element(macro_expansion.xml_element)
|
176
|
+
end
|
146
177
|
end
|
147
178
|
end
|
148
179
|
end
|
@@ -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
|