cocoapods 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +329 -0
- data/lib/cocoapods/command/init.rb +6 -6
- data/lib/cocoapods/command/ipc/list.rb +40 -0
- data/lib/cocoapods/command/ipc/podfile.rb +31 -0
- data/lib/cocoapods/command/ipc/repl.rb +51 -0
- data/lib/cocoapods/command/ipc/spec.rb +29 -0
- data/lib/cocoapods/command/ipc/update_search_index.rb +24 -0
- data/lib/cocoapods/command/ipc.rb +18 -0
- data/lib/cocoapods/command/lib/create.rb +105 -0
- data/lib/cocoapods/command/lib/lint.rb +111 -0
- data/lib/cocoapods/command/lib.rb +3 -207
- data/lib/cocoapods/command/repo/push.rb +44 -20
- data/lib/cocoapods/command/setup.rb +2 -1
- data/lib/cocoapods/command/spec/lint.rb +4 -0
- data/lib/cocoapods/command.rb +2 -1
- data/lib/cocoapods/config.rb +4 -1
- data/lib/cocoapods/downloader/cache.rb +1 -0
- data/lib/cocoapods/downloader.rb +20 -0
- data/lib/cocoapods/executable.rb +1 -1
- data/lib/cocoapods/gem_version.rb +1 -1
- data/lib/cocoapods/generator/acknowledgements/plist.rb +4 -1
- data/lib/cocoapods/generator/copy_resources_script.rb +4 -10
- data/lib/cocoapods/generator/header.rb +2 -1
- data/lib/cocoapods/generator/prefix_header.rb +0 -12
- data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +38 -5
- data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +5 -4
- data/lib/cocoapods/installer/analyzer/pod_variant_set.rb +5 -1
- data/lib/cocoapods/installer/analyzer/target_inspector.rb +24 -1
- data/lib/cocoapods/installer/analyzer.rb +161 -1
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +29 -9
- data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +204 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +314 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +401 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +214 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator.rb +265 -0
- data/lib/cocoapods/installer/xcode.rb +7 -0
- data/lib/cocoapods/installer.rb +50 -214
- data/lib/cocoapods/resolver.rb +15 -9
- data/lib/cocoapods/sandbox/headers_store.rb +4 -10
- data/lib/cocoapods/sandbox/path_list.rb +20 -9
- data/lib/cocoapods/sources_manager.rb +7 -10
- data/lib/cocoapods/target/aggregate_target.rb +20 -0
- data/lib/cocoapods/target/pod_target.rb +37 -7
- data/lib/cocoapods/user_interface/error_report.rb +7 -0
- data/lib/cocoapods/user_interface/inspector_reporter.rb +109 -0
- data/lib/cocoapods/user_interface.rb +7 -5
- data/lib/cocoapods/validator.rb +59 -11
- metadata +112 -83
- data/lib/cocoapods/command/inter_process_communication.rb +0 -177
- data/lib/cocoapods/installer/file_references_installer.rb +0 -310
- data/lib/cocoapods/installer/migrator.rb +0 -86
- data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +0 -191
- data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +0 -368
- data/lib/cocoapods/installer/target_installer.rb +0 -210
@@ -1,368 +0,0 @@
|
|
1
|
-
module Pod
|
2
|
-
class Installer
|
3
|
-
# Creates the target for the Pods libraries in the Pods project and the
|
4
|
-
# relative support files.
|
5
|
-
#
|
6
|
-
class PodTargetInstaller < TargetInstaller
|
7
|
-
# Creates the target in the Pods project and the relative support files.
|
8
|
-
#
|
9
|
-
# @return [void]
|
10
|
-
#
|
11
|
-
def install!
|
12
|
-
unless target.should_build?
|
13
|
-
add_resources_bundle_targets
|
14
|
-
return
|
15
|
-
end
|
16
|
-
|
17
|
-
UI.message "- Installing target `#{target.name}` #{target.platform}" do
|
18
|
-
add_target
|
19
|
-
create_support_files_dir
|
20
|
-
add_resources_bundle_targets
|
21
|
-
add_files_to_build_phases
|
22
|
-
create_xcconfig_file
|
23
|
-
if target.requires_frameworks?
|
24
|
-
create_info_plist_file
|
25
|
-
create_module_map
|
26
|
-
create_umbrella_header do |generator|
|
27
|
-
generator.imports += if header_mappings_dir
|
28
|
-
target.file_accessors.flat_map(&:public_headers).map do |pathname|
|
29
|
-
pathname.relative_path_from(header_mappings_dir)
|
30
|
-
end
|
31
|
-
else
|
32
|
-
target.file_accessors.flat_map(&:public_headers).map(&:basename)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
create_prefix_header
|
37
|
-
create_dummy_source
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
# Remove the default headers folder path settings for static library pod
|
44
|
-
# targets.
|
45
|
-
#
|
46
|
-
# @return [Hash{String => String}]
|
47
|
-
#
|
48
|
-
def custom_build_settings
|
49
|
-
settings = super
|
50
|
-
unless target.requires_frameworks?
|
51
|
-
settings['PRIVATE_HEADERS_FOLDER_PATH'] = ''
|
52
|
-
settings['PUBLIC_HEADERS_FOLDER_PATH'] = ''
|
53
|
-
end
|
54
|
-
settings
|
55
|
-
end
|
56
|
-
|
57
|
-
#-----------------------------------------------------------------------#
|
58
|
-
|
59
|
-
SOURCE_FILE_EXTENSIONS = Sandbox::FileAccessor::SOURCE_FILE_EXTENSIONS
|
60
|
-
|
61
|
-
# Adds the build files of the pods to the target and adds a reference to
|
62
|
-
# the frameworks of the Pods.
|
63
|
-
#
|
64
|
-
# @note The Frameworks are used only for presentation purposes as the
|
65
|
-
# xcconfig is the authoritative source about their information.
|
66
|
-
#
|
67
|
-
# @note Core Data model directories (.xcdatamodeld) defined in the `resources`
|
68
|
-
# property are currently added to the `Copy Resources` build phase like
|
69
|
-
# all other resources. The Xcode UI adds these to the `Compile Sources`
|
70
|
-
# build phase, but they will compile correctly either way.
|
71
|
-
#
|
72
|
-
# @return [void]
|
73
|
-
#
|
74
|
-
def add_files_to_build_phases
|
75
|
-
target.file_accessors.each do |file_accessor|
|
76
|
-
consumer = file_accessor.spec_consumer
|
77
|
-
|
78
|
-
headers = file_accessor.headers
|
79
|
-
public_headers = file_accessor.public_headers
|
80
|
-
private_headers = file_accessor.private_headers
|
81
|
-
other_source_files = file_accessor.source_files.reject { |sf| SOURCE_FILE_EXTENSIONS.include?(sf.extname) }
|
82
|
-
|
83
|
-
{
|
84
|
-
true => file_accessor.arc_source_files,
|
85
|
-
false => file_accessor.non_arc_source_files,
|
86
|
-
}.each do |arc, files|
|
87
|
-
files = files - headers - other_source_files
|
88
|
-
flags = compiler_flags_for_consumer(consumer, arc)
|
89
|
-
regular_file_refs = files.map { |sf| project.reference_for_path(sf) }
|
90
|
-
native_target.add_file_references(regular_file_refs, flags)
|
91
|
-
end
|
92
|
-
|
93
|
-
header_file_refs = headers.map { |sf| project.reference_for_path(sf) }
|
94
|
-
native_target.add_file_references(header_file_refs) do |build_file|
|
95
|
-
add_header(build_file, public_headers, private_headers)
|
96
|
-
end
|
97
|
-
|
98
|
-
other_file_refs = other_source_files.map { |sf| project.reference_for_path(sf) }
|
99
|
-
native_target.add_file_references(other_file_refs, nil)
|
100
|
-
|
101
|
-
next unless target.requires_frameworks?
|
102
|
-
|
103
|
-
resource_refs = file_accessor.resources.flatten.map do |res|
|
104
|
-
project.reference_for_path(res)
|
105
|
-
end
|
106
|
-
|
107
|
-
# Some nested files are not directly present in the Xcode project, such as the contents
|
108
|
-
# of an .xcdatamodeld directory. These files will return nil file references.
|
109
|
-
resource_refs.compact!
|
110
|
-
|
111
|
-
native_target.add_resources(resource_refs)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
# Adds the resources of the Pods to the Pods project.
|
116
|
-
#
|
117
|
-
# @note The source files are grouped by Pod and in turn by subspec
|
118
|
-
# (recursively) in the resources group.
|
119
|
-
#
|
120
|
-
# @note Core Data model directories (.xcdatamodeld) are currently added to the
|
121
|
-
# `Copy Resources` build phase like all other resources. The Xcode UI adds
|
122
|
-
# these to the `Compile Sources` build phase, but they will compile
|
123
|
-
# correctly either way.
|
124
|
-
#
|
125
|
-
# @return [void]
|
126
|
-
#
|
127
|
-
def add_resources_bundle_targets
|
128
|
-
target.file_accessors.each do |file_accessor|
|
129
|
-
file_accessor.resource_bundles.each do |bundle_name, paths|
|
130
|
-
file_references = paths.map do |path|
|
131
|
-
ref = project.reference_for_path(path)
|
132
|
-
|
133
|
-
# Some nested files are not directly present in the Xcode project, such as the contents
|
134
|
-
# of an .xcdatamodeld directory. These files are implicitly included by including their
|
135
|
-
# parent directory.
|
136
|
-
next if ref.nil?
|
137
|
-
|
138
|
-
# For variant groups, the variant group itself is added, not its members.
|
139
|
-
next ref.parent if ref.parent.is_a?(Xcodeproj::Project::Object::PBXVariantGroup)
|
140
|
-
|
141
|
-
ref
|
142
|
-
end
|
143
|
-
file_references = file_references.uniq.compact
|
144
|
-
|
145
|
-
label = target.resources_bundle_target_label(bundle_name)
|
146
|
-
bundle_target = project.new_resources_bundle(label, file_accessor.spec_consumer.platform_name)
|
147
|
-
bundle_target.product_reference.tap do |bundle_product|
|
148
|
-
bundle_file_name = "#{bundle_name}.bundle"
|
149
|
-
bundle_product.name = bundle_file_name
|
150
|
-
bundle_product.path = bundle_file_name
|
151
|
-
end
|
152
|
-
bundle_target.add_resources(file_references)
|
153
|
-
|
154
|
-
target.user_build_configurations.each do |bc_name, type|
|
155
|
-
bundle_target.add_build_configuration(bc_name, type)
|
156
|
-
end
|
157
|
-
bundle_target.deployment_target = deployment_target
|
158
|
-
|
159
|
-
target.resource_bundle_targets << bundle_target
|
160
|
-
|
161
|
-
if target.should_build?
|
162
|
-
native_target.add_dependency(bundle_target)
|
163
|
-
if target.requires_frameworks?
|
164
|
-
native_target.add_resources([bundle_target.product_reference])
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
# Create Info.plist file for bundle
|
169
|
-
path = target.info_plist_path
|
170
|
-
path.dirname.mkdir unless path.dirname.exist?
|
171
|
-
info_plist_path = path.dirname + "ResourceBundle-#{bundle_name}-#{path.basename}"
|
172
|
-
generator = Generator::InfoPlistFile.new(target, :bundle_package_type => :bndl)
|
173
|
-
generator.save_as(info_plist_path)
|
174
|
-
add_file_to_support_group(info_plist_path)
|
175
|
-
|
176
|
-
bundle_target.build_configurations.each do |c|
|
177
|
-
c.build_settings['PRODUCT_NAME'] = bundle_name
|
178
|
-
relative_info_plist_path = info_plist_path.relative_path_from(sandbox.root)
|
179
|
-
c.build_settings['INFOPLIST_FILE'] = relative_info_plist_path.to_s
|
180
|
-
c.build_settings['CONFIGURATION_BUILD_DIR'] = target.configuration_build_dir('$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)')
|
181
|
-
|
182
|
-
# Set the correct device family for this bundle, based on the platform
|
183
|
-
device_family_by_platform = {
|
184
|
-
:ios => '1,2',
|
185
|
-
:tvos => '3',
|
186
|
-
:watchos => '1,2' # The device family for watchOS is 4, but Xcode creates watchkit-compatible bundles as 1,2
|
187
|
-
}
|
188
|
-
|
189
|
-
if family = device_family_by_platform[target.platform.name]
|
190
|
-
c.build_settings['TARGETED_DEVICE_FAMILY'] = family
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
# Generates the contents of the xcconfig file and saves it to disk.
|
198
|
-
#
|
199
|
-
# @return [void]
|
200
|
-
#
|
201
|
-
def create_xcconfig_file
|
202
|
-
path = target.xcconfig_path
|
203
|
-
xcconfig_gen = Generator::XCConfig::PodXCConfig.new(target)
|
204
|
-
xcconfig_gen.save_as(path)
|
205
|
-
xcconfig_file_ref = add_file_to_support_group(path)
|
206
|
-
|
207
|
-
native_target.build_configurations.each do |c|
|
208
|
-
c.base_configuration_reference = xcconfig_file_ref
|
209
|
-
end
|
210
|
-
|
211
|
-
# also apply the private config to resource targets
|
212
|
-
target.resource_bundle_targets.each do |rsrc_target|
|
213
|
-
rsrc_target.build_configurations.each do |rsrc_bc|
|
214
|
-
rsrc_bc.base_configuration_reference = xcconfig_file_ref
|
215
|
-
end
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
# Creates a prefix header file which imports `UIKit` or `Cocoa` according
|
220
|
-
# to the platform of the target. This file also include any prefix header
|
221
|
-
# content reported by the specification of the pods.
|
222
|
-
#
|
223
|
-
# @return [void]
|
224
|
-
#
|
225
|
-
def create_prefix_header
|
226
|
-
path = target.prefix_header_path
|
227
|
-
generator = Generator::PrefixHeader.new(target.file_accessors, target.platform)
|
228
|
-
generator.save_as(path)
|
229
|
-
add_file_to_support_group(path)
|
230
|
-
|
231
|
-
native_target.build_configurations.each do |c|
|
232
|
-
relative_path = path.relative_path_from(project.path.dirname)
|
233
|
-
c.build_settings['GCC_PREFIX_HEADER'] = relative_path.to_s
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
ENABLE_OBJECT_USE_OBJC_FROM = {
|
238
|
-
:ios => Version.new('6'),
|
239
|
-
:osx => Version.new('10.8'),
|
240
|
-
:watchos => Version.new('2.0'),
|
241
|
-
:tvos => Version.new('9.0'),
|
242
|
-
}
|
243
|
-
|
244
|
-
# Returns the compiler flags for the source files of the given specification.
|
245
|
-
#
|
246
|
-
# The following behavior is regarding the `OS_OBJECT_USE_OBJC` flag. When
|
247
|
-
# set to `0`, it will allow code to use `dispatch_release()` on >= iOS 6.0
|
248
|
-
# and OS X 10.8.
|
249
|
-
#
|
250
|
-
# * New libraries that do *not* require ARC don’t need to care about this
|
251
|
-
# issue at all.
|
252
|
-
#
|
253
|
-
# * New libraries that *do* require ARC _and_ have a deployment target of
|
254
|
-
# >= iOS 6.0 or OS X 10.8:
|
255
|
-
#
|
256
|
-
# These no longer use `dispatch_release()` and should *not* have the
|
257
|
-
# `OS_OBJECT_USE_OBJC` flag set to `0`.
|
258
|
-
#
|
259
|
-
# **Note:** this means that these libraries *have* to specify the
|
260
|
-
# deployment target in order to function well.
|
261
|
-
#
|
262
|
-
# * New libraries that *do* require ARC, but have a deployment target of
|
263
|
-
# < iOS 6.0 or OS X 10.8:
|
264
|
-
#
|
265
|
-
# These contain `dispatch_release()` calls and as such need the
|
266
|
-
# `OS_OBJECT_USE_OBJC` flag set to `1`.
|
267
|
-
#
|
268
|
-
# **Note:** libraries that do *not* specify a platform version are
|
269
|
-
# assumed to have a deployment target of < iOS 6.0 or OS X 10.8.
|
270
|
-
#
|
271
|
-
# For more information, see: http://opensource.apple.com/source/libdispatch/libdispatch-228.18/os/object.h
|
272
|
-
#
|
273
|
-
# @param [Specification::Consumer] consumer
|
274
|
-
# The consumer for the specification for which the compiler flags
|
275
|
-
# are needed.
|
276
|
-
#
|
277
|
-
# @return [String] The compiler flags.
|
278
|
-
#
|
279
|
-
def compiler_flags_for_consumer(consumer, arc)
|
280
|
-
flags = consumer.compiler_flags.dup
|
281
|
-
if !arc
|
282
|
-
flags << '-fno-objc-arc'
|
283
|
-
else
|
284
|
-
platform_name = consumer.platform_name
|
285
|
-
spec_deployment_target = consumer.spec.deployment_target(platform_name)
|
286
|
-
if spec_deployment_target.nil? || Version.new(spec_deployment_target) < ENABLE_OBJECT_USE_OBJC_FROM[platform_name]
|
287
|
-
flags << '-DOS_OBJECT_USE_OBJC=0'
|
288
|
-
end
|
289
|
-
end
|
290
|
-
if target.inhibit_warnings?
|
291
|
-
flags << '-w -Xanalyzer -analyzer-disable-all-checks'
|
292
|
-
end
|
293
|
-
flags * ' '
|
294
|
-
end
|
295
|
-
|
296
|
-
# Adds a reference to the given file in the support group of this target.
|
297
|
-
#
|
298
|
-
# @param [Pathname] path
|
299
|
-
# The path of the file to which the reference should be added.
|
300
|
-
#
|
301
|
-
# @return [PBXFileReference] the file reference of the added file.
|
302
|
-
#
|
303
|
-
def add_file_to_support_group(path)
|
304
|
-
pod_name = target.pod_name
|
305
|
-
dir = target.support_files_dir
|
306
|
-
group = project.pod_support_files_group(pod_name, dir)
|
307
|
-
group.new_file(path)
|
308
|
-
end
|
309
|
-
|
310
|
-
def create_module_map
|
311
|
-
return super unless custom_module_map
|
312
|
-
path = target.module_map_path
|
313
|
-
UI.message "- Copying module map file to #{UI.path(path)}" do
|
314
|
-
FileUtils.cp(custom_module_map, path)
|
315
|
-
add_file_to_support_group(path)
|
316
|
-
|
317
|
-
native_target.build_configurations.each do |c|
|
318
|
-
relative_path = path.relative_path_from(sandbox.root)
|
319
|
-
c.build_settings['MODULEMAP_FILE'] = relative_path.to_s
|
320
|
-
end
|
321
|
-
end
|
322
|
-
end
|
323
|
-
|
324
|
-
def create_umbrella_header
|
325
|
-
return super unless custom_module_map
|
326
|
-
end
|
327
|
-
|
328
|
-
def custom_module_map
|
329
|
-
@custom_module_map ||= target.file_accessors.first.module_map
|
330
|
-
end
|
331
|
-
|
332
|
-
def header_mappings_dir
|
333
|
-
return @header_mappings_dir if defined?(@header_mappings_dir)
|
334
|
-
file_accessor = target.file_accessors.first
|
335
|
-
@header_mappings_dir = if dir = file_accessor.spec_consumer.header_mappings_dir
|
336
|
-
file_accessor.path_list.root + dir
|
337
|
-
end
|
338
|
-
end
|
339
|
-
|
340
|
-
def add_header(build_file, public_headers, private_headers)
|
341
|
-
file_ref = build_file.file_ref
|
342
|
-
acl = if public_headers.include?(file_ref.real_path)
|
343
|
-
'Public'
|
344
|
-
elsif private_headers.include?(file_ref.real_path)
|
345
|
-
'Private'
|
346
|
-
else
|
347
|
-
'Project'
|
348
|
-
end
|
349
|
-
|
350
|
-
if target.requires_frameworks? && header_mappings_dir && acl != 'Project'
|
351
|
-
relative_path = file_ref.real_path.relative_path_from(header_mappings_dir)
|
352
|
-
sub_dir = relative_path.dirname
|
353
|
-
copy_phase_name = "Copy #{sub_dir} #{acl} Headers"
|
354
|
-
copy_phase = native_target.copy_files_build_phases.find { |bp| bp.name == copy_phase_name } ||
|
355
|
-
native_target.new_copy_files_build_phase(copy_phase_name)
|
356
|
-
copy_phase.symbol_dst_subfolder_spec = :products_directory
|
357
|
-
copy_phase.dst_path = "$(#{acl.upcase}_HEADERS_FOLDER_PATH)/#{sub_dir}"
|
358
|
-
copy_phase.add_file_reference(file_ref, true)
|
359
|
-
else
|
360
|
-
build_file.settings ||= {}
|
361
|
-
build_file.settings['ATTRIBUTES'] = [acl]
|
362
|
-
end
|
363
|
-
end
|
364
|
-
|
365
|
-
#-----------------------------------------------------------------------#
|
366
|
-
end
|
367
|
-
end
|
368
|
-
end
|
@@ -1,210 +0,0 @@
|
|
1
|
-
module Pod
|
2
|
-
class Installer
|
3
|
-
# Controller class responsible of creating and configuring the static
|
4
|
-
# library target in Pods project. It also creates the support file needed
|
5
|
-
# by the target.
|
6
|
-
#
|
7
|
-
class TargetInstaller
|
8
|
-
# @return [Sandbox] sandbox the sandbox where the support files should
|
9
|
-
# be generated.
|
10
|
-
#
|
11
|
-
attr_reader :sandbox
|
12
|
-
|
13
|
-
# @return [Target] The library whose target needs to be generated.
|
14
|
-
#
|
15
|
-
attr_reader :target
|
16
|
-
|
17
|
-
# @param [Project] project @see project
|
18
|
-
# @param [Target] target @see target
|
19
|
-
#
|
20
|
-
def initialize(sandbox, target)
|
21
|
-
@sandbox = sandbox
|
22
|
-
@target = target
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
#-----------------------------------------------------------------------#
|
28
|
-
|
29
|
-
# @!group Installation steps
|
30
|
-
|
31
|
-
# Adds the target for the library to the Pods project with the
|
32
|
-
# appropriate build configurations.
|
33
|
-
#
|
34
|
-
# @note The `PODS_HEADERS_SEARCH_PATHS` overrides the xcconfig.
|
35
|
-
#
|
36
|
-
# @return [void]
|
37
|
-
#
|
38
|
-
def add_target
|
39
|
-
product_type = target.product_type
|
40
|
-
name = target.label
|
41
|
-
platform = target.platform.name
|
42
|
-
language = target.uses_swift? ? :swift : :objc
|
43
|
-
@native_target = project.new_target(product_type, name, platform, deployment_target, nil, language)
|
44
|
-
|
45
|
-
product_name = target.product_name
|
46
|
-
product = @native_target.product_reference
|
47
|
-
product.name = product_name
|
48
|
-
|
49
|
-
target.user_build_configurations.each do |bc_name, type|
|
50
|
-
@native_target.add_build_configuration(bc_name, type)
|
51
|
-
end
|
52
|
-
|
53
|
-
@native_target.build_configurations.each do |configuration|
|
54
|
-
configuration.build_settings.merge!(custom_build_settings)
|
55
|
-
end
|
56
|
-
|
57
|
-
target.native_target = @native_target
|
58
|
-
end
|
59
|
-
|
60
|
-
# @return [String] The deployment target.
|
61
|
-
#
|
62
|
-
def deployment_target
|
63
|
-
target.platform.deployment_target.to_s
|
64
|
-
end
|
65
|
-
|
66
|
-
# Returns the customized build settings which are overridden in the build
|
67
|
-
# settings of the user target.
|
68
|
-
#
|
69
|
-
# @return [Hash{String => String}]
|
70
|
-
#
|
71
|
-
def custom_build_settings
|
72
|
-
settings = {}
|
73
|
-
|
74
|
-
unless target.archs.empty?
|
75
|
-
settings['ARCHS'] = target.archs
|
76
|
-
end
|
77
|
-
|
78
|
-
if target.requires_frameworks?
|
79
|
-
settings['PRODUCT_NAME'] = target.product_module_name
|
80
|
-
else
|
81
|
-
settings.merge!('OTHER_LDFLAGS' => '', 'OTHER_LIBTOOLFLAGS' => '')
|
82
|
-
end
|
83
|
-
|
84
|
-
settings
|
85
|
-
end
|
86
|
-
|
87
|
-
# Creates the directory where to store the support files of the target.
|
88
|
-
#
|
89
|
-
def create_support_files_dir
|
90
|
-
target.support_files_dir.mkdir
|
91
|
-
end
|
92
|
-
|
93
|
-
# Creates the Info.plist file which sets public framework attributes
|
94
|
-
#
|
95
|
-
# @return [void]
|
96
|
-
#
|
97
|
-
def create_info_plist_file
|
98
|
-
path = target.info_plist_path
|
99
|
-
UI.message "- Generating Info.plist file at #{UI.path(path)}" do
|
100
|
-
generator = Generator::InfoPlistFile.new(target)
|
101
|
-
generator.save_as(path)
|
102
|
-
add_file_to_support_group(path)
|
103
|
-
|
104
|
-
native_target.build_configurations.each do |c|
|
105
|
-
relative_path = path.relative_path_from(sandbox.root)
|
106
|
-
c.build_settings['INFOPLIST_FILE'] = relative_path.to_s
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
# Creates the module map file which ensures that the umbrella header is
|
112
|
-
# recognized with a customized path
|
113
|
-
#
|
114
|
-
# @yield_param [Generator::ModuleMap]
|
115
|
-
# yielded once to configure the private headers
|
116
|
-
#
|
117
|
-
# @return [void]
|
118
|
-
#
|
119
|
-
def create_module_map
|
120
|
-
path = target.module_map_path
|
121
|
-
UI.message "- Generating module map file at #{UI.path(path)}" do
|
122
|
-
generator = Generator::ModuleMap.new(target)
|
123
|
-
yield generator if block_given?
|
124
|
-
generator.save_as(path)
|
125
|
-
add_file_to_support_group(path)
|
126
|
-
|
127
|
-
native_target.build_configurations.each do |c|
|
128
|
-
relative_path = path.relative_path_from(sandbox.root)
|
129
|
-
c.build_settings['MODULEMAP_FILE'] = relative_path.to_s
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
# Generates a header which ensures that all header files are exported
|
135
|
-
# in the module map
|
136
|
-
#
|
137
|
-
# @yield_param [Generator::UmbrellaHeader]
|
138
|
-
# yielded once to configure the imports
|
139
|
-
#
|
140
|
-
def create_umbrella_header
|
141
|
-
path = target.umbrella_header_path
|
142
|
-
UI.message "- Generating umbrella header at #{UI.path(path)}" do
|
143
|
-
generator = Generator::UmbrellaHeader.new(target)
|
144
|
-
yield generator if block_given?
|
145
|
-
generator.save_as(path)
|
146
|
-
|
147
|
-
# Add the file to the support group and the native target,
|
148
|
-
# so it will been added to the header build phase
|
149
|
-
file_ref = add_file_to_support_group(path)
|
150
|
-
native_target.add_file_references([file_ref])
|
151
|
-
|
152
|
-
# Make the umbrella header public
|
153
|
-
build_file = native_target.headers_build_phase.build_file(file_ref)
|
154
|
-
build_file.settings ||= {}
|
155
|
-
build_file.settings['ATTRIBUTES'] = ['Public']
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
# Generates a dummy source file for each target so libraries that contain
|
160
|
-
# only categories build.
|
161
|
-
#
|
162
|
-
# @return [void]
|
163
|
-
#
|
164
|
-
def create_dummy_source
|
165
|
-
path = target.dummy_source_path
|
166
|
-
generator = Generator::DummySource.new(target.label)
|
167
|
-
generator.save_as(path)
|
168
|
-
file_reference = add_file_to_support_group(path)
|
169
|
-
native_target.source_build_phase.add_file_reference(file_reference)
|
170
|
-
end
|
171
|
-
|
172
|
-
# @return [PBXNativeTarget] the target generated by the installation
|
173
|
-
# process.
|
174
|
-
#
|
175
|
-
# @note Generated by the {#add_target} step.
|
176
|
-
#
|
177
|
-
attr_reader :native_target
|
178
|
-
|
179
|
-
private
|
180
|
-
|
181
|
-
#-----------------------------------------------------------------------#
|
182
|
-
|
183
|
-
# @!group Private helpers.
|
184
|
-
|
185
|
-
# @return [Project] the Pods project of the sandbox.
|
186
|
-
#
|
187
|
-
def project
|
188
|
-
sandbox.project
|
189
|
-
end
|
190
|
-
|
191
|
-
# @return [PBXGroup] the group where the file references to the support
|
192
|
-
# files should be stored.
|
193
|
-
#
|
194
|
-
attr_reader :support_files_group
|
195
|
-
|
196
|
-
# Adds a reference to the given file in the support group of this target.
|
197
|
-
#
|
198
|
-
# @param [Pathname] path
|
199
|
-
# The path of the file to which the reference should be added.
|
200
|
-
#
|
201
|
-
# @return [PBXFileReference] the file reference of the added file.
|
202
|
-
#
|
203
|
-
def add_file_to_support_group(path)
|
204
|
-
support_files_group.new_file(path)
|
205
|
-
end
|
206
|
-
|
207
|
-
#-----------------------------------------------------------------------#
|
208
|
-
end
|
209
|
-
end
|
210
|
-
end
|