xcodeproj 1.16.0 → 1.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/xcodeproj/command/sort.rb +12 -1
  4. data/lib/xcodeproj/config.rb +12 -2
  5. data/lib/xcodeproj/config/other_linker_flags_parser.rb +5 -0
  6. data/lib/xcodeproj/constants.rb +62 -49
  7. data/lib/xcodeproj/gem_version.rb +1 -1
  8. data/lib/xcodeproj/project.rb +9 -6
  9. data/lib/xcodeproj/project/object/build_file.rb +3 -1
  10. data/lib/xcodeproj/project/object/build_phase.rb +10 -0
  11. data/lib/xcodeproj/project/object/group.rb +6 -6
  12. data/lib/xcodeproj/project/object/helpers/file_references_factory.rb +8 -6
  13. data/lib/xcodeproj/project/object/helpers/groupable_helper.rb +1 -1
  14. data/lib/xcodeproj/project/object/swift_package_product_dependency.rb +10 -0
  15. data/lib/xcodeproj/project/object/swift_package_remote_reference.rb +14 -0
  16. data/lib/xcodeproj/project/object/target_dependency.rb +1 -0
  17. data/lib/xcodeproj/project/project_helper.rb +6 -6
  18. data/lib/xcodeproj/scheme.rb +5 -1
  19. data/lib/xcodeproj/scheme/abstract_scheme_action.rb +72 -0
  20. data/lib/xcodeproj/scheme/build_action.rb +87 -1
  21. data/lib/xcodeproj/scheme/execution_action.rb +86 -0
  22. data/lib/xcodeproj/scheme/launch_action.rb +17 -2
  23. data/lib/xcodeproj/scheme/location_scenario_reference.rb +49 -0
  24. data/lib/xcodeproj/scheme/profile_action.rb +5 -5
  25. data/lib/xcodeproj/scheme/send_email_action_content.rb +84 -0
  26. data/lib/xcodeproj/scheme/shell_script_action_content.rb +77 -0
  27. data/lib/xcodeproj/scheme/test_action.rb +7 -3
  28. data/lib/xcodeproj/workspace.rb +3 -2
  29. data/lib/xcodeproj/workspace/file_reference.rb +1 -1
  30. metadata +26 -8
@@ -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
@@ -11,11 +11,11 @@ module Xcodeproj
11
11
  #
12
12
  def initialize(node = nil)
13
13
  create_xml_element_with_fallback(node, 'TestAction') do
14
+ self.build_configuration = 'Debug'
14
15
  @xml_element.attributes['selectedDebuggerIdentifier'] = 'Xcode.DebuggerFoundation.Debugger.LLDB'
15
16
  @xml_element.attributes['selectedLauncherIdentifier'] = 'Xcode.DebuggerFoundation.Launcher.LLDB'
16
- @xml_element.add_element('AdditionalOptions')
17
17
  self.should_use_launch_scheme_args_env = true
18
- self.build_configuration = 'Debug'
18
+ @xml_element.add_element('Testables')
19
19
  end
20
20
  end
21
21
 
@@ -109,7 +109,11 @@ module Xcodeproj
109
109
  # Add a MacroExpansion to this TestAction
110
110
  #
111
111
  def add_macro_expansion(macro_expansion)
112
- @xml_element.add_element(macro_expansion.xml_element)
112
+ if testables = @xml_element.elements['Testables']
113
+ @xml_element.insert_before(testables, macro_expansion.xml_element)
114
+ else
115
+ @xml_element.add_element(macro_expansion.xml_element)
116
+ end
113
117
  end
114
118
 
115
119
  # @return [EnvironmentVariables]
@@ -107,8 +107,9 @@ module Xcodeproj
107
107
  else
108
108
  raise ArgumentError, "Input to the << operator must be a file path or FileReference, got #{path_or_reference.inspect}"
109
109
  end
110
-
111
- @document.root.add_element(project_file_reference.to_node)
110
+ unless file_references.any? { |ref| project_file_reference.eql? ref }
111
+ @document.root.add_element(project_file_reference.to_node)
112
+ end
112
113
  load_schemes_from_project File.expand_path(projpath || project_file_reference.path)
113
114
  end
114
115
 
@@ -13,7 +13,7 @@ module Xcodeproj
13
13
  # @param [#to_s] type @see type
14
14
  #
15
15
  def initialize(path, type = 'group')
16
- @path = path.to_s
16
+ @path = Pathname.new(path.to_s).cleanpath.to_s
17
17
  @type = type.to_s
18
18
  end
19
19
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcodeproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-10 00:00:00.000000000 Z
11
+ date: 2021-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: atomos
@@ -84,14 +84,28 @@ dependencies:
84
84
  requirements:
85
85
  - - "~>"
86
86
  - !ruby/object:Gem::Version
87
- version: 0.2.6
87
+ version: 0.3.0
88
88
  type: :runtime
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - "~>"
93
93
  - !ruby/object:Gem::Version
94
- version: 0.2.6
94
+ version: 0.3.0
95
+ - !ruby/object:Gem::Dependency
96
+ name: rexml
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: 3.2.4
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: 3.2.4
95
109
  description: Xcodeproj lets you create and modify Xcode projects from Ruby. Script
96
110
  boring management tasks or build Xcode-friendly libraries. Also includes support
97
111
  for Xcode workspaces (.xcworkspace) and configuration files (.xcconfig).
@@ -152,10 +166,14 @@ files:
152
166
  - lib/xcodeproj/scheme/buildable_reference.rb
153
167
  - lib/xcodeproj/scheme/command_line_arguments.rb
154
168
  - lib/xcodeproj/scheme/environment_variables.rb
169
+ - lib/xcodeproj/scheme/execution_action.rb
155
170
  - lib/xcodeproj/scheme/launch_action.rb
171
+ - lib/xcodeproj/scheme/location_scenario_reference.rb
156
172
  - lib/xcodeproj/scheme/macro_expansion.rb
157
173
  - lib/xcodeproj/scheme/profile_action.rb
158
174
  - lib/xcodeproj/scheme/remote_runnable.rb
175
+ - lib/xcodeproj/scheme/send_email_action_content.rb
176
+ - lib/xcodeproj/scheme/shell_script_action_content.rb
159
177
  - lib/xcodeproj/scheme/test_action.rb
160
178
  - lib/xcodeproj/scheme/xml_element_wrapper.rb
161
179
  - lib/xcodeproj/user_interface.rb
@@ -168,7 +186,7 @@ homepage: https://github.com/cocoapods/xcodeproj
168
186
  licenses:
169
187
  - MIT
170
188
  metadata: {}
171
- post_install_message:
189
+ post_install_message:
172
190
  rdoc_options: []
173
191
  require_paths:
174
192
  - lib
@@ -183,8 +201,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
201
  - !ruby/object:Gem::Version
184
202
  version: '0'
185
203
  requirements: []
186
- rubygems_version: 3.1.2
187
- signing_key:
204
+ rubygems_version: 3.0.3
205
+ signing_key:
188
206
  specification_version: 3
189
207
  summary: Create and modify Xcode projects from Ruby.
190
208
  test_files: []