cocoapods 0.16.4 → 0.17.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +108 -0
- data/README.md +3 -3
- data/bin/pod +1 -1
- data/lib/cocoapods.rb +31 -31
- data/lib/cocoapods/command.rb +62 -107
- data/lib/cocoapods/command/inter_process_communication.rb +103 -0
- data/lib/cocoapods/command/list.rb +45 -44
- data/lib/cocoapods/command/outdated.rb +28 -25
- data/lib/cocoapods/command/project.rb +90 -0
- data/lib/cocoapods/command/push.rb +50 -32
- data/lib/cocoapods/command/repo.rb +125 -155
- data/lib/cocoapods/command/search.rb +23 -12
- data/lib/cocoapods/command/setup.rb +103 -64
- data/lib/cocoapods/command/spec.rb +329 -90
- data/lib/cocoapods/config.rb +197 -44
- data/lib/cocoapods/downloader.rb +47 -34
- data/lib/cocoapods/executable.rb +98 -41
- data/lib/cocoapods/external_sources.rb +325 -0
- data/lib/cocoapods/file_list.rb +8 -1
- data/lib/cocoapods/gem_version.rb +7 -0
- data/lib/cocoapods/generator/acknowledgements.rb +71 -7
- data/lib/cocoapods/generator/acknowledgements/markdown.rb +10 -9
- data/lib/cocoapods/generator/acknowledgements/plist.rb +9 -8
- data/lib/cocoapods/generator/copy_resources_script.rb +2 -2
- data/lib/cocoapods/generator/documentation.rb +153 -37
- data/lib/cocoapods/generator/prefix_header.rb +82 -0
- data/lib/cocoapods/generator/target_header.rb +58 -0
- data/lib/cocoapods/generator/xcconfig.rb +130 -0
- data/lib/cocoapods/hooks/installer_representation.rb +123 -0
- data/lib/cocoapods/hooks/library_representation.rb +79 -0
- data/lib/cocoapods/hooks/pod_representation.rb +74 -0
- data/lib/cocoapods/installer.rb +398 -147
- data/lib/cocoapods/installer/analyzer.rb +556 -0
- data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +253 -0
- data/lib/cocoapods/installer/file_references_installer.rb +179 -0
- data/lib/cocoapods/installer/pod_source_installer.rb +289 -0
- data/lib/cocoapods/installer/target_installer.rb +307 -112
- data/lib/cocoapods/installer/user_project_integrator.rb +140 -176
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +193 -0
- data/lib/cocoapods/library.rb +195 -0
- data/lib/cocoapods/open_uri.rb +16 -14
- data/lib/cocoapods/project.rb +175 -52
- data/lib/cocoapods/resolver.rb +151 -164
- data/lib/cocoapods/sandbox.rb +276 -54
- data/lib/cocoapods/sandbox/file_accessor.rb +210 -0
- data/lib/cocoapods/sandbox/headers_store.rb +96 -0
- data/lib/cocoapods/sandbox/path_list.rb +178 -0
- data/lib/cocoapods/sources_manager.rb +218 -0
- data/lib/cocoapods/user_interface.rb +82 -18
- data/lib/cocoapods/{command → user_interface}/error_report.rb +5 -5
- data/lib/cocoapods/validator.rb +379 -0
- metadata +74 -55
- data/lib/cocoapods/command/install.rb +0 -55
- data/lib/cocoapods/command/linter.rb +0 -317
- data/lib/cocoapods/command/update.rb +0 -25
- data/lib/cocoapods/dependency.rb +0 -285
- data/lib/cocoapods/downloader/git.rb +0 -276
- data/lib/cocoapods/downloader/http.rb +0 -99
- data/lib/cocoapods/downloader/mercurial.rb +0 -26
- data/lib/cocoapods/downloader/subversion.rb +0 -42
- data/lib/cocoapods/local_pod.rb +0 -620
- data/lib/cocoapods/lockfile.rb +0 -274
- data/lib/cocoapods/platform.rb +0 -127
- data/lib/cocoapods/podfile.rb +0 -551
- data/lib/cocoapods/source.rb +0 -223
- data/lib/cocoapods/specification.rb +0 -579
- data/lib/cocoapods/specification/set.rb +0 -175
- data/lib/cocoapods/specification/statistics.rb +0 -112
- data/lib/cocoapods/user_interface/ui_pod.rb +0 -130
- data/lib/cocoapods/version.rb +0 -26
@@ -1,176 +1,371 @@
|
|
1
1
|
module Pod
|
2
2
|
class Installer
|
3
3
|
|
4
|
-
#
|
5
|
-
# target in Pods project.
|
6
|
-
#
|
4
|
+
# Controller class responsible of creating and configuring the static
|
5
|
+
# library target in Pods project. It also creates the support file needed
|
6
|
+
# by the target.
|
7
7
|
#
|
8
8
|
class TargetInstaller
|
9
|
-
include Config::Mixin
|
10
9
|
|
11
|
-
# @return [
|
10
|
+
# @return [Sandbox] sandbox the sandbox where the support files should
|
11
|
+
# be generated.
|
12
12
|
#
|
13
|
-
|
13
|
+
attr_reader :sandbox
|
14
|
+
|
15
|
+
# @return [Library] The library whose target needs to be generated.
|
14
16
|
#
|
15
|
-
attr_reader :
|
17
|
+
attr_reader :library
|
16
18
|
|
17
|
-
# @
|
19
|
+
# @param [Project] project @see project
|
20
|
+
# @param [Library] library @see library
|
18
21
|
#
|
19
|
-
|
22
|
+
def initialize(sandbox, library)
|
23
|
+
@sandbox = sandbox
|
24
|
+
@library = library
|
25
|
+
end
|
20
26
|
|
21
|
-
#
|
22
|
-
#
|
27
|
+
# Creates the target in the Pods project and the relative support files.
|
28
|
+
#
|
29
|
+
# @return [void]
|
23
30
|
#
|
24
|
-
|
31
|
+
def install!
|
32
|
+
UI.message "- Installing target `#{library.name}` #{library.platform}" do
|
33
|
+
add_target
|
34
|
+
add_files_to_build_phases
|
35
|
+
create_suport_files_group
|
25
36
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
37
|
+
create_xcconfig_file
|
38
|
+
create_target_header
|
39
|
+
create_prefix_header
|
40
|
+
create_bridge_support_file
|
41
|
+
create_copy_resources_script
|
42
|
+
create_acknowledgements
|
43
|
+
create_dummy_source
|
44
|
+
end
|
30
45
|
end
|
31
46
|
|
32
|
-
|
33
|
-
|
47
|
+
#-----------------------------------------------------------------------#
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
# @!group Installation steps
|
52
|
+
|
53
|
+
# Adds the target for the library to the Pods project with the
|
54
|
+
# appropriate build configurations.
|
55
|
+
#
|
56
|
+
# @note The `PODS_HEADERS_SEARCH_PATHS` overrides the xcconfig.
|
34
57
|
#
|
35
|
-
# @
|
36
|
-
#
|
58
|
+
# @todo Add integration test for build configurations and don't add the
|
59
|
+
# build configurations to the project if they are not needed.
|
37
60
|
#
|
38
|
-
# @
|
39
|
-
# should be generated.
|
61
|
+
# @return [void]
|
40
62
|
#
|
41
|
-
def
|
42
|
-
|
63
|
+
def add_target
|
64
|
+
name = library.label
|
65
|
+
platform = library.platform.name
|
66
|
+
deployment_target = library.platform.deployment_target.to_s
|
67
|
+
@target = project.new_target(:static_library, name, platform, deployment_target)
|
43
68
|
|
44
|
-
|
69
|
+
settings = {}
|
70
|
+
if library.platform.requires_legacy_ios_archs?
|
71
|
+
settings['ARCHS'] = "armv6 armv7"
|
72
|
+
end
|
73
|
+
if target_definition.inhibit_all_warnings?
|
74
|
+
settings['GCC_WARN_INHIBIT_ALL_WARNINGS'] = 'YES'
|
75
|
+
end
|
45
76
|
|
46
|
-
|
47
|
-
|
77
|
+
@target.build_settings('Debug').merge!(settings)
|
78
|
+
@target.build_settings('Release').merge!(settings)
|
48
79
|
|
49
|
-
|
50
|
-
|
80
|
+
library.user_build_configurations.each do |lib_name, type|
|
81
|
+
unless @target.build_configurations.map(&:name).include?(lib_name)
|
82
|
+
build_config = project.new(Xcodeproj::Project::XCBuildConfiguration)
|
83
|
+
build_config.name = lib_name
|
84
|
+
settings = @target.build_settings(type.to_s.capitalize)
|
85
|
+
build_config.build_settings = settings
|
86
|
+
target.build_configurations << build_config
|
87
|
+
project.build_configurations << build_config
|
88
|
+
end
|
89
|
+
end
|
51
90
|
|
52
|
-
|
53
|
-
configure_build_configurations(xcconfig_file, sandbox)
|
54
|
-
create_files(pods, sandbox)
|
91
|
+
library.target = @target
|
55
92
|
end
|
56
93
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
94
|
+
ENABLE_OBJECT_USE_OBJC_FROM = {
|
95
|
+
:ios => Version.new('6'),
|
96
|
+
:osx => Version.new('10.8')
|
97
|
+
}
|
62
98
|
|
63
|
-
#
|
99
|
+
# Adds the build files of the pods to the target and adds a reference to
|
100
|
+
# the frameworks of the Pods.
|
64
101
|
#
|
65
|
-
#
|
102
|
+
# @note The Frameworks are used only for presentation purposes as the
|
103
|
+
# xcconfig is the authoritative source about their information.
|
66
104
|
#
|
67
|
-
|
68
|
-
|
69
|
-
attr_reader :xcconfig
|
70
|
-
|
71
|
-
# In a workspace this is where the static library headers should be found.
|
105
|
+
# @return [void]
|
72
106
|
#
|
73
|
-
def
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
107
|
+
def add_files_to_build_phases
|
108
|
+
UI.message "- Adding Build files" do
|
109
|
+
library.file_accessors.each do |file_accessor|
|
110
|
+
consumer = file_accessor.spec_consumer
|
111
|
+
flags = compiler_flags_for_consumer(consumer)
|
112
|
+
source_files = file_accessor.source_files
|
113
|
+
file_refs = source_files.map { |sf| project.file_reference(sf) }
|
114
|
+
target.add_file_references(file_refs, flags)
|
115
|
+
|
116
|
+
file_accessor.spec_consumer.frameworks.each do |framework|
|
117
|
+
project.add_system_framework(framework, target)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
87
121
|
end
|
88
122
|
|
123
|
+
# Creates the group that holds the references to the support files
|
124
|
+
# generated by this installer.
|
89
125
|
#
|
126
|
+
# @return [void]
|
90
127
|
#
|
91
|
-
def
|
92
|
-
|
128
|
+
def create_suport_files_group
|
129
|
+
name = target_definition.label
|
130
|
+
@support_files_group = project.support_files_group.new_group(name)
|
93
131
|
end
|
94
132
|
|
95
|
-
|
96
|
-
Generator::BridgeSupport.new(pods.map do |pod|
|
97
|
-
pod.relative_header_files.map { |header| sandbox.root + header }
|
98
|
-
end.flatten)
|
99
|
-
end
|
133
|
+
#--------------------------------------#
|
100
134
|
|
101
|
-
#
|
102
|
-
|
103
|
-
|
104
|
-
|
135
|
+
# Generates the contents of the xcconfig file and saves it to disk.
|
136
|
+
#
|
137
|
+
# @note The `ALWAYS_SEARCH_USER_PATHS` flag is enabled to support
|
138
|
+
# libraries like `EmbedReader`.
|
139
|
+
#
|
140
|
+
# @return [void]
|
141
|
+
#
|
142
|
+
def create_xcconfig_file
|
143
|
+
path = library.xcconfig_path
|
144
|
+
UI.message "- Generating xcconfig file at #{UI.path(path)}" do
|
145
|
+
gen = Generator::XCConfig.new(sandbox, spec_consumers, library.relative_pods_root)
|
146
|
+
gen.set_arc_compatibility_flag = target_definition.podfile.set_arc_compatibility_flag?
|
147
|
+
gen.save_as(path)
|
148
|
+
library.xcconfig = gen.xcconfig
|
149
|
+
xcconfig_file_ref = add_file_to_support_group(path)
|
105
150
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
header.puts "#import #{@target_definition.platform == :ios ? '<UIKit/UIKit.h>' : '<Cocoa/Cocoa.h>'}"
|
111
|
-
header.puts "#endif"
|
112
|
-
pods.each do |pod|
|
113
|
-
if prefix_header_contents = pod.top_specification.prefix_header_contents
|
114
|
-
header.puts
|
115
|
-
header.puts prefix_header_contents
|
116
|
-
elsif prefix_header = pod.prefix_header_file
|
117
|
-
header.puts
|
118
|
-
header.puts prefix_header.read
|
151
|
+
target.build_configurations.each do |c|
|
152
|
+
c.base_configuration_reference = xcconfig_file_ref
|
153
|
+
Generator::XCConfig.pods_project_settings.each do |key, value|
|
154
|
+
c.build_settings[key] = value
|
119
155
|
end
|
120
156
|
end
|
121
157
|
end
|
122
158
|
end
|
123
159
|
|
124
|
-
|
125
|
-
|
160
|
+
# Generates a header which allows to inspect at compile time the installed
|
161
|
+
# pods and the installed specifications of a pod.
|
162
|
+
#
|
163
|
+
def create_target_header
|
164
|
+
path = library.target_header_path
|
165
|
+
UI.message "- Generating target header at #{UI.path(path)}" do
|
166
|
+
generator = Generator::TargetHeader.new(library.specs)
|
167
|
+
generator.save_as(path)
|
168
|
+
add_file_to_support_group(path)
|
169
|
+
end
|
126
170
|
end
|
127
171
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
172
|
+
# Creates a prefix header file which imports `UIKit` or `Cocoa` according
|
173
|
+
# to the platform of the target. This file also include any prefix header
|
174
|
+
# content reported by the specification of the pods.
|
175
|
+
#
|
176
|
+
# @return [void]
|
177
|
+
#
|
178
|
+
def create_prefix_header
|
179
|
+
path = library.prefix_header_path
|
180
|
+
UI.message "- Generating prefix header at #{UI.path(path)}" do
|
181
|
+
generator = Generator::PrefixHeader.new(library.file_accessors, library.platform)
|
182
|
+
generator.imports << library.target_header_path.basename
|
183
|
+
generator.save_as(path)
|
184
|
+
add_file_to_support_group(path)
|
185
|
+
|
186
|
+
target.build_configurations.each do |c|
|
187
|
+
relative_path = path.relative_path_from(sandbox.root)
|
188
|
+
c.build_settings['GCC_PREFIX_HEADER'] = relative_path.to_s
|
189
|
+
end
|
136
190
|
end
|
137
191
|
end
|
138
192
|
|
193
|
+
# Generates the bridge support metadata if requested by the {Podfile}.
|
139
194
|
#
|
195
|
+
# @note The bridge support metadata is added to the resources of the
|
196
|
+
# library because it is needed for environments interpreted at
|
197
|
+
# runtime.
|
140
198
|
#
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
199
|
+
# @return [void]
|
200
|
+
#
|
201
|
+
def create_bridge_support_file
|
202
|
+
if target_definition.podfile.generate_bridge_support?
|
203
|
+
path = library.bridge_support_path
|
204
|
+
UI.message "- Generating BridgeSupport metadata at #{UI.path(path)}" do
|
205
|
+
headers = target.headers_build_phase.files.map { |bf| sandbox.root + bf.file_ref.path }
|
206
|
+
generator = Generator::BridgeSupport.new(headers)
|
207
|
+
generator.save_as(path)
|
208
|
+
add_file_to_support_group(path)
|
209
|
+
@bridge_support_file = path.relative_path_from(sandbox.root)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
147
213
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
214
|
+
# Creates a script that copies the resources to the bundle of the client
|
215
|
+
# target.
|
216
|
+
#
|
217
|
+
# @note The bridge support file needs to be created before the prefix
|
218
|
+
# header, otherwise it will not be added to the resources script.
|
219
|
+
#
|
220
|
+
# @return [void]
|
221
|
+
#
|
222
|
+
def create_copy_resources_script
|
223
|
+
path = library.copy_resources_script_path
|
224
|
+
UI.message "- Generating copy resources script at #{UI.path(path)}" do
|
225
|
+
resources = library.file_accessors.map { |accessor| accessor.resources.flatten.map {|res| project.relativize(res)} }.flatten
|
226
|
+
resources << bridge_support_file if bridge_support_file
|
227
|
+
generator = Generator::CopyResourcesScript.new(resources)
|
228
|
+
generator.save_as(path)
|
229
|
+
add_file_to_support_group(path)
|
152
230
|
end
|
231
|
+
end
|
153
232
|
|
154
|
-
|
155
|
-
|
233
|
+
# Generates the acknowledgement files (markdown and plist) for the target.
|
234
|
+
#
|
235
|
+
# @return [void]
|
236
|
+
#
|
237
|
+
def create_acknowledgements
|
238
|
+
basepath = library.acknowledgements_basepath
|
239
|
+
Generator::Acknowledgements.generators.each do |generator_class|
|
240
|
+
path = generator_class.path_from_basepath(basepath)
|
241
|
+
UI.message "- Generating acknowledgements at #{UI.path(path)}" do
|
242
|
+
generator = generator_class.new(library.file_accessors)
|
243
|
+
generator.save_as(path)
|
244
|
+
add_file_to_support_group(path)
|
245
|
+
end
|
156
246
|
end
|
247
|
+
end
|
157
248
|
|
158
|
-
|
159
|
-
|
249
|
+
# Generates a dummy source file for each target so libraries that contain
|
250
|
+
# only categories build.
|
251
|
+
#
|
252
|
+
# @return [void]
|
253
|
+
#
|
254
|
+
def create_dummy_source
|
255
|
+
path = library.dummy_source_path
|
256
|
+
UI.message "- Generating dummy source file at #{UI.path(path)}" do
|
257
|
+
generator = Generator::DummySource.new(library.label)
|
258
|
+
generator.save_as(path)
|
259
|
+
file_reference = add_file_to_support_group(path)
|
260
|
+
target.source_build_phase.add_file_reference(file_reference)
|
160
261
|
end
|
161
262
|
end
|
162
263
|
|
264
|
+
#-----------------------------------------------------------------------#
|
265
|
+
|
163
266
|
private
|
164
267
|
|
165
|
-
|
166
|
-
|
268
|
+
# @return [PBXNativeTarget] the target generated by the installation
|
269
|
+
# process.
|
270
|
+
#
|
271
|
+
# @note Generated by the {#add_target} step.
|
272
|
+
#
|
273
|
+
attr_reader :target
|
274
|
+
|
275
|
+
# @!group Private helpers.
|
276
|
+
|
277
|
+
# @return [Project] the Pods project of the sandbox.
|
278
|
+
#
|
279
|
+
def project
|
280
|
+
sandbox.project
|
281
|
+
end
|
282
|
+
|
283
|
+
# @return [TargetDefinition] the target definition of the library.
|
284
|
+
#
|
285
|
+
def target_definition
|
286
|
+
library.target_definition
|
167
287
|
end
|
168
288
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
289
|
+
# @return [Specification::Consumer] the consumer for the specifications.
|
290
|
+
#
|
291
|
+
def spec_consumers
|
292
|
+
@spec_consumers ||= library.file_accessors.map(&:spec_consumer)
|
173
293
|
end
|
294
|
+
|
295
|
+
# @return [PBXGroup] the group where the file references to the support
|
296
|
+
# files should be stored.
|
297
|
+
#
|
298
|
+
attr_reader :support_files_group
|
299
|
+
|
300
|
+
# @return [Pathname] the path of the bridge support file relative to the
|
301
|
+
# sandbox.
|
302
|
+
#
|
303
|
+
# @return [Nil] if no bridge support file was generated.
|
304
|
+
#
|
305
|
+
attr_reader :bridge_support_file
|
306
|
+
|
307
|
+
# Adds a reference to the given file in the support group of this target.
|
308
|
+
#
|
309
|
+
# @param [Pathname] path
|
310
|
+
# The path of the file to which the reference should be added.
|
311
|
+
#
|
312
|
+
# @return [PBXFileReference] the file reference of the added file.
|
313
|
+
#
|
314
|
+
def add_file_to_support_group(path)
|
315
|
+
relative_path = path.relative_path_from(sandbox.root)
|
316
|
+
support_files_group.new_file(relative_path)
|
317
|
+
end
|
318
|
+
|
319
|
+
# Returns the compiler flags for the source files of the given specification.
|
320
|
+
#
|
321
|
+
# The following behavior is regarding the `OS_OBJECT_USE_OBJC` flag. When
|
322
|
+
# set to `0`, it will allow code to use `dispatch_release()` on >= iOS 6.0
|
323
|
+
# and OS X 10.8.
|
324
|
+
#
|
325
|
+
# * New libraries that do *not* require ARC don’t need to care about this
|
326
|
+
# issue at all.
|
327
|
+
#
|
328
|
+
# * New libraries that *do* require ARC _and_ have a deployment target of
|
329
|
+
# >= iOS 6.0 or OS X 10.8:
|
330
|
+
#
|
331
|
+
# These no longer use `dispatch_release()` and should *not* have the
|
332
|
+
# `OS_OBJECT_USE_OBJC` flag set to `0`.
|
333
|
+
#
|
334
|
+
# **Note:** this means that these libraries *have* to specify the
|
335
|
+
# deployment target in order to function well.
|
336
|
+
#
|
337
|
+
# * New libraries that *do* require ARC, but have a deployment target of
|
338
|
+
# < iOS 6.0 or OS X 10.8:
|
339
|
+
#
|
340
|
+
# These contain `dispatch_release()` calls and as such need the
|
341
|
+
# `OS_OBJECT_USE_OBJC` flag set to `1`.
|
342
|
+
#
|
343
|
+
# **Note:** libraries that do *not* specify a platform version are
|
344
|
+
# assumed to have a deployment target of < iOS 6.0 or OS X 10.8.
|
345
|
+
#
|
346
|
+
# For more information, see: http://opensource.apple.com/source/libdispatch/libdispatch-228.18/os/object.h
|
347
|
+
#
|
348
|
+
# @param [Specification::Consumer] consumer
|
349
|
+
# The consumer for the specification for which the compiler flags
|
350
|
+
# are needed.
|
351
|
+
#
|
352
|
+
# @return [String] The compiler flags.
|
353
|
+
#
|
354
|
+
def compiler_flags_for_consumer(consumer)
|
355
|
+
flags = consumer.compiler_flags.dup
|
356
|
+
if consumer.requires_arc
|
357
|
+
flags << '-fobjc-arc'
|
358
|
+
platform_name = consumer.platform_name
|
359
|
+
spec_deployment_target = consumer.spec.deployment_target(platform_name)
|
360
|
+
if spec_deployment_target.nil? || Version.new(spec_deployment_target) < ENABLE_OBJECT_USE_OBJC_FROM[platform_name]
|
361
|
+
flags << '-DOS_OBJECT_USE_OBJC=0'
|
362
|
+
end
|
363
|
+
end
|
364
|
+
flags = flags * " "
|
365
|
+
end
|
366
|
+
|
367
|
+
#-----------------------------------------------------------------------#
|
368
|
+
|
174
369
|
end
|
175
370
|
end
|
176
371
|
end
|