cocoapods 0.20.2 → 0.21.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +26 -0
- data/lib/cocoapods.rb +8 -4
- data/lib/cocoapods/command/spec.rb +5 -14
- data/lib/cocoapods/gem_version.rb +1 -1
- data/lib/cocoapods/generator/copy_resources_script.rb +2 -2
- data/lib/cocoapods/generator/xcconfig.rb +16 -75
- data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +47 -0
- data/lib/cocoapods/generator/xcconfig/private_pod_xcconfig.rb +45 -0
- data/lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb +40 -0
- data/lib/cocoapods/hooks/installer_representation.rb +3 -3
- data/lib/cocoapods/installer.rb +74 -39
- data/lib/cocoapods/installer/analyzer.rb +52 -41
- data/lib/cocoapods/installer/file_references_installer.rb +13 -12
- data/lib/cocoapods/installer/target_installer.rb +6 -241
- data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +132 -0
- data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +160 -0
- data/lib/cocoapods/installer/user_project_integrator.rb +11 -11
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +70 -50
- data/lib/cocoapods/sandbox.rb +0 -5
- data/lib/cocoapods/sandbox/file_accessor.rb +2 -16
- data/lib/cocoapods/target.rb +116 -0
- data/lib/cocoapods/target/aggregate_target.rb +121 -0
- data/lib/cocoapods/target/pod_target.rb +53 -0
- data/lib/cocoapods/validator.rb +1 -1
- metadata +160 -226
- data/lib/cocoapods/file_list.rb +0 -36
- data/lib/cocoapods/library.rb +0 -202
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4046f40b104b268eb0dcc90991f868953707d6c4
|
4
|
+
data.tar.gz: 006fd40b93468988e5cca4c9388e9e00a1b7ca02
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6fa144dd19952870b080632f055abb1111dfcdf26e37ba5b16d2f602b77bd56766cb7cf5ed50e2613a299ffd778ddec3b52a3f221d416122e38897f68828c31d
|
7
|
+
data.tar.gz: 86cfacba4348f91b159e486984b00bdb04493db61ec5bccf50a1a1b8358666a0942c9a3bf0b7212836a2670300c35bc0ea06ef0e192163268a4a3b4431b36fef
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,32 @@
|
|
2
2
|
|
3
3
|
To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides/installing_cocoapods.html).
|
4
4
|
|
5
|
+
|
6
|
+
## 0.21.0.rc1
|
7
|
+
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.20.2...0.21.0.rc1)
|
8
|
+
• [cocoapods-core](https://github.com/CocoaPods/Core/compare/0.20.2...0.21.0.rc1)
|
9
|
+
• [Xcodeproj](https://github.com/CocoaPods/Xcodeproj/compare/0.6.0...0.7.0)
|
10
|
+
|
11
|
+
###### Enhancements
|
12
|
+
|
13
|
+
* Pods are now built in dedicated targets. This enhancement isolates the build
|
14
|
+
environment of each Pod from other ones eliminating pollution issues. It also
|
15
|
+
introduces an important architectural improvement which lays the foundation
|
16
|
+
for the upcoming CocoaPods features. Stay tuned! This feature has been
|
17
|
+
implemented by [Jeremy Slater](https://github.com/jasl8r).
|
18
|
+
[#841](https://github.com/CocoaPods/CocoaPods/issues/1080)
|
19
|
+
|
20
|
+
* Reduced external dependencies and deprecation of Rake::FileList.
|
21
|
+
[#1080](https://github.com/CocoaPods/CocoaPods/issues/1080)
|
22
|
+
|
23
|
+
###### Bug fixes
|
24
|
+
|
25
|
+
* Fixed crash due to Podfile.lock containing multiple version requirements for
|
26
|
+
a Pod. [#1076](https://github.com/CocoaPods/CocoaPods/issues/1076)
|
27
|
+
* Fixed a build error due to the copy resources script using the same temporary
|
28
|
+
file for multiple targets.
|
29
|
+
[#1099](https://github.com/CocoaPods/CocoaPods/issues/1099)
|
30
|
+
|
5
31
|
## 0.20.2
|
6
32
|
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.20.1...0.20.2)
|
7
33
|
|
data/lib/cocoapods.rb
CHANGED
@@ -7,7 +7,6 @@ module Pod
|
|
7
7
|
|
8
8
|
require 'cocoapods/gem_version'
|
9
9
|
require 'cocoapods-core'
|
10
|
-
require 'cocoapods/file_list'
|
11
10
|
require 'cocoapods/config'
|
12
11
|
require 'cocoapods/downloader'
|
13
12
|
|
@@ -43,7 +42,9 @@ module Pod
|
|
43
42
|
autoload :ExternalSources, 'cocoapods/external_sources'
|
44
43
|
autoload :Installer, 'cocoapods/installer'
|
45
44
|
autoload :SourcesManager, 'cocoapods/sources_manager'
|
46
|
-
autoload :
|
45
|
+
autoload :Target, 'cocoapods/target'
|
46
|
+
autoload :AggregateTarget, 'cocoapods/target/aggregate_target'
|
47
|
+
autoload :PodTarget, 'cocoapods/target/pod_target'
|
47
48
|
autoload :Project, 'cocoapods/project'
|
48
49
|
autoload :Resolver, 'cocoapods/resolver'
|
49
50
|
autoload :Sandbox, 'cocoapods/sandbox'
|
@@ -52,14 +53,17 @@ module Pod
|
|
52
53
|
|
53
54
|
module Generator
|
54
55
|
autoload :Acknowledgements, 'cocoapods/generator/acknowledgements'
|
56
|
+
autoload :Markdown, 'cocoapods/generator/acknowledgements/markdown'
|
57
|
+
autoload :Plist, 'cocoapods/generator/acknowledgements/plist'
|
55
58
|
autoload :BridgeSupport, 'cocoapods/generator/bridge_support'
|
56
59
|
autoload :CopyResourcesScript, 'cocoapods/generator/copy_resources_script'
|
57
60
|
autoload :DummySource, 'cocoapods/generator/dummy_source'
|
58
|
-
autoload :Markdown, 'cocoapods/generator/acknowledgements/markdown'
|
59
|
-
autoload :Plist, 'cocoapods/generator/acknowledgements/plist'
|
60
61
|
autoload :PrefixHeader, 'cocoapods/generator/prefix_header'
|
61
62
|
autoload :TargetEnvironmentHeader, 'cocoapods/generator/target_environment_header'
|
62
63
|
autoload :XCConfig, 'cocoapods/generator/xcconfig'
|
64
|
+
autoload :AggregateXCConfig, 'cocoapods/generator/xcconfig/aggregate_xcconfig'
|
65
|
+
autoload :PublicPodXCConfig, 'cocoapods/generator/xcconfig/public_pod_xcconfig'
|
66
|
+
autoload :PrivatePodXCConfig, 'cocoapods/generator/xcconfig/private_pod_xcconfig'
|
63
67
|
end
|
64
68
|
|
65
69
|
module Hooks
|
@@ -32,15 +32,6 @@ module Pod
|
|
32
32
|
|
33
33
|
def run
|
34
34
|
if repo_id_match = (@url || @name_or_url).match(/github.com\/([^\/\.]*\/[^\/\.]*)\.*/)
|
35
|
-
# This is to make sure Faraday doesn't warn the user about the `system_timer` gem missing.
|
36
|
-
old_warn, $-w = $-w, nil
|
37
|
-
begin
|
38
|
-
require 'faraday'
|
39
|
-
ensure
|
40
|
-
$-w = old_warn
|
41
|
-
end
|
42
|
-
require 'octokit'
|
43
|
-
|
44
35
|
repo_id = repo_id_match[1]
|
45
36
|
data = github_data_for_template(repo_id)
|
46
37
|
data[:name] = @name_or_url if @url
|
@@ -410,8 +401,8 @@ module Pod
|
|
410
401
|
end
|
411
402
|
|
412
403
|
def github_data_for_template(repo_id)
|
413
|
-
repo =
|
414
|
-
user =
|
404
|
+
repo = GitHub.repo(repo_id)
|
405
|
+
user = GitHub.user(repo['owner']['login'])
|
415
406
|
data = {}
|
416
407
|
|
417
408
|
data[:name] = repo['name']
|
@@ -425,7 +416,7 @@ module Pod
|
|
425
416
|
end
|
426
417
|
|
427
418
|
def suggested_ref_and_version(repo)
|
428
|
-
tags =
|
419
|
+
tags = GitHub.tags(repo['html_url']).map {|tag| tag["name"]}
|
429
420
|
versions_tags = {}
|
430
421
|
tags.each do |tag|
|
431
422
|
clean_tag = tag.gsub(/^v(er)? ?/,'')
|
@@ -434,9 +425,9 @@ module Pod
|
|
434
425
|
version = versions_tags.keys.sort.last || '0.0.1'
|
435
426
|
data = {:version => version}
|
436
427
|
if version == '0.0.1'
|
437
|
-
branches =
|
428
|
+
branches = GitHub.branches(repo['html_url'])
|
438
429
|
master_name = repo['master_branch'] || 'master'
|
439
|
-
master = branches.
|
430
|
+
master = branches.find {|branch| branch['name'] == master_name }
|
440
431
|
data[:ref_type] = ':commit'
|
441
432
|
data[:ref] = master['commit']['sha']
|
442
433
|
else
|
@@ -80,8 +80,8 @@ module Pod
|
|
80
80
|
INSTALL_RESOURCES_FUCTION = <<EOS
|
81
81
|
#!/bin/sh
|
82
82
|
|
83
|
-
RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy.txt
|
84
|
-
|
83
|
+
RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
|
84
|
+
> "$RESOURCES_TO_COPY"
|
85
85
|
|
86
86
|
install_resource()
|
87
87
|
{
|
@@ -1,85 +1,28 @@
|
|
1
1
|
module Pod
|
2
2
|
module Generator
|
3
3
|
|
4
|
-
# Generates
|
5
|
-
#
|
4
|
+
# Generates Xcode configuration files. A configuration file is generated
|
5
|
+
# for each Pod and for each Pod target definition. The aggregates the
|
6
|
+
# configurations of the Pods and define target specific settings.
|
6
7
|
#
|
7
8
|
class XCConfig
|
8
9
|
|
9
|
-
# @return [
|
10
|
+
# @return [Target] the target represented by this xcconfig.
|
10
11
|
#
|
12
|
+
attr_reader :target
|
11
13
|
attr_reader :sandbox
|
12
14
|
|
13
|
-
# @
|
14
|
-
# specifications of the library which needs the xcconfig.
|
15
|
+
# @param [Target] target @see target
|
15
16
|
#
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
# project that should be integrated by this library.
|
20
|
-
#
|
21
|
-
attr_reader :relative_pods_root
|
22
|
-
|
23
|
-
# @param [Sandbox] sandbox @see sandbox
|
24
|
-
# @param [Array<LocalPod>] pods @see pods
|
25
|
-
# @param [String] relative_pods_root @see relative_pods_root
|
26
|
-
#
|
27
|
-
def initialize(sandbox, spec_consumers, relative_pods_root)
|
28
|
-
@sandbox = sandbox
|
29
|
-
@spec_consumers = spec_consumers
|
30
|
-
@relative_pods_root = relative_pods_root
|
31
|
-
end
|
32
|
-
|
33
|
-
# @return [Bool] whether the Podfile specifies to add the `-fobjc-arc`
|
34
|
-
# flag for compatibility.
|
35
|
-
#
|
36
|
-
attr_accessor :set_arc_compatibility_flag
|
37
|
-
|
38
|
-
#-----------------------------------------------------------------------#
|
39
|
-
|
40
|
-
# Generates the xcconfig for the library.
|
41
|
-
#
|
42
|
-
# @return [Xcodeproj::Config]
|
43
|
-
#
|
44
|
-
# @note The value `PODS_HEADERS_SEARCH_PATHS` is used to store the headers
|
45
|
-
# so xcconfig can reference the variable.
|
46
|
-
#
|
47
|
-
def generate
|
48
|
-
ld_flags = '-ObjC'
|
49
|
-
if set_arc_compatibility_flag && spec_consumers.any? { |consumer| consumer.requires_arc }
|
50
|
-
ld_flags << ' -fobjc-arc'
|
51
|
-
end
|
52
|
-
|
53
|
-
@xcconfig = Xcodeproj::Config.new({
|
54
|
-
'ALWAYS_SEARCH_USER_PATHS' => 'YES',
|
55
|
-
'OTHER_LDFLAGS' => ld_flags,
|
56
|
-
'HEADER_SEARCH_PATHS' => '${PODS_HEADERS_SEARCH_PATHS}',
|
57
|
-
'PODS_ROOT' => relative_pods_root,
|
58
|
-
'PODS_HEADERS_SEARCH_PATHS' => '${PODS_PUBLIC_HEADERS_SEARCH_PATHS}',
|
59
|
-
'PODS_BUILD_HEADERS_SEARCH_PATHS' => quote(sandbox.build_headers.search_paths),
|
60
|
-
'PODS_PUBLIC_HEADERS_SEARCH_PATHS' => quote(sandbox.public_headers.search_paths),
|
61
|
-
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1'
|
62
|
-
})
|
63
|
-
|
64
|
-
spec_consumers.each do |consumer|
|
65
|
-
add_spec_build_settings_to_xcconfig(consumer, @xcconfig)
|
66
|
-
end
|
67
|
-
|
68
|
-
@xcconfig
|
17
|
+
def initialize(target)
|
18
|
+
@target = target
|
19
|
+
@sandbox = target.sandbox
|
69
20
|
end
|
70
21
|
|
71
22
|
# @return [Xcodeproj::Config] The generated xcconfig.
|
72
23
|
#
|
73
24
|
attr_reader :xcconfig
|
74
25
|
|
75
|
-
# @return [Hash] The settings of the xcconfig that the Pods project
|
76
|
-
# needs to override.
|
77
|
-
#
|
78
|
-
def self.pods_project_settings
|
79
|
-
{ 'PODS_ROOT' => '${SRCROOT}',
|
80
|
-
'PODS_HEADERS_SEARCH_PATHS' => '${PODS_BUILD_HEADERS_SEARCH_PATHS}' }
|
81
|
-
end
|
82
|
-
|
83
26
|
# Generates and saves the xcconfig to the given path.
|
84
27
|
#
|
85
28
|
# @param [Pathname] path
|
@@ -88,7 +31,7 @@ module Pod
|
|
88
31
|
# @return [void]
|
89
32
|
#
|
90
33
|
def save_as(path)
|
91
|
-
|
34
|
+
generate.save_as(path)
|
92
35
|
end
|
93
36
|
|
94
37
|
#-----------------------------------------------------------------------#
|
@@ -102,12 +45,12 @@ module Pod
|
|
102
45
|
# Podfile.
|
103
46
|
#
|
104
47
|
def default_ld_flags
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
48
|
+
ld_flags = '-ObjC'
|
49
|
+
if target.target_definition.podfile.set_arc_compatibility_flag? and
|
50
|
+
target.spec_consumers.any? { |consumer| consumer.requires_arc? }
|
51
|
+
ld_flags << ' -fobjc-arc'
|
109
52
|
end
|
110
|
-
|
53
|
+
ld_flags
|
111
54
|
end
|
112
55
|
|
113
56
|
# Converts an array of strings to a single string where the each string
|
@@ -132,8 +75,6 @@ module Pod
|
|
132
75
|
# @param [Xcodeproj::Config] xcconfig
|
133
76
|
# The xcconfig to edit.
|
134
77
|
#
|
135
|
-
# @return [void]
|
136
|
-
#
|
137
78
|
def add_spec_build_settings_to_xcconfig(consumer, xcconfig)
|
138
79
|
xcconfig.merge!(consumer.xcconfig)
|
139
80
|
xcconfig.libraries.merge(consumer.libraries)
|
@@ -153,7 +94,7 @@ module Pod
|
|
153
94
|
]
|
154
95
|
|
155
96
|
# Adds the search paths of the developer frameworks to the specification
|
156
|
-
# if needed. This is done because the `SenTestingKit` requires them and
|
97
|
+
# if needed. This is done because the `SenTestingKit` requires them and
|
157
98
|
# adding them to each specification which requires it is repetitive and
|
158
99
|
# error prone.
|
159
100
|
#
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
|
4
|
+
# Generates the xcconfigs for the aggregate targets.
|
5
|
+
#
|
6
|
+
class AggregateXCConfig < XCConfig
|
7
|
+
|
8
|
+
# Generates the xcconfig.
|
9
|
+
#
|
10
|
+
# @note The xcconfig file for a Pods integration target includes the
|
11
|
+
# namespaced xcconfig files for each spec target dependency.
|
12
|
+
# Each namespaced configuration value is merged into the Pod
|
13
|
+
# xcconfig file.
|
14
|
+
#
|
15
|
+
# @return [Xcodeproj::Config]
|
16
|
+
#
|
17
|
+
def generate
|
18
|
+
config = {
|
19
|
+
'ALWAYS_SEARCH_USER_PATHS' => 'YES',
|
20
|
+
'OTHER_LDFLAGS' => default_ld_flags,
|
21
|
+
'HEADER_SEARCH_PATHS' => quote(sandbox.public_headers.search_paths),
|
22
|
+
'PODS_ROOT' => target.relative_pods_root,
|
23
|
+
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
|
24
|
+
}
|
25
|
+
|
26
|
+
target.pod_targets.each do |pod_target|
|
27
|
+
xcconfig = Xcodeproj::Config.new
|
28
|
+
pod_target.spec_consumers.each do |consumer|
|
29
|
+
add_spec_build_settings_to_xcconfig(consumer, xcconfig)
|
30
|
+
end
|
31
|
+
|
32
|
+
xcconfig.to_hash.each do |k, v|
|
33
|
+
prefixed_key = pod_target.xcconfig_prefix + k
|
34
|
+
config[k] = "#{config[k]} ${#{prefixed_key}}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
@xcconfig = Xcodeproj::Config.new(config)
|
39
|
+
@xcconfig.includes = target.pod_targets.map(&:name)
|
40
|
+
@xcconfig
|
41
|
+
end
|
42
|
+
|
43
|
+
#-----------------------------------------------------------------------#
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
|
4
|
+
# Generates the private xcconfigs for the pod targets.
|
5
|
+
#
|
6
|
+
# The private xcconfig file for a Pod target merges the configuration
|
7
|
+
# values of the public namespaced xcconfig with the default private
|
8
|
+
# configuration values required by CocoaPods.
|
9
|
+
#
|
10
|
+
class PrivatePodXCConfig < XCConfig
|
11
|
+
|
12
|
+
# Generates the xcconfig.
|
13
|
+
#
|
14
|
+
# @return [Xcodeproj::Config]
|
15
|
+
#
|
16
|
+
def generate
|
17
|
+
config = {
|
18
|
+
'ALWAYS_SEARCH_USER_PATHS' => 'YES',
|
19
|
+
'OTHER_LDFLAGS' => default_ld_flags,
|
20
|
+
'PODS_ROOT' => '${SRCROOT}',
|
21
|
+
'HEADER_SEARCH_PATHS' => quote(target.build_headers.search_paths) + ' ' + quote(sandbox.public_headers.search_paths),
|
22
|
+
'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1',
|
23
|
+
# 'USE_HEADERMAP' => 'NO'
|
24
|
+
}
|
25
|
+
|
26
|
+
xcconfig = Xcodeproj::Config.new
|
27
|
+
target.spec_consumers.each do |consumer|
|
28
|
+
add_spec_build_settings_to_xcconfig(consumer, xcconfig)
|
29
|
+
end
|
30
|
+
|
31
|
+
xcconfig.to_hash.each do |k, v|
|
32
|
+
prefixed_key = target.xcconfig_prefix + k
|
33
|
+
config[k] = "#{config[k]} ${#{prefixed_key}}"
|
34
|
+
end
|
35
|
+
|
36
|
+
@xcconfig = Xcodeproj::Config.new(config)
|
37
|
+
@xcconfig.includes = [target.name]
|
38
|
+
@xcconfig
|
39
|
+
end
|
40
|
+
|
41
|
+
#-----------------------------------------------------------------------#
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
|
4
|
+
# Generates the public xcconfigs for the pod targets.
|
5
|
+
#
|
6
|
+
# The public xcconfig file for a Pod is completely namespaced to prevent
|
7
|
+
# configuration value collision with the build settings of other Pods. This
|
8
|
+
# xcconfig includes the standard podspec defined values including
|
9
|
+
# libraries, frameworks, weak frameworks and xcconfig overrides.
|
10
|
+
#
|
11
|
+
class PublicPodXCConfig < XCConfig
|
12
|
+
|
13
|
+
# Generates and saves the xcconfig to the given path.
|
14
|
+
#
|
15
|
+
# @param [Pathname] path
|
16
|
+
# the path where the prefix header should be stored.
|
17
|
+
#
|
18
|
+
# @return [void]
|
19
|
+
#
|
20
|
+
def save_as(path)
|
21
|
+
generate.save_as(path, target.xcconfig_prefix)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Generates the xcconfig for the target.
|
25
|
+
#
|
26
|
+
# @return [Xcodeproj::Config]
|
27
|
+
#
|
28
|
+
def generate
|
29
|
+
@xcconfig = Xcodeproj::Config.new
|
30
|
+
target.spec_consumers.each do |consumer|
|
31
|
+
add_spec_build_settings_to_xcconfig(consumer, @xcconfig)
|
32
|
+
end
|
33
|
+
@xcconfig
|
34
|
+
end
|
35
|
+
|
36
|
+
#-----------------------------------------------------------------------#
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -59,7 +59,7 @@ module Pod
|
|
59
59
|
#
|
60
60
|
def specs_by_lib
|
61
61
|
result = {}
|
62
|
-
installer.
|
62
|
+
installer.pod_targets.each do |lib|
|
63
63
|
result[installer.library_rep(lib)] = lib.specs
|
64
64
|
end
|
65
65
|
result
|
@@ -70,8 +70,8 @@ module Pod
|
|
70
70
|
#
|
71
71
|
def pods_by_lib
|
72
72
|
result = {}
|
73
|
-
installer.
|
74
|
-
pod_names = lib.
|
73
|
+
installer.aggregate_targets.map(&:pod_targets).flatten.each do |lib|
|
74
|
+
pod_names = [lib.root_spec.name]
|
75
75
|
pod_reps = pods.select { |rep| pod_names.include?(rep.name) }
|
76
76
|
result[lib.target_definition] = pod_reps
|
77
77
|
end
|
data/lib/cocoapods/installer.rb
CHANGED
@@ -28,11 +28,13 @@ module Pod
|
|
28
28
|
#
|
29
29
|
class Installer
|
30
30
|
|
31
|
-
autoload :Analyzer,
|
32
|
-
autoload :FileReferencesInstaller,
|
33
|
-
autoload :PodSourceInstaller,
|
34
|
-
autoload :TargetInstaller,
|
35
|
-
autoload :
|
31
|
+
autoload :Analyzer, 'cocoapods/installer/analyzer'
|
32
|
+
autoload :FileReferencesInstaller, 'cocoapods/installer/file_references_installer'
|
33
|
+
autoload :PodSourceInstaller, 'cocoapods/installer/pod_source_installer'
|
34
|
+
autoload :TargetInstaller, 'cocoapods/installer/target_installer'
|
35
|
+
autoload :AggregateTargetInstaller, 'cocoapods/installer/target_installer/aggregate_target_installer'
|
36
|
+
autoload :PodTargetInstaller, 'cocoapods/installer/target_installer/pod_target_installer'
|
37
|
+
autoload :UserProjectIntegrator, 'cocoapods/installer/user_project_integrator'
|
36
38
|
|
37
39
|
include Config::Mixin
|
38
40
|
|
@@ -108,7 +110,8 @@ module Pod
|
|
108
110
|
UI.section "Generating Pods project" do
|
109
111
|
prepare_pods_project
|
110
112
|
install_file_references
|
111
|
-
|
113
|
+
install_libraries
|
114
|
+
link_aggregate_target
|
112
115
|
run_post_install_hooks
|
113
116
|
write_pod_project
|
114
117
|
write_lockfiles
|
@@ -134,10 +137,10 @@ module Pod
|
|
134
137
|
#
|
135
138
|
attr_reader :names_of_pods_to_install
|
136
139
|
|
137
|
-
# @return [Array<
|
138
|
-
#
|
140
|
+
# @return [Array<AggregateTarget>] The Podfile targets containing library
|
141
|
+
# dependencies.
|
139
142
|
#
|
140
|
-
attr_reader :
|
143
|
+
attr_reader :aggregate_targets
|
141
144
|
|
142
145
|
# @return [Array<Specification>] The specifications that where installed.
|
143
146
|
#
|
@@ -158,14 +161,14 @@ module Pod
|
|
158
161
|
def analyze
|
159
162
|
if lockfile && lockfile.cocoapods_version > Version.new(VERSION)
|
160
163
|
STDERR.puts '[!] The version of CocoaPods used to generate the lockfile is '\
|
161
|
-
'higher that the one of the current executable. Incompatibility' \
|
164
|
+
'higher that the one of the current executable. Incompatibility ' \
|
162
165
|
'issues might arise.'.yellow
|
163
166
|
end
|
164
167
|
|
165
168
|
analyzer = Analyzer.new(sandbox, podfile, lockfile)
|
166
169
|
analyzer.update_mode = update_mode
|
167
170
|
@analysis_result = analyzer.analyze
|
168
|
-
@
|
171
|
+
@aggregate_targets = analyzer.result.targets
|
169
172
|
end
|
170
173
|
|
171
174
|
# Prepares the Pods folder in order to be compatible with the most recent
|
@@ -186,8 +189,10 @@ module Pod
|
|
186
189
|
# @todo [#247] Clean the headers of only the pods to install.
|
187
190
|
#
|
188
191
|
def clean_sandbox
|
189
|
-
sandbox.build_headers.implode!
|
190
192
|
sandbox.public_headers.implode!
|
193
|
+
pod_targets.each do |pod_target|
|
194
|
+
pod_target.build_headers.implode!
|
195
|
+
end
|
191
196
|
|
192
197
|
unless sandbox_state.deleted.empty?
|
193
198
|
title_options = { :verbose_prefix => "-> ".red }
|
@@ -203,13 +208,15 @@ module Pod
|
|
203
208
|
# created by the Pod source installer as well.
|
204
209
|
#
|
205
210
|
def create_file_accessors
|
206
|
-
|
207
|
-
|
208
|
-
pod_root = sandbox.pod_dir(
|
211
|
+
aggregate_targets.each do |target|
|
212
|
+
target.pod_targets.each do |pod_target|
|
213
|
+
pod_root = sandbox.pod_dir(pod_target.root_spec.name)
|
209
214
|
path_list = Sandbox::PathList.new(pod_root)
|
210
|
-
|
211
|
-
|
212
|
-
|
215
|
+
file_accessors = pod_target.specs.map do |spec|
|
216
|
+
Sandbox::FileAccessor.new(path_list, spec.consumer(pod_target.platform))
|
217
|
+
end
|
218
|
+
pod_target.file_accessors ||= []
|
219
|
+
pod_target.file_accessors.concat(file_accessors)
|
213
220
|
end
|
214
221
|
end
|
215
222
|
end
|
@@ -242,12 +249,10 @@ module Pod
|
|
242
249
|
#
|
243
250
|
def install_source_of_pod(pod_name)
|
244
251
|
specs_by_platform = {}
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
specs_by_platform[library.platform] ||= []
|
250
|
-
specs_by_platform[library.platform].concat(specs)
|
252
|
+
pod_targets.each do |pod_target|
|
253
|
+
if pod_target.root_spec.name == pod_name
|
254
|
+
specs_by_platform[pod_target.platform] ||= []
|
255
|
+
specs_by_platform[pod_target.platform].concat(pod_target.specs)
|
251
256
|
end
|
252
257
|
end
|
253
258
|
|
@@ -284,7 +289,7 @@ module Pod
|
|
284
289
|
@pods_project.add_podfile(config.podfile_path)
|
285
290
|
end
|
286
291
|
sandbox.project = @pods_project
|
287
|
-
platforms =
|
292
|
+
platforms = aggregate_targets.map(&:platform)
|
288
293
|
osx_deployment_target = platforms.select { |p| p.name == :osx }.map(&:deployment_target).min
|
289
294
|
ios_deployment_target = platforms.select { |p| p.name == :ios }.map(&:deployment_target).min
|
290
295
|
@pods_project.build_configurations.each do |build_configuration|
|
@@ -296,30 +301,53 @@ module Pod
|
|
296
301
|
|
297
302
|
|
298
303
|
# Installs the file references in the Pods project. This is done once per
|
299
|
-
# Pod as the same file reference might be shared by multiple
|
304
|
+
# Pod as the same file reference might be shared by multiple aggregate
|
305
|
+
# targets.
|
300
306
|
#
|
301
307
|
# @return [void]
|
302
308
|
#
|
303
309
|
def install_file_references
|
304
|
-
installer = FileReferencesInstaller.new(sandbox,
|
310
|
+
installer = FileReferencesInstaller.new(sandbox, pod_targets, pods_project)
|
305
311
|
installer.install!
|
306
312
|
end
|
307
313
|
|
308
|
-
# Installs the targets of the Pods projects and generates their
|
309
|
-
# files.
|
314
|
+
# Installs the aggregate targets of the Pods projects and generates their
|
315
|
+
# support files.
|
310
316
|
#
|
311
317
|
# @return [void]
|
312
318
|
#
|
313
|
-
def
|
314
|
-
UI.message"- Installing
|
315
|
-
|
316
|
-
next if
|
317
|
-
target_installer =
|
319
|
+
def install_libraries
|
320
|
+
UI.message"- Installing libraries" do
|
321
|
+
pod_targets.sort_by(&:name).each do |pod_target|
|
322
|
+
next if pod_target.target_definition.empty?
|
323
|
+
target_installer = PodTargetInstaller.new(sandbox, pod_target)
|
324
|
+
target_installer.install!
|
325
|
+
end
|
326
|
+
|
327
|
+
aggregate_targets.sort_by(&:name).each do |target|
|
328
|
+
next if target.target_definition.empty?
|
329
|
+
target_installer = AggregateTargetInstaller.new(sandbox, target)
|
318
330
|
target_installer.install!
|
319
331
|
end
|
320
332
|
end
|
321
333
|
end
|
322
334
|
|
335
|
+
# Links the aggregate targets with all the dependent libraries.
|
336
|
+
#
|
337
|
+
# @note This is run in the integration step to ensure that targets
|
338
|
+
# have been created for all per spec libraries.
|
339
|
+
#
|
340
|
+
def link_aggregate_target
|
341
|
+
aggregate_targets.each do |aggregate_target|
|
342
|
+
native_target = pods_project.targets.select { |t| t.name == aggregate_target.name }.first
|
343
|
+
products = pods_project.products_group
|
344
|
+
aggregate_target.pod_targets.each do |pod_target|
|
345
|
+
product = products.files.select { |f| f.path == pod_target.product_name }.first
|
346
|
+
native_target.frameworks_build_phase.add_file_reference(product)
|
347
|
+
end
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
323
351
|
# Writes the Pods project to the disk.
|
324
352
|
#
|
325
353
|
# @return [void]
|
@@ -364,9 +392,9 @@ module Pod
|
|
364
392
|
# information in the lockfile.
|
365
393
|
#
|
366
394
|
def integrate_user_project
|
367
|
-
UI.section "Integrating client #{'project'.pluralize(
|
395
|
+
UI.section "Integrating client #{'project'.pluralize(aggregate_targets.map(&:user_project_path).uniq.count) }" do
|
368
396
|
installation_root = config.installation_root
|
369
|
-
integrator = UserProjectIntegrator.new(podfile, sandbox, installation_root,
|
397
|
+
integrator = UserProjectIntegrator.new(podfile, sandbox, installation_root, aggregate_targets)
|
370
398
|
integrator.integrate!
|
371
399
|
end
|
372
400
|
end
|
@@ -512,7 +540,7 @@ module Pod
|
|
512
540
|
# @return [PodRepresentation] The pod representation.
|
513
541
|
#
|
514
542
|
def pod_rep(pod)
|
515
|
-
all_file_accessors =
|
543
|
+
all_file_accessors = pod_targets.map(&:file_accessors).flatten.compact
|
516
544
|
file_accessors = all_file_accessors.select { |fa| fa.spec.root.name == pod }
|
517
545
|
Hooks::PodRepresentation.new(pod, file_accessors)
|
518
546
|
end
|
@@ -526,7 +554,7 @@ module Pod
|
|
526
554
|
# @return [Array<LibraryRepresentation>]
|
527
555
|
#
|
528
556
|
def library_reps
|
529
|
-
@library_reps ||=
|
557
|
+
@library_reps ||= pod_targets.map { |lib| library_rep(lib) }
|
530
558
|
end
|
531
559
|
|
532
560
|
# @return [Array<PodRepresentation>]
|
@@ -543,7 +571,14 @@ module Pod
|
|
543
571
|
# @return [Array<Library>] The library.
|
544
572
|
#
|
545
573
|
def libraries_using_spec(spec)
|
546
|
-
|
574
|
+
pod_targets.select { |pod_target| pod_target.specs.include?(spec) }
|
575
|
+
end
|
576
|
+
|
577
|
+
# @return [Array<Library>] The libraries generated by the installation
|
578
|
+
# process.
|
579
|
+
#
|
580
|
+
def pod_targets
|
581
|
+
aggregate_targets.map(&:pod_targets).flatten
|
547
582
|
end
|
548
583
|
|
549
584
|
#-------------------------------------------------------------------------#
|