xcodeproj 1.19.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 +5 -4
- data/lib/xcodeproj/command/sort.rb +12 -1
- data/lib/xcodeproj/command.rb +6 -3
- data/lib/xcodeproj/config/other_linker_flags_parser.rb +5 -0
- data/lib/xcodeproj/config.rb +12 -2
- data/lib/xcodeproj/constants.rb +14 -5
- 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_file.rb +7 -1
- data/lib/xcodeproj/project/object/build_phase.rb +21 -0
- 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 +30 -9
- data/lib/xcodeproj/project/object/helpers/file_references_factory.rb +6 -6
- data/lib/xcodeproj/project/object/helpers/groupable_helper.rb +1 -1
- data/lib/xcodeproj/project/object/native_target.rb +43 -0
- data/lib/xcodeproj/project/object/reference_proxy.rb +19 -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 +13 -6
- 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 +87 -1
- data/lib/xcodeproj/scheme/execution_action.rb +86 -0
- data/lib/xcodeproj/scheme/launch_action.rb +17 -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 +45 -3
- data/lib/xcodeproj/scheme.rb +5 -1
- metadata +21 -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
|
@@ -10,7 +10,7 @@ support for Xcode workspaces (`.xcworkspace`), configuration files (`.xcconfig`)
|
|
10
10
|
Xcode Scheme files (`.xcscheme`).
|
11
11
|
|
12
12
|
It is used in [CocoaPods](https://github.com/CocoaPods/CocoaPods) to create a
|
13
|
-
|
13
|
+
collection of supplemental libraries or frameworks, for all platforms Xcode supports.
|
14
14
|
|
15
15
|
The API reference can be found [here](http://www.rubydoc.info/gems/xcodeproj).
|
16
16
|
|
@@ -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
|
@@ -9,22 +9,33 @@ module Xcodeproj
|
|
9
9
|
|
10
10
|
self.summary = 'Sorts the given project.'
|
11
11
|
|
12
|
+
def self.options
|
13
|
+
[
|
14
|
+
['--group-option=[above|below]', 'The position of the groups when sorting. If no option is specified, sorting will interleave groups and files.'],
|
15
|
+
].concat(super)
|
16
|
+
end
|
17
|
+
|
12
18
|
self.arguments = [
|
13
19
|
CLAide::Argument.new('PROJECT', false),
|
14
20
|
]
|
15
21
|
|
16
22
|
def initialize(argv)
|
17
23
|
self.xcodeproj_path = argv.shift_argument
|
24
|
+
@group_option = argv.option('group-option')
|
25
|
+
@group_option &&= @group_option.to_sym
|
18
26
|
super
|
19
27
|
end
|
20
28
|
|
21
29
|
def validate!
|
22
30
|
super
|
31
|
+
unless [nil, :above, :below].include?(@group_option)
|
32
|
+
help! "Unknown format `#{@group_option}`"
|
33
|
+
end
|
23
34
|
open_project!
|
24
35
|
end
|
25
36
|
|
26
37
|
def run
|
27
|
-
xcodeproj.sort
|
38
|
+
xcodeproj.sort(:groups_position => @group_option)
|
28
39
|
xcodeproj.save
|
29
40
|
puts "The `#{File.basename(xcodeproj_path)}` project was sorted"
|
30
41
|
end
|
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
|
@@ -16,6 +16,7 @@ module Xcodeproj
|
|
16
16
|
:frameworks => [],
|
17
17
|
:weak_frameworks => [],
|
18
18
|
:libraries => [],
|
19
|
+
:arg_files => [],
|
19
20
|
:simple => [],
|
20
21
|
:force_load => [],
|
21
22
|
}
|
@@ -32,6 +33,8 @@ module Xcodeproj
|
|
32
33
|
key = :weak_frameworks
|
33
34
|
when '-l'
|
34
35
|
key = :libraries
|
36
|
+
when '@'
|
37
|
+
key = :arg_files
|
35
38
|
when '-force_load'
|
36
39
|
key = :force_load
|
37
40
|
else
|
@@ -58,6 +61,8 @@ module Xcodeproj
|
|
58
61
|
flags.strip.shellsplit.flat_map do |string|
|
59
62
|
if string =~ /\A-l.+/
|
60
63
|
['-l', string[2..-1]]
|
64
|
+
elsif string =~ /\A@.+/
|
65
|
+
['@', string[1..-1]]
|
61
66
|
else
|
62
67
|
string
|
63
68
|
end
|
data/lib/xcodeproj/config.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'shellwords'
|
2
3
|
require 'xcodeproj/config/other_linker_flags_parser'
|
3
4
|
|
@@ -58,7 +59,7 @@ module Xcodeproj
|
|
58
59
|
@attributes = {}
|
59
60
|
@includes = []
|
60
61
|
@other_linker_flags = {}
|
61
|
-
[:simple, :frameworks, :weak_frameworks, :libraries, :force_load].each do |key|
|
62
|
+
[:simple, :frameworks, :weak_frameworks, :libraries, :arg_files, :force_load].each do |key|
|
62
63
|
@other_linker_flags[key] = Set.new
|
63
64
|
end
|
64
65
|
merge!(extract_hash(xcconfig_hash_or_file))
|
@@ -125,9 +126,10 @@ module Xcodeproj
|
|
125
126
|
:frameworks => '-framework ',
|
126
127
|
:weak_frameworks => '-weak_framework ',
|
127
128
|
:libraries => '-l',
|
129
|
+
:arg_files => '@',
|
128
130
|
:force_load => '-force_load',
|
129
131
|
}
|
130
|
-
[:libraries, :frameworks, :weak_frameworks, :force_load].each do |key|
|
132
|
+
[:libraries, :frameworks, :weak_frameworks, :arg_files, :force_load].each do |key|
|
131
133
|
modifier = modifiers[key]
|
132
134
|
sorted = other_linker_flags[key].to_a.sort
|
133
135
|
if key == :force_load
|
@@ -180,6 +182,13 @@ module Xcodeproj
|
|
180
182
|
other_linker_flags[:libraries]
|
181
183
|
end
|
182
184
|
|
185
|
+
# @return [Set<String>] The list of the arg files required by this
|
186
|
+
# settings file.
|
187
|
+
#
|
188
|
+
def arg_files
|
189
|
+
other_linker_flags[:arg_files]
|
190
|
+
end
|
191
|
+
|
183
192
|
public
|
184
193
|
|
185
194
|
# @!group Merging
|
@@ -254,6 +263,7 @@ module Xcodeproj
|
|
254
263
|
# @return [Hash]
|
255
264
|
#
|
256
265
|
def extract_hash(argument)
|
266
|
+
return argument if argument.is_a?(Hash)
|
257
267
|
if argument.respond_to? :read
|
258
268
|
@filepath = Pathname.new(argument.to_path)
|
259
269
|
hash_from_file_content(argument.read)
|
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
|
-
# @return [String] The last known
|
37
|
+
# @return [String] The last known Xcode version to Xcodeproj.
|
38
38
|
#
|
39
|
-
LAST_UPGRADE_CHECK = '
|
39
|
+
LAST_UPGRADE_CHECK = '1300'
|
40
40
|
|
41
|
-
# @return [String] The last known
|
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,8 @@ 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',
|
132
|
+
55 => 'Xcode 13.0',
|
131
133
|
54 => 'Xcode 12.0',
|
132
134
|
53 => 'Xcode 11.4',
|
133
135
|
52 => 'Xcode 11.0',
|
@@ -453,5 +455,12 @@ module Xcodeproj
|
|
453
455
|
$(inherited)
|
454
456
|
${inherited}
|
455
457
|
).freeze
|
458
|
+
|
459
|
+
# @return [Hash] Possible types for a scheme's 'ExecutionAction' node
|
460
|
+
#
|
461
|
+
EXECUTION_ACTION_TYPE = {
|
462
|
+
:shell_script => 'Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction',
|
463
|
+
:send_email => 'Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.SendEmailAction',
|
464
|
+
}.freeze
|
456
465
|
end
|
457
466
|
end
|
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
|
@@ -39,6 +39,10 @@ module Xcodeproj
|
|
39
39
|
#
|
40
40
|
attribute :platform_filter, String
|
41
41
|
|
42
|
+
# @return [Array<String>] the platform filters for this build file.
|
43
|
+
#
|
44
|
+
attribute :platform_filters, Array
|
45
|
+
|
42
46
|
#---------------------------------------------------------------------#
|
43
47
|
|
44
48
|
public
|
@@ -49,7 +53,9 @@ module Xcodeproj
|
|
49
53
|
# user.
|
50
54
|
#
|
51
55
|
def display_name
|
52
|
-
if
|
56
|
+
if product_ref
|
57
|
+
product_ref.display_name
|
58
|
+
elsif file_ref
|
53
59
|
file_ref.display_name
|
54
60
|
else
|
55
61
|
super
|
@@ -145,6 +145,27 @@ module Xcodeproj
|
|
145
145
|
def ascii_plist_annotation
|
146
146
|
" #{display_name} "
|
147
147
|
end
|
148
|
+
|
149
|
+
# Sorts the build files of the phase according to the display
|
150
|
+
# name or the path.
|
151
|
+
#
|
152
|
+
# @param [Hash] _options
|
153
|
+
# Not used.
|
154
|
+
#
|
155
|
+
# @return [void]
|
156
|
+
#
|
157
|
+
def sort(_options = nil)
|
158
|
+
files.sort! do |x, y|
|
159
|
+
result = File.basename(x.display_name.downcase, '.*') <=> File.basename(y.display_name.downcase, '.*')
|
160
|
+
if result.zero?
|
161
|
+
result = File.extname(x.display_name.downcase) <=> File.extname(y.display_name.downcase)
|
162
|
+
if result.zero? && x.file_ref.respond_to?(:full_path) && y.file_ref.respond_to?(:full_path)
|
163
|
+
result = x.file_ref.full_path.to_s.downcase <=> y.file_ref.full_path.to_s.downcase
|
164
|
+
end
|
165
|
+
end
|
166
|
+
result
|
167
|
+
end
|
168
|
+
end
|
148
169
|
end
|
149
170
|
|
150
171
|
#-----------------------------------------------------------------------#
|
@@ -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
|
|
@@ -226,24 +226,24 @@ module Xcodeproj
|
|
226
226
|
# Creates a file reference to a static library and adds it to the
|
227
227
|
# group.
|
228
228
|
#
|
229
|
-
# @param [#to_s]
|
229
|
+
# @param [#to_s] product_basename
|
230
230
|
# The name of the static library.
|
231
231
|
#
|
232
232
|
# @return [PBXFileReference] The new file reference.
|
233
233
|
#
|
234
|
-
def new_product_ref_for_target(
|
235
|
-
FileReferencesFactory.new_product_ref_for_target(self,
|
234
|
+
def new_product_ref_for_target(product_basename, product_type)
|
235
|
+
FileReferencesFactory.new_product_ref_for_target(self, product_basename, product_type)
|
236
236
|
end
|
237
237
|
|
238
238
|
# Creates a file reference to a new bundle.
|
239
239
|
#
|
240
|
-
# @param [#to_s]
|
240
|
+
# @param [#to_s] product_basename
|
241
241
|
# The name of the bundle.
|
242
242
|
#
|
243
243
|
# @return [PBXFileReference] The new file reference.
|
244
244
|
#
|
245
|
-
def new_bundle(
|
246
|
-
FileReferencesFactory.new_bundle(self,
|
245
|
+
def new_bundle(product_basename)
|
246
|
+
FileReferencesFactory.new_bundle(self, product_basename)
|
247
247
|
end
|
248
248
|
|
249
249
|
# Creates a file reference to a new bundle and adds it to the group.
|
@@ -440,12 +440,33 @@ module Xcodeproj
|
|
440
440
|
|
441
441
|
result = File.basename(x.display_name.downcase, '.*') <=> File.basename(y.display_name.downcase, '.*')
|
442
442
|
if result.zero?
|
443
|
-
File.extname(x.display_name.downcase) <=> File.extname(y.display_name.downcase)
|
444
|
-
|
445
|
-
|
443
|
+
result = File.extname(x.display_name.downcase) <=> File.extname(y.display_name.downcase)
|
444
|
+
if result.zero? && !(x.path.nil? || y.path.nil?)
|
445
|
+
result = x.path.downcase <=> y.path.downcase
|
446
|
+
end
|
446
447
|
end
|
448
|
+
result
|
447
449
|
end
|
448
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
|
449
470
|
end
|
450
471
|
|
451
472
|
#-----------------------------------------------------------------------#
|
@@ -42,17 +42,17 @@ module Xcodeproj
|
|
42
42
|
# @param [PBXGroup] group
|
43
43
|
# The group to which to add the reference.
|
44
44
|
#
|
45
|
-
# @param [#to_s]
|
45
|
+
# @param [#to_s] product_basename
|
46
46
|
# The name of the static library.
|
47
47
|
#
|
48
48
|
# @return [PBXFileReference] The new file reference.
|
49
49
|
#
|
50
|
-
def new_product_ref_for_target(group,
|
50
|
+
def new_product_ref_for_target(group, product_basename, product_type)
|
51
51
|
if product_type == :static_library
|
52
52
|
prefix = 'lib'
|
53
53
|
end
|
54
54
|
extension = Constants::PRODUCT_UTI_EXTENSIONS[product_type]
|
55
|
-
path = "#{prefix}#{
|
55
|
+
path = "#{prefix}#{product_basename}"
|
56
56
|
path += ".#{extension}" if extension
|
57
57
|
ref = new_reference(group, path, :built_products)
|
58
58
|
ref.include_in_index = '0'
|
@@ -66,13 +66,13 @@ module Xcodeproj
|
|
66
66
|
# @param [PBXGroup] group
|
67
67
|
# The group to which to add the reference.
|
68
68
|
#
|
69
|
-
# @param [#to_s]
|
69
|
+
# @param [#to_s] product_basename
|
70
70
|
# The name of the bundle.
|
71
71
|
#
|
72
72
|
# @return [PBXFileReference] The new file reference.
|
73
73
|
#
|
74
|
-
def new_bundle(group,
|
75
|
-
ref = new_reference(group, "#{
|
74
|
+
def new_bundle(group, product_basename)
|
75
|
+
ref = new_reference(group, "#{product_basename}.bundle", :built_products)
|
76
76
|
ref.include_in_index = '0'
|
77
77
|
ref.set_explicit_file_type('wrapper.cfbundle')
|
78
78
|
ref
|
@@ -205,7 +205,7 @@ module Xcodeproj
|
|
205
205
|
# @return [void]
|
206
206
|
#
|
207
207
|
def set_path_with_source_tree(object, path, source_tree)
|
208
|
-
path = Pathname
|
208
|
+
path = Pathname(path)
|
209
209
|
source_tree = normalize_source_tree(source_tree)
|
210
210
|
object.source_tree = source_tree
|
211
211
|
|
@@ -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.
|
@@ -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
|
@@ -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
|
@@ -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
|