xcodeproj 1.21.0 → 1.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/lib/xcodeproj/command.rb +6 -3
- data/lib/xcodeproj/constants.rb +4 -3
- data/lib/xcodeproj/differ.rb +33 -2
- data/lib/xcodeproj/gem_version.rb +1 -1
- data/lib/xcodeproj/project/object/build_configuration.rb +1 -1
- data/lib/xcodeproj/project/object/build_rule.rb +7 -0
- data/lib/xcodeproj/project/object/file_reference.rb +3 -2
- data/lib/xcodeproj/project/object/group.rb +20 -1
- data/lib/xcodeproj/project/object/reference_proxy.rb +19 -0
- data/lib/xcodeproj/project/object/target_dependency.rb +13 -6
- data/lib/xcodeproj/scheme/test_action.rb +38 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0788725232bb312e7454dbec2640d078bd514c469deeeff4e57544e837187ac
|
4
|
+
data.tar.gz: fc1af51df95f4fdcaee3040adafdb0afaf5de03e036a32d2769c7af9a2d36fd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39a057723656bb7016aa845c427a90c1c6e264f34c3c8eee67b424a7952975371ad56e44569b7e0681154cbd2a4ed2bb82589dc1087a95969d64cfa2c5a5654a
|
7
|
+
data.tar.gz: c9c72a16fe6597d7b6408b49ec6d98083c7e828e444b9e3a17c5155da69e1d3f6869ccfdbaa074eeb13537e81c5e214fb8dc1a975a8633a6c2c718333748fd2b
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Xcodeproj
|
2
2
|
|
3
|
-
[![Build Status](https://img.shields.io/
|
4
|
-
[![
|
5
|
-
[![
|
3
|
+
[![Build Status](https://img.shields.io/github/workflow/status/CocoaPods/Xcodeproj/Specs)](https://github.com/CocoaPods/Xcodeproj/actions)
|
4
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/40ae104586c859d3581e/maintainability)](https://codeclimate.com/github/CocoaPods/Xcodeproj/maintainability)
|
5
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/40ae104586c859d3581e/test_coverage)](https://codeclimate.com/github/CocoaPods/Xcodeproj/test_coverage)
|
6
6
|
|
7
7
|
Xcodeproj lets you create and modify Xcode projects from [Ruby][ruby].
|
8
8
|
Script boring management tasks or build Xcode-friendly libraries. Also includes
|
@@ -64,6 +64,7 @@ project.targets.each do |target|
|
|
64
64
|
config.build_settings['MY_CUSTOM_FLAG'] ||= 'TRUE'
|
65
65
|
end
|
66
66
|
end
|
67
|
+
project.save
|
67
68
|
```
|
68
69
|
|
69
70
|
## Command Line Tool
|
data/lib/xcodeproj/command.rb
CHANGED
@@ -33,11 +33,14 @@ module Xcodeproj
|
|
33
33
|
elsif projects.size > 1
|
34
34
|
raise Informative, 'There are more than one Xcode project documents ' \
|
35
35
|
'in the current working directory. Please specify ' \
|
36
|
-
'
|
36
|
+
'the project as the first argument, or specify ' \
|
37
|
+
'which to use with the --project option if using ' \
|
38
|
+
'target-diff.'
|
37
39
|
else
|
38
40
|
raise Informative, 'No Xcode project document found in the current ' \
|
39
|
-
'working directory. Please specify
|
40
|
-
'
|
41
|
+
'working directory. Please specify the project ' \
|
42
|
+
'as the first argument, or specify which to use ' \
|
43
|
+
'with the --project option if using target-diff.' \
|
41
44
|
end
|
42
45
|
@xcodeproj_path = Pathname.new(xcodeproj_path).expand_path
|
43
46
|
end
|
data/lib/xcodeproj/constants.rb
CHANGED
@@ -32,15 +32,15 @@ module Xcodeproj
|
|
32
32
|
|
33
33
|
# @return [String] The last known object version to Xcodeproj.
|
34
34
|
#
|
35
|
-
LAST_KNOWN_OBJECT_VERSION =
|
35
|
+
LAST_KNOWN_OBJECT_VERSION = 56
|
36
36
|
|
37
37
|
# @return [String] The last known Xcode version to Xcodeproj.
|
38
38
|
#
|
39
|
-
LAST_UPGRADE_CHECK = '
|
39
|
+
LAST_UPGRADE_CHECK = '1300'
|
40
40
|
|
41
41
|
# @return [String] The last known Xcode version to Xcodeproj.
|
42
42
|
#
|
43
|
-
LAST_SWIFT_UPGRADE_CHECK = '
|
43
|
+
LAST_SWIFT_UPGRADE_CHECK = '1300'
|
44
44
|
|
45
45
|
# @return [String] The version of `.xcscheme` files supported by Xcodeproj
|
46
46
|
#
|
@@ -128,6 +128,7 @@ module Xcodeproj
|
|
128
128
|
# @return [Hash] The compatibility version string for different object versions.
|
129
129
|
#
|
130
130
|
COMPATIBILITY_VERSION_BY_OBJECT_VERSION = {
|
131
|
+
56 => 'Xcode 14.0',
|
131
132
|
55 => 'Xcode 13.0',
|
132
133
|
54 => 'Xcode 12.0',
|
133
134
|
53 => 'Xcode 11.4',
|
data/lib/xcodeproj/differ.rb
CHANGED
@@ -113,8 +113,8 @@ module Xcodeproj
|
|
113
113
|
ensure_class(value_2, Array)
|
114
114
|
return nil if value_1 == value_2
|
115
115
|
|
116
|
-
new_objects_value_1 = (value_1
|
117
|
-
new_objects_value_2 = (value_2
|
116
|
+
new_objects_value_1 = array_non_unique_diff(value_1, value_2)
|
117
|
+
new_objects_value_2 = array_non_unique_diff(value_2, value_1)
|
118
118
|
return nil if value_1.empty? && value_2.empty?
|
119
119
|
|
120
120
|
matched_diff = {}
|
@@ -234,6 +234,37 @@ module Xcodeproj
|
|
234
234
|
raise "Wrong type `#{object.inspect}`" unless object.is_a?(klass)
|
235
235
|
end
|
236
236
|
|
237
|
+
# Returns the difference between two arrays, taking into account the number of times an element
|
238
|
+
# repeats in both arrays.
|
239
|
+
#
|
240
|
+
# @param [Array] value_1
|
241
|
+
# First array to the difference operation.
|
242
|
+
#
|
243
|
+
# @param [Array] value_2
|
244
|
+
# Second array to the difference operation.
|
245
|
+
#
|
246
|
+
# @return [Array]
|
247
|
+
#
|
248
|
+
def self.array_non_unique_diff(value_1, value_2)
|
249
|
+
value_2_elements_by_count = value_2.reduce({}) do |hash, element|
|
250
|
+
updated_element_hash = hash.key?(element) ? { element => hash[element] + 1 } : { element => 1 }
|
251
|
+
hash.merge(updated_element_hash)
|
252
|
+
end
|
253
|
+
|
254
|
+
value_1_elements_by_deletions =
|
255
|
+
value_1.to_set.map do |element|
|
256
|
+
times_to_delete_element = value_2_elements_by_count[element] || 0
|
257
|
+
next [element, times_to_delete_element]
|
258
|
+
end.to_h
|
259
|
+
|
260
|
+
value_1.select do |element|
|
261
|
+
if value_1_elements_by_deletions[element] > 0
|
262
|
+
value_1_elements_by_deletions[element] -= 1
|
263
|
+
next false
|
264
|
+
end
|
265
|
+
next true
|
266
|
+
end
|
267
|
+
end
|
237
268
|
#-------------------------------------------------------------------------#
|
238
269
|
end
|
239
270
|
end
|
@@ -17,6 +17,13 @@ module Xcodeproj
|
|
17
17
|
#
|
18
18
|
attribute :compiler_spec, String
|
19
19
|
|
20
|
+
# @return [String] the discovered dependency file to use.
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# `$(DERIVED_FILES_DIR)/$(INPUT_FILE_NAME).d`.
|
24
|
+
#
|
25
|
+
attribute :dependency_file, String
|
26
|
+
|
20
27
|
# @return [String] the type of the files that should be processed by
|
21
28
|
# this rule.
|
22
29
|
#
|
@@ -313,8 +313,7 @@ module Xcodeproj
|
|
313
313
|
end
|
314
314
|
|
315
315
|
# In addition to removing the file reference, this will also remove any
|
316
|
-
# items related to this reference
|
317
|
-
# Xcode project.
|
316
|
+
# items related to this reference.
|
318
317
|
#
|
319
318
|
# @see AbstractObject#remove_from_project
|
320
319
|
#
|
@@ -327,6 +326,8 @@ module Xcodeproj
|
|
327
326
|
project_reference[:product_group].remove_from_project
|
328
327
|
project.root_object.project_references.delete(project_reference)
|
329
328
|
end
|
329
|
+
|
330
|
+
build_files.each(&:remove_from_project)
|
330
331
|
super
|
331
332
|
end
|
332
333
|
|
@@ -441,13 +441,32 @@ module Xcodeproj
|
|
441
441
|
result = File.basename(x.display_name.downcase, '.*') <=> File.basename(y.display_name.downcase, '.*')
|
442
442
|
if result.zero?
|
443
443
|
result = File.extname(x.display_name.downcase) <=> File.extname(y.display_name.downcase)
|
444
|
-
if result.zero?
|
444
|
+
if result.zero? && !(x.path.nil? || y.path.nil?)
|
445
445
|
result = x.path.downcase <=> y.path.downcase
|
446
446
|
end
|
447
447
|
end
|
448
448
|
result
|
449
449
|
end
|
450
450
|
end
|
451
|
+
|
452
|
+
# @return [Array<PBXBuildFile>] the build files associated with the
|
453
|
+
# current reference proxy.
|
454
|
+
#
|
455
|
+
def build_files
|
456
|
+
referrers.grep(PBXBuildFile)
|
457
|
+
end
|
458
|
+
|
459
|
+
# In addition to removing the reference proxy, this will also remove any
|
460
|
+
# items related to this reference.
|
461
|
+
#
|
462
|
+
# @see AbstractObject#remove_from_project
|
463
|
+
#
|
464
|
+
# @return [void]
|
465
|
+
#
|
466
|
+
def remove_from_project
|
467
|
+
build_files.each(&:remove_from_project)
|
468
|
+
super
|
469
|
+
end
|
451
470
|
end
|
452
471
|
|
453
472
|
#-----------------------------------------------------------------------#
|
@@ -61,6 +61,25 @@ module Xcodeproj
|
|
61
61
|
return path if path
|
62
62
|
super
|
63
63
|
end
|
64
|
+
|
65
|
+
# @return [Array<PBXBuildFile>] the build files associated with the
|
66
|
+
# current reference proxy.
|
67
|
+
#
|
68
|
+
def build_files
|
69
|
+
referrers.grep(PBXBuildFile)
|
70
|
+
end
|
71
|
+
|
72
|
+
# In addition to removing the reference proxy, this will also remove any
|
73
|
+
# items related to this reference.
|
74
|
+
#
|
75
|
+
# @see AbstractObject#remove_from_project
|
76
|
+
#
|
77
|
+
# @return [void]
|
78
|
+
#
|
79
|
+
def remove_from_project
|
80
|
+
build_files.each(&:remove_from_project)
|
81
|
+
super
|
82
|
+
end
|
64
83
|
end
|
65
84
|
end
|
66
85
|
end
|
@@ -30,9 +30,14 @@ module Xcodeproj
|
|
30
30
|
#
|
31
31
|
attribute :platform_filter, String
|
32
32
|
|
33
|
-
# @return [String] the
|
33
|
+
# @return [Array<String>] the platform filters for this target dependency.
|
34
34
|
#
|
35
|
-
attribute :
|
35
|
+
attribute :platform_filters, Array
|
36
|
+
|
37
|
+
# @return [XCSwiftPackageProductDependency] the Swift Package product
|
38
|
+
# for this target dependency.
|
39
|
+
#
|
40
|
+
has_one :product_ref, XCSwiftPackageProductDependency
|
36
41
|
|
37
42
|
public
|
38
43
|
|
@@ -45,20 +50,22 @@ module Xcodeproj
|
|
45
50
|
return name if name
|
46
51
|
return target.name if target
|
47
52
|
return target_proxy.remote_info if target_proxy
|
53
|
+
return product_ref.product_name if product_ref
|
48
54
|
end
|
49
55
|
|
50
56
|
def ascii_plist_annotation
|
51
57
|
" #{isa} "
|
52
58
|
end
|
53
59
|
|
54
|
-
# @return [String] uuid of the target
|
55
|
-
#
|
56
|
-
# target
|
57
|
-
#
|
60
|
+
# @return [String] the uuid of the target if the dependency is a native
|
61
|
+
# target, the uuid of the target in the sub-project if the
|
62
|
+
# dependency is a target proxy, nil if the dependency is a Swift
|
63
|
+
# Package.
|
58
64
|
#
|
59
65
|
def native_target_uuid
|
60
66
|
return target.uuid if target
|
61
67
|
return target_proxy.remote_global_id_string if target_proxy
|
68
|
+
return nil if product_ref
|
62
69
|
raise "Expected target or target_proxy, from which to fetch a uuid for target '#{display_name}'." \
|
63
70
|
"Find and clear the PBXTargetDependency entry with uuid '#{@uuid}' in your .xcodeproj."
|
64
71
|
end
|
@@ -151,6 +151,44 @@ module Xcodeproj
|
|
151
151
|
arguments
|
152
152
|
end
|
153
153
|
|
154
|
+
# @return [Array<BuildableReference>]
|
155
|
+
# The list of BuildableReference (code coverage targets) associated with this Test Action
|
156
|
+
#
|
157
|
+
def code_coverage_targets
|
158
|
+
return [] unless @xml_element.elements['CodeCoverageTargets']
|
159
|
+
|
160
|
+
@xml_element.elements['CodeCoverageTargets'].get_elements('BuildableReference').map do |node|
|
161
|
+
BuildableReference.new(node)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
# @param [Array<BuildableReference>] buildable_references
|
166
|
+
# Sets the list of BuildableReference (code coverage targets) associated with this Test Action
|
167
|
+
#
|
168
|
+
def code_coverage_targets=(buildable_references)
|
169
|
+
@xml_element.attributes['onlyGenerateCoverageForSpecifiedTargets'] = bool_to_string(true)
|
170
|
+
|
171
|
+
@xml_element.delete_element('CodeCoverageTargets')
|
172
|
+
coverage_targets_element = @xml_element.add_element('CodeCoverageTargets')
|
173
|
+
buildable_references.each do |reference|
|
174
|
+
coverage_targets_element.add_element(reference.xml_element)
|
175
|
+
end
|
176
|
+
|
177
|
+
code_coverage_targets
|
178
|
+
end
|
179
|
+
|
180
|
+
# @param [BuildableReference] buildable_reference
|
181
|
+
# Add a BuildableReference (code coverage target) to this Test Action
|
182
|
+
#
|
183
|
+
def add_code_coverage_target(buildable_reference)
|
184
|
+
@xml_element.attributes['onlyGenerateCoverageForSpecifiedTargets'] = bool_to_string(true)
|
185
|
+
|
186
|
+
coverage_targets_element = @xml_element.elements['CodeCoverageTargets'] || @xml_element.add_element('CodeCoverageTargets')
|
187
|
+
coverage_targets_element.add_element(buildable_reference.xml_element)
|
188
|
+
|
189
|
+
code_coverage_targets
|
190
|
+
end
|
191
|
+
|
154
192
|
#-------------------------------------------------------------------------#
|
155
193
|
|
156
194
|
class TestableReference < XMLElementWrapper
|
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.
|
4
|
+
version: 1.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eloy Duran
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: atomos
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
- !ruby/object:Gem::Version
|
202
202
|
version: '0'
|
203
203
|
requirements: []
|
204
|
-
rubygems_version: 3.
|
204
|
+
rubygems_version: 3.1.6
|
205
205
|
signing_key:
|
206
206
|
specification_version: 3
|
207
207
|
summary: Create and modify Xcode projects from Ruby.
|