cocoapods-bin 0.1.24 → 0.1.25
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 +4 -4
- data/Gemfile.lock +2 -2
- data/lib/cocoapods-bin.rb +3 -1
- data/lib/cocoapods-bin/command.rb +2 -0
- data/lib/cocoapods-bin/command/bin.rb +4 -2
- data/lib/cocoapods-bin/command/bin/archive.rb +21 -15
- data/lib/cocoapods-bin/command/bin/init.rb +14 -9
- data/lib/cocoapods-bin/command/bin/lib.rb +3 -1
- data/lib/cocoapods-bin/command/bin/lib/lint.rb +13 -9
- data/lib/cocoapods-bin/command/bin/list.rb +16 -12
- data/lib/cocoapods-bin/command/bin/open.rb +10 -8
- data/lib/cocoapods-bin/command/bin/repo.rb +3 -1
- data/lib/cocoapods-bin/command/bin/repo/push.rb +22 -14
- data/lib/cocoapods-bin/command/bin/repo/update.rb +6 -4
- data/lib/cocoapods-bin/command/bin/search.rb +9 -7
- data/lib/cocoapods-bin/command/bin/spec.rb +3 -1
- data/lib/cocoapods-bin/command/bin/spec/create.rb +15 -8
- data/lib/cocoapods-bin/command/bin/spec/lint.rb +18 -10
- data/lib/cocoapods-bin/command/bin/umbrella.rb +13 -7
- data/lib/cocoapods-bin/config/config.rb +18 -14
- data/lib/cocoapods-bin/config/config_asker.rb +22 -19
- data/lib/cocoapods-bin/gem_version.rb +5 -3
- data/lib/cocoapods-bin/helpers.rb +2 -0
- data/lib/cocoapods-bin/helpers/framework.rb +5 -3
- data/lib/cocoapods-bin/helpers/framework_builder.rb +31 -24
- data/lib/cocoapods-bin/helpers/sources_helper.rb +6 -4
- data/lib/cocoapods-bin/helpers/spec_creator.rb +28 -18
- data/lib/cocoapods-bin/helpers/spec_files_helper.rb +28 -15
- data/lib/cocoapods-bin/native.rb +16 -14
- data/lib/cocoapods-bin/native/acknowledgements.rb +5 -2
- data/lib/cocoapods-bin/native/analyzer.rb +6 -5
- data/lib/cocoapods-bin/native/installation_options.rb +13 -11
- data/lib/cocoapods-bin/native/installer.rb +54 -47
- data/lib/cocoapods-bin/native/linter.rb +4 -2
- data/lib/cocoapods-bin/native/path_source.rb +9 -7
- data/lib/cocoapods-bin/native/pod_source_installer.rb +10 -6
- data/lib/cocoapods-bin/native/podfile.rb +11 -7
- data/lib/cocoapods-bin/native/podfile_env.rb +11 -9
- data/lib/cocoapods-bin/native/podspec_finder.rb +3 -0
- data/lib/cocoapods-bin/native/resolver.rb +65 -45
- data/lib/cocoapods-bin/native/sandbox_analyzer.rb +27 -25
- data/lib/cocoapods-bin/native/source.rb +7 -4
- data/lib/cocoapods-bin/native/sources_manager.rb +11 -9
- data/lib/cocoapods-bin/native/specification.rb +14 -12
- data/lib/cocoapods-bin/native/validator.rb +3 -3
- data/lib/cocoapods-bin/source_provider_hook.rb +12 -8
- data/lib/cocoapods_plugin.rb +2 -0
- metadata +3 -3
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'parallel'
|
2
4
|
require 'cocoapods'
|
3
5
|
|
4
6
|
module Pod
|
5
7
|
class Installer
|
6
8
|
class Analyzer
|
7
|
-
|
8
9
|
# > 1.6.0
|
9
10
|
# all_specs[dep.name] 为 nil 会崩溃
|
10
11
|
# 主要原因是 all_specs 分析错误
|
@@ -29,13 +30,13 @@ module Pod
|
|
29
30
|
# > 1.5.3 版本
|
30
31
|
# rewrite update_repositories
|
31
32
|
#
|
32
|
-
|
33
|
+
alias old_update_repositories update_repositories
|
33
34
|
def update_repositories
|
34
35
|
if installation_options.update_source_with_multi_processes
|
35
36
|
# 并发更新私有源
|
36
37
|
# 这里多线程会导致 pod update 额外输出 --verbose 的内容
|
37
38
|
# 不知道为什么?
|
38
|
-
Parallel.each(sources.uniq
|
39
|
+
Parallel.each(sources.uniq(&:url), in_processes: 4) do |source|
|
39
40
|
if source.git?
|
40
41
|
config.sources_manager.update(source.name, true)
|
41
42
|
else
|
@@ -43,10 +44,10 @@ module Pod
|
|
43
44
|
end
|
44
45
|
end
|
45
46
|
@specs_updated = true
|
46
|
-
else
|
47
|
+
else
|
47
48
|
old_update_repositories
|
48
49
|
end
|
49
50
|
end
|
50
51
|
end
|
51
52
|
end
|
52
|
-
end
|
53
|
+
end
|
@@ -1,24 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cocoapods'
|
2
4
|
|
3
5
|
module Pod
|
4
6
|
class Installer
|
5
7
|
class InstallationOptions
|
6
|
-
def self.env_option(key, default = true)
|
8
|
+
def self.env_option(key, default = true)
|
7
9
|
option key, ENV[key.to_s].nil? ? default : ENV[key.to_s] == 'true'
|
8
10
|
end
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
|
12
|
+
# 不同 source 存在相同 spec 名时,默认不警告
|
13
|
+
defaults.delete('warn_for_multiple_pod_sources')
|
14
|
+
env_option :warn_for_multiple_pod_sources, false
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
+
# 是否警告不安全 source (如 http )
|
17
|
+
env_option :warn_for_unsecure_source, false
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
# 是否多线程执行 install_pod_sources
|
20
|
+
env_option :install_with_multi_threads, true
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
+
# 是否多进程执行 update_repositories
|
23
|
+
env_option :update_source_with_multi_processes, true
|
22
24
|
end
|
23
25
|
end
|
24
|
-
end
|
26
|
+
end
|
@@ -1,37 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'parallel'
|
2
4
|
require 'cocoapods'
|
3
5
|
require 'cocoapods-bin/native/pod_source_installer'
|
4
6
|
|
5
7
|
module Pod
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
class Installer
|
9
|
+
alias old_create_pod_installer create_pod_installer
|
10
|
+
def create_pod_installer(pod_name)
|
11
|
+
installer = old_create_pod_installer(pod_name)
|
12
|
+
installer.installation_options = installation_options
|
13
|
+
installer
|
14
|
+
end
|
13
15
|
|
14
|
-
|
16
|
+
alias old_install_pod_sources install_pod_sources
|
15
17
|
def install_pod_sources
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
if installation_options.install_with_multi_threads
|
19
|
+
if Pod.match_version?('~> 1.4.0')
|
20
|
+
install_pod_sources_for_version_in_1_4_0
|
21
|
+
elsif Pod.match_version?('~> 1.5')
|
22
|
+
install_pod_sources_for_version_above_1_5_0
|
23
|
+
else
|
24
|
+
old_install_pod_sources
|
25
|
+
end
|
24
26
|
else
|
25
|
-
|
26
|
-
|
27
|
+
old_install_pod_sources
|
28
|
+
end
|
27
29
|
end
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
@installed_specs = []
|
31
|
+
# rewrite install_pod_sources
|
32
|
+
def install_pod_sources_for_version_in_1_4_0
|
33
|
+
@installed_specs = []
|
33
34
|
pods_to_install = sandbox_state.added | sandbox_state.changed
|
34
|
-
title_options = { :
|
35
|
+
title_options = { verbose_prefix: '-> '.green }
|
35
36
|
Parallel.each(root_specs.sort_by(&:name), in_threads: 4) do |spec|
|
36
37
|
if pods_to_install.include?(spec.name)
|
37
38
|
if sandbox_state.changed.include?(spec.name) && sandbox.manifest
|
@@ -49,12 +50,12 @@ module Pod
|
|
49
50
|
end
|
50
51
|
end
|
51
52
|
end
|
52
|
-
|
53
|
+
end
|
53
54
|
|
54
|
-
|
55
|
-
|
55
|
+
def install_pod_sources_for_version_above_1_5_0
|
56
|
+
@installed_specs = []
|
56
57
|
pods_to_install = sandbox_state.added | sandbox_state.changed
|
57
|
-
title_options = { :
|
58
|
+
title_options = { verbose_prefix: '-> '.green }
|
58
59
|
# 多进程下载,多线程时 log 会显著交叉,多进程好点,但是多进程需要利用文件锁对 cache 进行保护
|
59
60
|
# in_processes: 10
|
60
61
|
Parallel.each(root_specs.sort_by(&:name), in_threads: 4) do |spec|
|
@@ -63,14 +64,22 @@ module Pod
|
|
63
64
|
current_version = spec.version
|
64
65
|
previous_version = sandbox.manifest.version(spec.name)
|
65
66
|
has_changed_version = current_version != previous_version
|
66
|
-
current_repo = analysis_result.specs_by_source.detect
|
67
|
+
current_repo = analysis_result.specs_by_source.detect do |key, values|
|
68
|
+
break key if values.map(&:name).include?(spec.name)
|
69
|
+
end
|
67
70
|
current_repo &&= current_repo.url || current_repo.name
|
68
71
|
previous_spec_repo = sandbox.manifest.spec_repo(spec.name)
|
69
72
|
has_changed_repo = !previous_spec_repo.nil? && current_repo && (current_repo != previous_spec_repo)
|
70
73
|
title = "Installing #{spec.name} #{spec.version}"
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
+
if has_changed_version && has_changed_repo
|
75
|
+
title << " (was #{previous_version} and source changed to `#{current_repo}` from `#{previous_spec_repo}`)"
|
76
|
+
end
|
77
|
+
if has_changed_version && !has_changed_repo
|
78
|
+
title << " (was #{previous_version})"
|
79
|
+
end
|
80
|
+
if !has_changed_version && has_changed_repo
|
81
|
+
title << " (source changed to `#{current_repo}` from `#{previous_spec_repo}`)"
|
82
|
+
end
|
74
83
|
else
|
75
84
|
title = "Installing #{spec}"
|
76
85
|
end
|
@@ -83,26 +92,24 @@ module Pod
|
|
83
92
|
end
|
84
93
|
end
|
85
94
|
end
|
86
|
-
|
87
|
-
|
88
|
-
end
|
95
|
+
end
|
96
|
+
end
|
89
97
|
|
90
98
|
module Downloader
|
91
99
|
class Cache
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
# 后面如果要切到进程的话,可以在 cache root 里面新建一个文件
|
96
|
-
# 利用这个文件 lock
|
97
|
-
# https://stackoverflow.com/questions/23748648/using-fileflock-as-ruby-global-lock-mutex-for-processes
|
100
|
+
# 多线程锁
|
101
|
+
@@lock = Mutex.new
|
98
102
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
def ensure_matching_version
|
103
|
-
@@lock.synchronize { old_ensure_matching_version }
|
104
|
-
end
|
103
|
+
# 后面如果要切到进程的话,可以在 cache root 里面新建一个文件
|
104
|
+
# 利用这个文件 lock
|
105
|
+
# https://stackoverflow.com/questions/23748648/using-fileflock-as-ruby-global-lock-mutex-for-processes
|
105
106
|
|
107
|
+
# rmtree 在多进程情况下可能 Directory not empty @ dir_s_rmdir 错误
|
108
|
+
# old_ensure_matching_version 会移除不是同一个 CocoaPods 版本的组件缓存
|
109
|
+
alias old_ensure_matching_version ensure_matching_version
|
110
|
+
def ensure_matching_version
|
111
|
+
@@lock.synchronize { old_ensure_matching_version }
|
112
|
+
end
|
106
113
|
end
|
107
114
|
end
|
108
|
-
end
|
115
|
+
end
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cocoapods-bin/native/specification'
|
2
4
|
|
3
5
|
module Pod
|
4
6
|
class Specification
|
5
7
|
class Linter
|
6
|
-
|
8
|
+
# !@group Lint steps
|
7
9
|
|
8
10
|
# Checks that the spec's root name matches the filename.
|
9
11
|
#
|
@@ -21,4 +23,4 @@ module Pod
|
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
24
|
-
end
|
26
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cocoapods-bin/native/specification'
|
2
4
|
|
3
5
|
module Pod
|
@@ -12,12 +14,12 @@ module Pod
|
|
12
14
|
if extension == '.podspec' || extension == '.json'
|
13
15
|
path_with_ext = declared_path
|
14
16
|
else
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
# 默认先从 binary podspec 找起,因为 binary podspec 的 subspec 可能比 code podspec 多
|
18
|
+
# 这里可能出现 code subspec 和 binary subspec 对应不上的情况,导致 lint 失败
|
19
|
+
# 所以不要在 code podspec 同一目录下保留 binary podspec
|
20
|
+
path_with_ext = Specification::VALID_EXTNAME
|
21
|
+
.map { |extname| "#{declared_path}/#{name}#{extname}" }
|
22
|
+
.find { |file| File.exist?(file) } || "#{declared_path}/#{name}.podspec"
|
21
23
|
end
|
22
24
|
|
23
25
|
UI.message "获取的 podspec 路径为 `#{path_with_ext}`"
|
@@ -28,4 +30,4 @@ module Pod
|
|
28
30
|
end
|
29
31
|
end
|
30
32
|
end
|
31
|
-
end
|
33
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cocoapods-bin/native/installation_options'
|
2
4
|
|
3
5
|
module Pod
|
@@ -5,11 +7,13 @@ module Pod
|
|
5
7
|
class PodSourceInstaller
|
6
8
|
attr_accessor :installation_options
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
alias old_verify_source_is_secure verify_source_is_secure
|
11
|
+
def verify_source_is_secure(root_spec)
|
12
|
+
# http source 默认不警告
|
13
|
+
if installation_options.warn_for_unsecure_source?
|
14
|
+
old_verify_source_is_secure(root_spec)
|
15
|
+
end
|
16
|
+
end
|
13
17
|
end
|
14
18
|
end
|
15
|
-
end
|
19
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cocoapods'
|
2
4
|
require 'cocoapods-bin/native/podfile_env'
|
3
5
|
|
@@ -27,15 +29,14 @@ module Pod
|
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
30
|
-
|
32
|
+
alias old_plugins plugins
|
31
33
|
def plugins
|
32
34
|
if ENV[USE_PLUGINS]
|
33
|
-
env_plugins = ENV[USE_PLUGINS].split(',').
|
34
|
-
result[name] = {}
|
35
|
-
result
|
35
|
+
env_plugins = ENV[USE_PLUGINS].split(',').each_with_object({}) do |name, result|
|
36
|
+
result[name] = {}
|
36
37
|
end
|
37
38
|
env_plugins.merge!(old_plugins)
|
38
|
-
else
|
39
|
+
else
|
39
40
|
old_plugins
|
40
41
|
end
|
41
42
|
end
|
@@ -57,8 +58,11 @@ module Pod
|
|
57
58
|
end
|
58
59
|
|
59
60
|
private
|
61
|
+
|
60
62
|
def valid_bin_plugin
|
61
|
-
|
63
|
+
unless plugins.keys.include?('cocoapods-bin')
|
64
|
+
raise Pod::Informative, 'You should add `plugin \'cocoapods-bin\'` before using its DSL'
|
65
|
+
end
|
62
66
|
end
|
63
67
|
|
64
68
|
# set_hash_value 有 key 限制
|
@@ -72,4 +76,4 @@ module Pod
|
|
72
76
|
internal_hash.fetch(key, default)
|
73
77
|
end
|
74
78
|
end
|
75
|
-
end
|
79
|
+
end
|
@@ -1,25 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Pod
|
2
4
|
class Podfile
|
3
|
-
USE_BINARIES = 'use_binaries'
|
4
|
-
USE_SOURCE_PODS = 'use_source_pods'
|
5
|
-
USE_BINARIES_SELECTOR = 'use_binaries_selector'
|
6
|
-
ALLOW_PRERELEASE = 'allow_prerelease'
|
7
|
-
USE_PLUGINS = 'use_plugins'
|
5
|
+
USE_BINARIES = 'use_binaries'
|
6
|
+
USE_SOURCE_PODS = 'use_source_pods'
|
7
|
+
USE_BINARIES_SELECTOR = 'use_binaries_selector'
|
8
|
+
ALLOW_PRERELEASE = 'allow_prerelease'
|
9
|
+
USE_PLUGINS = 'use_plugins'
|
8
10
|
|
9
11
|
module ENVExecutor
|
10
12
|
def execute_with_bin_plugin(&block)
|
11
|
-
execute_with_key(USE_PLUGINS, -> {'cocoapods-bin'}, &block)
|
13
|
+
execute_with_key(USE_PLUGINS, -> { 'cocoapods-bin' }, &block)
|
12
14
|
end
|
13
15
|
|
14
16
|
def execute_with_allow_prerelease(allow_prerelease, &block)
|
15
17
|
execute_with_key(ALLOW_PRERELEASE, -> { allow_prerelease ? 'true' : 'false' }, &block)
|
16
18
|
end
|
17
|
-
|
19
|
+
|
18
20
|
def execute_with_use_binaries(use_binaries, &block)
|
19
21
|
execute_with_key(USE_BINARIES, -> { use_binaries ? 'true' : 'false' }, &block)
|
20
22
|
end
|
21
23
|
|
22
|
-
def execute_with_key(key, value_returner
|
24
|
+
def execute_with_key(key, value_returner)
|
23
25
|
origin_value = ENV[key]
|
24
26
|
ENV[key] = value_returner.call
|
25
27
|
|
@@ -31,4 +33,4 @@ module Pod
|
|
31
33
|
|
32
34
|
extend ENVExecutor
|
33
35
|
end
|
34
|
-
end
|
36
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cocoapods-bin/native/specification'
|
2
4
|
|
3
5
|
module Pod
|
@@ -5,6 +7,7 @@ module Pod
|
|
5
7
|
class PodspecFinder
|
6
8
|
def podspecs
|
7
9
|
return @specs_by_name if @specs_by_name
|
10
|
+
|
8
11
|
@specs_by_name = {}
|
9
12
|
spec_files = Pathname.glob(root + '{,*}.podspec{,.json}')
|
10
13
|
# pod 指向分支时,如果目标组件有 subspec ,并且有 template spec ,request 之后使用的 spec 不应该为 template spec
|
@@ -1,13 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'parallel'
|
4
|
+
require 'cocoapods'
|
5
|
+
require 'cocoapods-bin/native/podfile'
|
6
|
+
require 'cocoapods-bin/native/sources_manager'
|
7
|
+
require 'cocoapods-bin/native/installation_options'
|
8
|
+
require 'cocoapods-bin/gem_version'
|
7
9
|
|
8
10
|
module Pod
|
9
11
|
class Resolver
|
10
|
-
if Pod.match_version?(
|
12
|
+
if Pod.match_version?('~> 1.6')
|
11
13
|
# 其实不用到 resolver_specs_by_target 再改 spec
|
12
14
|
# 在这个方法里面,通过修改 dependency 的 source 应该也可以
|
13
15
|
# 就是有一点,如果改了之后,对应的 source 没有符合 dependency 的版本
|
@@ -16,7 +18,7 @@ module Pod
|
|
16
18
|
#
|
17
19
|
def aggregate_for_dependency(dependency)
|
18
20
|
sources_manager = Config.instance.sources_manager
|
19
|
-
if dependency
|
21
|
+
if dependency&.podspec_repo
|
20
22
|
sources_manager.aggregate_for_dependency(dependency)
|
21
23
|
# 采用 lock 中的 source ,会导致插件对 source 的先后调整失效
|
22
24
|
# elsif (locked_vertex = @locked_dependencies.vertex_named(dependency.name)) && (locked_dependency = locked_vertex.payload) && locked_dependency.podspec_repo
|
@@ -27,48 +29,59 @@ module Pod
|
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
30
|
-
if Pod.match_version?(
|
32
|
+
if Pod.match_version?('~> 1.4')
|
31
33
|
def specifications_for_dependency(dependency, additional_requirements_frozen = [])
|
32
34
|
additional_requirements = additional_requirements_frozen.dup
|
33
35
|
additional_requirements.compact!
|
34
36
|
requirement = Requirement.new(dependency.requirement.as_list + additional_requirements.flat_map(&:as_list))
|
35
|
-
|
36
|
-
|
37
|
-
if Pod.match_version?("~> 1.7")
|
38
|
-
options = podfile.installation_options
|
39
|
-
else
|
40
|
-
options = installation_options
|
37
|
+
if podfile.allow_prerelease? && !requirement.prerelease?
|
38
|
+
requirement = Requirement.new(dependency.requirement.as_list.map { |r| r + '.a' } + additional_requirements.flat_map(&:as_list))
|
41
39
|
end
|
42
40
|
|
43
|
-
if Pod.match_version?(
|
44
|
-
|
45
|
-
|
41
|
+
options = if Pod.match_version?('~> 1.7')
|
42
|
+
podfile.installation_options
|
43
|
+
else
|
44
|
+
installation_options
|
45
|
+
end
|
46
|
+
|
47
|
+
if Pod.match_version?('~> 1.8')
|
48
|
+
specifications = find_cached_set(dependency)
|
49
|
+
.all_specifications(options.warn_for_multiple_pod_sources, requirement)
|
46
50
|
else
|
47
|
-
specifications = find_cached_set(dependency)
|
48
|
-
|
51
|
+
specifications = find_cached_set(dependency)
|
52
|
+
.all_specifications(options.warn_for_multiple_pod_sources)
|
49
53
|
end
|
50
54
|
|
51
|
-
specifications
|
52
|
-
map { |s| s.subspec_by_name(dependency.name, false, true) }
|
53
|
-
compact
|
55
|
+
specifications
|
56
|
+
.map { |s| s.subspec_by_name(dependency.name, false, true) }
|
57
|
+
.compact
|
54
58
|
end
|
55
59
|
end
|
56
60
|
|
57
|
-
if Pod.match_version?(
|
58
|
-
|
61
|
+
if Pod.match_version?('~> 1.6')
|
62
|
+
alias old_valid_possibility_version_for_root_name? valid_possibility_version_for_root_name?
|
59
63
|
|
60
64
|
def valid_possibility_version_for_root_name?(requirement, activated, spec)
|
61
65
|
return true if podfile.allow_prerelease?
|
66
|
+
|
62
67
|
old_valid_possibility_version_for_root_name?(requirement, activated, spec)
|
63
68
|
end
|
64
|
-
elsif Pod.match_version?(
|
69
|
+
elsif Pod.match_version?('~> 1.4')
|
65
70
|
def requirement_satisfied_by?(requirement, activated, spec)
|
66
71
|
version = spec.version
|
67
72
|
return false unless requirement.requirement.satisfied_by?(version)
|
73
|
+
|
68
74
|
shared_possibility_versions, prerelease_requirement = possibility_versions_for_root_name(requirement, activated)
|
69
|
-
|
70
|
-
|
71
|
-
|
75
|
+
if !shared_possibility_versions.empty? && !shared_possibility_versions.include?(version)
|
76
|
+
return false
|
77
|
+
end
|
78
|
+
if !podfile.allow_prerelease? && version.prerelease? && !prerelease_requirement
|
79
|
+
return false
|
80
|
+
end
|
81
|
+
unless spec_is_platform_compatible?(activated, requirement, spec)
|
82
|
+
return false
|
83
|
+
end
|
84
|
+
|
72
85
|
true
|
73
86
|
end
|
74
87
|
end
|
@@ -76,10 +89,10 @@ module Pod
|
|
76
89
|
# >= 1.4.0 才有 resolver_specs_by_target 以及 ResolverSpecification
|
77
90
|
# >= 1.5.0 ResolverSpecification 才有 source,供 install 或者其他操作时,输入 source 变更
|
78
91
|
#
|
79
|
-
if Pod.match_version?(
|
92
|
+
if Pod.match_version?('~> 1.4')
|
80
93
|
old_resolver_specs_by_target = instance_method(:resolver_specs_by_target)
|
81
94
|
define_method(:resolver_specs_by_target) do
|
82
|
-
specs_by_target = old_resolver_specs_by_target.bind(self).call
|
95
|
+
specs_by_target = old_resolver_specs_by_target.bind(self).call
|
83
96
|
|
84
97
|
sources_manager = Config.instance.sources_manager
|
85
98
|
use_source_pods = podfile.use_source_pods
|
@@ -90,7 +103,7 @@ module Pod
|
|
90
103
|
use_binary_rspecs = if podfile.use_binaries? || podfile.use_binaries_selector
|
91
104
|
rspecs.select do |rspec|
|
92
105
|
([rspec.name, rspec.root.name] & use_source_pods).empty? &&
|
93
|
-
|
106
|
+
(podfile.use_binaries_selector.nil? || podfile.use_binaries_selector.call(rspec.spec))
|
94
107
|
end
|
95
108
|
else
|
96
109
|
[]
|
@@ -102,7 +115,9 @@ module Pod
|
|
102
115
|
# next rspec if rspec.spec.subspec? || rspec.spec.subspecs.any?
|
103
116
|
|
104
117
|
# developments 组件采用默认输入的 spec (development pods 的 source 为 nil)
|
105
|
-
|
118
|
+
unless rspec.spec.respond_to?(:spec_source) && rspec.spec.spec_source
|
119
|
+
next rspec
|
120
|
+
end
|
106
121
|
|
107
122
|
# 采用二进制依赖并且不为开发组件
|
108
123
|
use_binary = use_binary_rspecs.include?(rspec)
|
@@ -117,25 +132,27 @@ module Pod
|
|
117
132
|
specification = source.specification(rspec.root.name, spec_version)
|
118
133
|
|
119
134
|
# 组件是 subspec
|
120
|
-
|
135
|
+
if rspec.spec.subspec?
|
136
|
+
specification = specification.subspec_by_name(rspec.name, false, true)
|
137
|
+
end
|
121
138
|
# 这里可能出现分析依赖的 source 和切换后的 source 对应 specification 的 subspec 对应不上
|
122
139
|
# 造成 subspec_by_name 返回 nil,这个是正常现象
|
123
140
|
next unless specification
|
124
141
|
|
125
|
-
if Pod.match_version?(
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
142
|
+
used_by_only = if Pod.match_version?('~> 1.7')
|
143
|
+
rspec.used_by_non_library_targets_only
|
144
|
+
else
|
145
|
+
rspec.used_by_tests_only
|
146
|
+
end
|
130
147
|
# used_by_only = rspec.respond_to?(:used_by_tests_only) ? rspec.used_by_tests_only : rspec.used_by_non_library_targets_only
|
131
148
|
# 组装新的 rspec ,替换原 rspec
|
132
|
-
rspec = if Pod.match_version?(
|
149
|
+
rspec = if Pod.match_version?('~> 1.4.0')
|
133
150
|
ResolverSpecification.new(specification, used_by_only)
|
134
151
|
else
|
135
152
|
ResolverSpecification.new(specification, used_by_only, source)
|
136
153
|
end
|
137
154
|
rspec
|
138
|
-
rescue Pod::StandardError =>
|
155
|
+
rescue Pod::StandardError => e
|
139
156
|
# 没有从新的 source 找到对应版本组件,直接返回原 rspec
|
140
157
|
missing_binary_specs << rspec.spec if use_binary
|
141
158
|
rspec
|
@@ -145,16 +162,18 @@ module Pod
|
|
145
162
|
end.compact
|
146
163
|
end
|
147
164
|
|
148
|
-
missing_binary_specs.
|
149
|
-
|
150
|
-
|
165
|
+
if missing_binary_specs.any?
|
166
|
+
missing_binary_specs.uniq.each do |spec|
|
167
|
+
UI.message "【#{spec.name} | #{spec.version}】组件无对应二进制版本 , 将采用源码依赖."
|
168
|
+
end
|
169
|
+
end
|
151
170
|
|
152
171
|
specs_by_target
|
153
172
|
end
|
154
173
|
end
|
155
174
|
end
|
156
175
|
|
157
|
-
if Pod.match_version?(
|
176
|
+
if Pod.match_version?('~> 1.4.0')
|
158
177
|
# 1.4.0 没有 spec_source
|
159
178
|
class Specification
|
160
179
|
class Set
|
@@ -170,6 +189,7 @@ module Pod
|
|
170
189
|
|
171
190
|
def respond_to?(method, include_all = false)
|
172
191
|
return super unless method == :spec_source
|
192
|
+
|
173
193
|
true
|
174
194
|
end
|
175
195
|
end
|