cocoapods-binary-matchup 0.0.7 → 0.0.15
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 +161 -0
- data/README.md +15 -4
- data/cocoapods-binary-matchup.gemspec +1 -1
- data/lib/cocoapods-binary-matchup/Integration.rb +7 -11
- data/lib/cocoapods-binary-matchup/Integration_cache.rb +42 -148
- data/lib/cocoapods-binary-matchup/Main.rb +10 -5
- data/lib/cocoapods-binary-matchup/Prebuild.rb +4 -0
- data/lib/cocoapods-binary-matchup/gem_version.rb +1 -1
- data/lib/cocoapods-binary-matchup/helper/feature_switches.rb +6 -1
- data/lib/cocoapods-binary-matchup/helper/podfile_options.rb +4 -2
- data/lib/cocoapods-binary-matchup/rome/build_framework.rb +2 -2
- data/spec/plugin_spec.rb +54 -0
- data/spec/spec_helper.rb +1 -1
- metadata +6 -4
- data/cocoapods-binary-matchup-0.0.6.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fece0a9ebc431cab6345ee1f7e5ed505ac49b5326248b3240d98e5620bd2ff1a
|
4
|
+
data.tar.gz: 01aba47a154241f25fc9fb9160b9dfc671b4629976abc1f8062c9f3b962026c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e735c25acc5e4eea62085c276e1fa9d47cb37ee1316ccf0a9333c420134e39c03c88315839278d8e859fbdec7dac481201c93138df5accfe415de4aab08436cd
|
7
|
+
data.tar.gz: 9f69eb604b8bd504ae381888754e7e78d4b9bb5e1beda1780cd9136c57ac11ee78d3d654d19c20a69049f110d02e67d9edefdc9845c748db0bd920a01862d1ad
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cocoapods-binary-matchup (0.0.14)
|
5
|
+
cocoapods (>= 1.5.0, < 2.0)
|
6
|
+
fourflusher (~> 2.0)
|
7
|
+
xcpretty (~> 0.3.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
CFPropertyList (3.0.7)
|
13
|
+
base64
|
14
|
+
nkf
|
15
|
+
rexml
|
16
|
+
activesupport (7.2.2.1)
|
17
|
+
base64
|
18
|
+
benchmark (>= 0.3)
|
19
|
+
bigdecimal
|
20
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
21
|
+
connection_pool (>= 2.2.5)
|
22
|
+
drb
|
23
|
+
i18n (>= 1.6, < 2)
|
24
|
+
logger (>= 1.4.2)
|
25
|
+
minitest (>= 5.1)
|
26
|
+
securerandom (>= 0.3)
|
27
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
28
|
+
addressable (2.8.7)
|
29
|
+
public_suffix (>= 2.0.2, < 7.0)
|
30
|
+
algoliasearch (1.27.5)
|
31
|
+
httpclient (~> 2.8, >= 2.8.3)
|
32
|
+
json (>= 1.5.1)
|
33
|
+
atomos (0.1.3)
|
34
|
+
bacon (1.2.0)
|
35
|
+
base64 (0.3.0)
|
36
|
+
benchmark (0.4.1)
|
37
|
+
bigdecimal (3.2.2)
|
38
|
+
claide (1.1.0)
|
39
|
+
cocoapods (1.16.2)
|
40
|
+
addressable (~> 2.8)
|
41
|
+
claide (>= 1.0.2, < 2.0)
|
42
|
+
cocoapods-core (= 1.16.2)
|
43
|
+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
44
|
+
cocoapods-downloader (>= 2.1, < 3.0)
|
45
|
+
cocoapods-plugins (>= 1.0.0, < 2.0)
|
46
|
+
cocoapods-search (>= 1.0.0, < 2.0)
|
47
|
+
cocoapods-trunk (>= 1.6.0, < 2.0)
|
48
|
+
cocoapods-try (>= 1.1.0, < 2.0)
|
49
|
+
colored2 (~> 3.1)
|
50
|
+
escape (~> 0.0.4)
|
51
|
+
fourflusher (>= 2.3.0, < 3.0)
|
52
|
+
gh_inspector (~> 1.0)
|
53
|
+
molinillo (~> 0.8.0)
|
54
|
+
nap (~> 1.0)
|
55
|
+
ruby-macho (>= 2.3.0, < 3.0)
|
56
|
+
xcodeproj (>= 1.27.0, < 2.0)
|
57
|
+
cocoapods-core (1.16.2)
|
58
|
+
activesupport (>= 5.0, < 8)
|
59
|
+
addressable (~> 2.8)
|
60
|
+
algoliasearch (~> 1.0)
|
61
|
+
concurrent-ruby (~> 1.1)
|
62
|
+
fuzzy_match (~> 2.0.4)
|
63
|
+
nap (~> 1.0)
|
64
|
+
netrc (~> 0.11)
|
65
|
+
public_suffix (~> 4.0)
|
66
|
+
typhoeus (~> 1.0)
|
67
|
+
cocoapods-deintegrate (1.0.5)
|
68
|
+
cocoapods-downloader (2.1)
|
69
|
+
cocoapods-plugins (1.0.0)
|
70
|
+
nap
|
71
|
+
cocoapods-search (1.0.1)
|
72
|
+
cocoapods-trunk (1.6.0)
|
73
|
+
nap (>= 0.8, < 2.0)
|
74
|
+
netrc (~> 0.11)
|
75
|
+
cocoapods-try (1.2.0)
|
76
|
+
colored2 (3.1.2)
|
77
|
+
concurrent-ruby (1.3.5)
|
78
|
+
connection_pool (2.5.3)
|
79
|
+
drb (2.2.3)
|
80
|
+
escape (0.0.4)
|
81
|
+
ethon (0.16.0)
|
82
|
+
ffi (>= 1.15.0)
|
83
|
+
ffi (1.17.2)
|
84
|
+
ffi (1.17.2-aarch64-linux-gnu)
|
85
|
+
ffi (1.17.2-aarch64-linux-musl)
|
86
|
+
ffi (1.17.2-arm-linux-gnu)
|
87
|
+
ffi (1.17.2-arm-linux-musl)
|
88
|
+
ffi (1.17.2-arm64-darwin)
|
89
|
+
ffi (1.17.2-x86-linux-gnu)
|
90
|
+
ffi (1.17.2-x86-linux-musl)
|
91
|
+
ffi (1.17.2-x86_64-darwin)
|
92
|
+
ffi (1.17.2-x86_64-linux-gnu)
|
93
|
+
ffi (1.17.2-x86_64-linux-musl)
|
94
|
+
fourflusher (2.3.1)
|
95
|
+
fuzzy_match (2.0.4)
|
96
|
+
gh_inspector (1.1.3)
|
97
|
+
httpclient (2.9.0)
|
98
|
+
mutex_m
|
99
|
+
i18n (1.14.7)
|
100
|
+
concurrent-ruby (~> 1.0)
|
101
|
+
json (2.12.2)
|
102
|
+
logger (1.7.0)
|
103
|
+
minitest (5.25.5)
|
104
|
+
mocha (2.7.1)
|
105
|
+
ruby2_keywords (>= 0.0.5)
|
106
|
+
mocha-on-bacon (0.2.3)
|
107
|
+
mocha (>= 0.13.0)
|
108
|
+
molinillo (0.8.0)
|
109
|
+
mutex_m (0.3.0)
|
110
|
+
nanaimo (0.4.0)
|
111
|
+
nap (1.1.0)
|
112
|
+
netrc (0.11.0)
|
113
|
+
nkf (0.2.0)
|
114
|
+
prettybacon (0.0.2)
|
115
|
+
bacon (~> 1.2)
|
116
|
+
public_suffix (4.0.7)
|
117
|
+
rake (13.3.0)
|
118
|
+
rexml (3.4.1)
|
119
|
+
rouge (2.0.7)
|
120
|
+
ruby-macho (2.5.1)
|
121
|
+
ruby2_keywords (0.0.5)
|
122
|
+
securerandom (0.4.1)
|
123
|
+
typhoeus (1.4.1)
|
124
|
+
ethon (>= 0.9.0)
|
125
|
+
tzinfo (2.0.6)
|
126
|
+
concurrent-ruby (~> 1.0)
|
127
|
+
xcodeproj (1.27.0)
|
128
|
+
CFPropertyList (>= 2.3.3, < 4.0)
|
129
|
+
atomos (~> 0.1.3)
|
130
|
+
claide (>= 1.0.2, < 2.0)
|
131
|
+
colored2 (~> 3.1)
|
132
|
+
nanaimo (~> 0.4.0)
|
133
|
+
rexml (>= 3.3.6, < 4.0)
|
134
|
+
xcpretty (0.3.0)
|
135
|
+
rouge (~> 2.0.7)
|
136
|
+
|
137
|
+
PLATFORMS
|
138
|
+
aarch64-linux-gnu
|
139
|
+
aarch64-linux-musl
|
140
|
+
arm-linux-gnu
|
141
|
+
arm-linux-musl
|
142
|
+
arm64-darwin
|
143
|
+
ruby
|
144
|
+
x86-linux-gnu
|
145
|
+
x86-linux-musl
|
146
|
+
x86_64-darwin
|
147
|
+
x86_64-linux-gnu
|
148
|
+
x86_64-linux-musl
|
149
|
+
|
150
|
+
DEPENDENCIES
|
151
|
+
bacon
|
152
|
+
bundler (~> 2.6.9)
|
153
|
+
cocoapods
|
154
|
+
cocoapods-binary-matchup!
|
155
|
+
mocha
|
156
|
+
mocha-on-bacon
|
157
|
+
prettybacon
|
158
|
+
rake
|
159
|
+
|
160
|
+
BUNDLED WITH
|
161
|
+
2.6.9
|
data/README.md
CHANGED
@@ -30,12 +30,12 @@ Then in the flowing normal install process, we hook the integration functions to
|
|
30
30
|
|
31
31
|
## Installation
|
32
32
|
|
33
|
-
$ gem install cocoapods-binary
|
33
|
+
$ gem install cocoapods-binary-matchup
|
34
34
|
|
35
35
|
## Usage
|
36
36
|
|
37
37
|
``` ruby
|
38
|
-
plugin 'cocoapods-binary'
|
38
|
+
plugin 'cocoapods-binary-matchup'
|
39
39
|
|
40
40
|
use_frameworks!
|
41
41
|
# all_binary!
|
@@ -45,7 +45,7 @@ target "HP" do
|
|
45
45
|
end
|
46
46
|
```
|
47
47
|
|
48
|
-
- Add `plugin 'cocoapods-binary'` in the head of Podfile
|
48
|
+
- Add `plugin 'cocoapods-binary-matchup'` in the head of Podfile
|
49
49
|
- Add `:binary => true` as a option of one specific pod, or add `all_binary!` before all targets, which makes all pods binaries.
|
50
50
|
- pod install, and that's all
|
51
51
|
|
@@ -59,11 +59,22 @@ If your `Pods` folder is excluded from git, you may add `keep_source_code_for_pr
|
|
59
59
|
|
60
60
|
If bitcode is needed, add a `enable_bitcode_for_prebuilt_frameworks!` before all targets in Podfile
|
61
61
|
|
62
|
+
if forbidden simulator, add a `simulator_build_disable!` before all targets in Podfile
|
63
|
+
|
64
|
+
if custom main deployment target, add a `min_deployment_target(version)` before all targets in Podfile; e.g: `min_deployment_target(14.0)`
|
65
|
+
|
66
|
+
if custom build configuration is needed, add a `set_custom_xcodebuild_options_for_prebuilt_frameworks` before all targets in Podfile; e.g:
|
67
|
+
set_custom_xcodebuild_options_for_prebuilt_frameworks({
|
68
|
+
:device => "ARCHS=arm64",
|
69
|
+
:simulator => "ARCHS=x86_64",
|
70
|
+
:DEBUG_INFORMATION_FORMAT => "dwarf"
|
71
|
+
})
|
72
|
+
|
62
73
|
|
63
74
|
#### Known Issues
|
64
75
|
|
65
76
|
- doesn't support watchos now
|
66
|
-
- dSYM files is missing for dynamic frameworks using this plugin. Walkaround: Don't use this plugin for a release build. Add a if condition with ENV around `plugin 'cocoapods-binary'`
|
77
|
+
- dSYM files is missing for dynamic frameworks using this plugin. Walkaround: Don't use this plugin for a release build. Add a if condition with ENV around `plugin 'cocoapods-binary-matchup'`
|
67
78
|
|
68
79
|
## License
|
69
80
|
|
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency "fourflusher", "~> 2.0"
|
23
23
|
spec.add_dependency "xcpretty", "~> 0.3.0"
|
24
24
|
|
25
|
-
spec.add_development_dependency 'bundler', '~>
|
25
|
+
spec.add_development_dependency 'bundler', '~> 2.6.9'
|
26
26
|
spec.add_development_dependency 'rake'
|
27
27
|
end
|
@@ -27,18 +27,12 @@ module Pod
|
|
27
27
|
UI.puts "install_for_prebuild! start: #{self.name}"
|
28
28
|
|
29
29
|
# 获取pod版本信息
|
30
|
-
|
30
|
+
prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sanbox)
|
31
|
+
|
32
|
+
pod_version = Pod::PrebuildCache::Cache.get_pod_version(prebuild_sandbox, self.name)
|
31
33
|
target_folder = standard_sanbox.pod_dir(self.name)
|
32
34
|
target_folder.rmtree if target_folder.exist?
|
33
35
|
|
34
|
-
# 1. 首先尝试从缓存恢复
|
35
|
-
if Pod::PrebuildCache::Cache.copy_from_cache_if_exists(self.name, pod_version, target_folder.to_s)
|
36
|
-
UI.puts "📦 Successfully restored #{self.name} (#{pod_version}) from cache"
|
37
|
-
return
|
38
|
-
end
|
39
|
-
|
40
|
-
# 2. 如果缓存不存在,从预构建目录拷贝
|
41
|
-
prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sanbox)
|
42
36
|
real_file_folder = prebuild_sandbox.framework_folder_path_for_pod_name(self.name)
|
43
37
|
|
44
38
|
if real_file_folder.exist?
|
@@ -88,7 +82,7 @@ module Pod
|
|
88
82
|
# 只有当不是预构建的pod时才删除,避免删除刚拷贝的预构建文件
|
89
83
|
next if self.prebuild_pod_names.include?(root_name)
|
90
84
|
|
91
|
-
# delete the cached files
|
85
|
+
# delete the cached files,include all cached files in the target
|
92
86
|
target_path = self.sandbox.pod_dir(root_name)
|
93
87
|
target_path.rmtree if target_path.exist?
|
94
88
|
|
@@ -122,6 +116,7 @@ module Pod
|
|
122
116
|
|
123
117
|
#
|
124
118
|
specs = self.analysis_result.specifications
|
119
|
+
# 只保留podspec中prebuild的pod,这里本质过滤了所有非prebuild的pod
|
125
120
|
prebuilt_specs = (specs.select do |spec|
|
126
121
|
self.prebuild_pod_names.include? spec.root.name
|
127
122
|
end)
|
@@ -137,6 +132,7 @@ module Pod
|
|
137
132
|
root_name = spec.root.name
|
138
133
|
|
139
134
|
target = name_to_target_hash[root_name]
|
135
|
+
# 如果是非源码编译成的pod(如本身是动态库和静态库依赖),则跳过集成,使用pod本身的配置
|
140
136
|
next if Prebuild::Passer.target_names_to_skip_integration_framework.include? target.pod_name
|
141
137
|
|
142
138
|
# use the prebuilt framework
|
@@ -227,7 +223,7 @@ module Pod
|
|
227
223
|
old_method = instance_method(:install_source_of_pod)
|
228
224
|
define_method(:install_source_of_pod) do |pod_name|
|
229
225
|
|
230
|
-
# copy from original
|
226
|
+
# copy from original,创建一个单pod的安装器
|
231
227
|
pod_installer = create_pod_installer(pod_name)
|
232
228
|
# \copy from original
|
233
229
|
|
@@ -19,160 +19,54 @@ module Pod
|
|
19
19
|
|
20
20
|
# 获取pod的版本信息,优先使用commit hash
|
21
21
|
def self.get_pod_version(sandbox, pod_name)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
checkout_info = checkout_options[pod_name]
|
35
|
-
# 优先使用commit,然后是tag
|
36
|
-
if checkout_info[:commit] || checkout_info['commit']
|
37
|
-
commit = checkout_info[:commit] || checkout_info['commit']
|
38
|
-
Pod::UI.puts "📋 Using commit for #{pod_name}: #{commit[0..7]}..."
|
39
|
-
return commit
|
40
|
-
elsif checkout_info[:tag] || checkout_info['tag']
|
41
|
-
tag = checkout_info[:tag] || checkout_info['tag']
|
42
|
-
Pod::UI.puts "📋 Using tag for #{pod_name}: #{tag}"
|
43
|
-
return tag
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
# 如果没有commit信息,查找版本信息
|
48
|
-
pods = manifest_content['PODS'] || []
|
49
|
-
Pod::UI.puts "🔍 Searching in #{pods.length} pod entries from Manifest.lock"
|
50
|
-
|
51
|
-
pods.each do |pod_entry|
|
52
|
-
if pod_entry.is_a?(Hash)
|
53
|
-
# Hash 格式:{"PodName (1.0.0)" => [...]}
|
54
|
-
pod_entry.each do |key, _|
|
55
|
-
key_str = key.to_s
|
56
|
-
|
57
|
-
# 使用更灵活的匹配逻辑,支持subspec
|
58
|
-
match = key_str.match(/^#{Regexp.escape(pod_name)}\s*\(([^)]+)\)/)
|
59
|
-
if match
|
60
|
-
Pod::UI.puts "📋 Found exact match! Using version for #{pod_name}: #{match[1]}"
|
61
|
-
return match[1]
|
62
|
-
end
|
63
|
-
|
64
|
-
# 如果精确匹配失败,尝试检查是否是subspec的情况
|
65
|
-
# 例如:pod_name是"GoogleUtilities/AppDelegateSwizzler",但key是"GoogleUtilities/AppDelegateSwizzler (8.1.0)"
|
66
|
-
if key_str.include?(pod_name) && key_str.include?('(')
|
67
|
-
version_match = key_str.match(/\(([^)]+)\)/)
|
68
|
-
if version_match
|
69
|
-
Pod::UI.puts "📋 Found partial match! Using version for #{pod_name}: #{version_match[1]}"
|
70
|
-
return version_match[1]
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
elsif pod_entry.is_a?(String)
|
75
|
-
# String 格式:"PodName (1.0.0)"
|
76
|
-
|
77
|
-
match = pod_entry.match(/^#{Regexp.escape(pod_name)}\s*\(([^)]+)\)/)
|
78
|
-
if match
|
79
|
-
Pod::UI.puts "📋 Found exact match! Using version for #{pod_name}: #{match[1]}"
|
80
|
-
return match[1]
|
81
|
-
end
|
82
|
-
|
83
|
-
# 如果精确匹配失败,尝试部分匹配
|
84
|
-
if pod_entry.include?(pod_name) && pod_entry.include?('(')
|
85
|
-
version_match = pod_entry.match(/\(([^)]+)\)/)
|
86
|
-
if version_match
|
87
|
-
Pod::UI.puts "📋 Found partial match! Using version for #{pod_name}: #{version_match[1]}"
|
88
|
-
return version_match[1]
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
Pod::UI.puts "⚠️ No version found for #{pod_name} in Manifest.lock"
|
22
|
+
UI.puts "🔍 starting get pod version: #{pod_name}"
|
23
|
+
checkout_options = sandbox.manifest.checkout_options_for_pod_named(pod_name)
|
24
|
+
# 优先使用checkout_options中的检出来源
|
25
|
+
if checkout_options
|
26
|
+
UI.puts "🔍 get pod checkout version: #{pod_name}"
|
27
|
+
if checkout_options[:tag]
|
28
|
+
UI.puts "🔍 get pod checkout version tag: #{pod_name}# - #{checkout_options[:tag]}"
|
29
|
+
return checkout_options[:tag]
|
30
|
+
end
|
31
|
+
if checkout_options[:branch]
|
32
|
+
UI.puts "🔍 get pod checkout version branch: #{pod_name}# - #{checkout_options[:branch]}"
|
33
|
+
return checkout_options[:branch]
|
95
34
|
end
|
35
|
+
if checkout_options[:commit]
|
36
|
+
UI.puts "🔍 get pod checkout version commit: #{pod_name}# - #{checkout_options[:commit]}"
|
37
|
+
return checkout_options[:commit]
|
38
|
+
end
|
39
|
+
end
|
96
40
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
checkout_info = checkout_options[pod_name]
|
108
|
-
if checkout_info[:commit] || checkout_info['commit']
|
109
|
-
commit = checkout_info[:commit] || checkout_info['commit']
|
110
|
-
Pod::UI.puts "📋 Using commit for #{pod_name}: #{commit[0..7]}..."
|
111
|
-
return commit
|
112
|
-
elsif checkout_info[:tag] || checkout_info['tag']
|
113
|
-
tag = checkout_info[:tag] || checkout_info['tag']
|
114
|
-
Pod::UI.puts "📋 Using tag for #{pod_name}: #{tag}"
|
115
|
-
return tag
|
116
|
-
end
|
41
|
+
# 如果checkout_options中没有版本信息,则使用dependency中的版本信息
|
42
|
+
dependency = sandbox.manifest.dependencies.find { |d| d.name == pod_name }
|
43
|
+
if dependency
|
44
|
+
UI.puts "🔍 get pod dependency version: #{pod_name}"
|
45
|
+
external_source = dependency.external_source
|
46
|
+
if external_source
|
47
|
+
UI.puts "🔍 get pod dependency version podspec: #{external_source}"
|
48
|
+
if external_source[:commit]
|
49
|
+
UI.puts "🔍 get pod dependency version commit: #{pod_name}# - #{external_source[:commit]}"
|
50
|
+
return external_source[:commit]
|
117
51
|
end
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
Pod::UI.puts "🔍 Searching in #{pods.length} pod entries from Podfile.lock"
|
122
|
-
|
123
|
-
pods.each do |pod_entry|
|
124
|
-
if pod_entry.is_a?(Hash)
|
125
|
-
pod_entry.each do |key, _|
|
126
|
-
key_str = key.to_s
|
127
|
-
|
128
|
-
# 使用更灵活的匹配逻辑,支持subspec
|
129
|
-
match = key_str.match(/^#{Regexp.escape(pod_name)}\s*\(([^)]+)\)/)
|
130
|
-
if match
|
131
|
-
Pod::UI.puts "📋 Found exact match! Using version for #{pod_name}: #{match[1]}"
|
132
|
-
return match[1]
|
133
|
-
end
|
134
|
-
|
135
|
-
# 如果精确匹配失败,尝试部分匹配
|
136
|
-
if key_str.include?(pod_name) && key_str.include?('(')
|
137
|
-
version_match = key_str.match(/\(([^)]+)\)/)
|
138
|
-
if version_match
|
139
|
-
Pod::UI.puts "📋 Found partial match! Using version for #{pod_name}: #{version_match[1]}"
|
140
|
-
return version_match[1]
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
144
|
-
elsif pod_entry.is_a?(String)
|
145
|
-
# String 格式:"PodName (1.0.0)"
|
146
|
-
|
147
|
-
match = pod_entry.match(/^#{Regexp.escape(pod_name)}\s*\(([^)]+)\)/)
|
148
|
-
if match
|
149
|
-
Pod::UI.puts "📋 Found exact match! Using version for #{pod_name}: #{match[1]}"
|
150
|
-
return match[1]
|
151
|
-
end
|
152
|
-
|
153
|
-
# 如果精确匹配失败,尝试部分匹配
|
154
|
-
if pod_entry.include?(pod_name) && pod_entry.include?('(')
|
155
|
-
version_match = pod_entry.match(/\(([^)]+)\)/)
|
156
|
-
if version_match
|
157
|
-
Pod::UI.puts "📋 Found partial match! Using version for #{pod_name}: #{version_match[1]}"
|
158
|
-
return version_match[1]
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
52
|
+
if external_source[:branch]
|
53
|
+
UI.puts "🔍 get pod dependency version branch: #{pod_name}# - #{external_source[:branch]}"
|
54
|
+
return external_source[:branch]
|
162
55
|
end
|
163
|
-
|
164
|
-
Pod::UI.puts "⚠️ No version found for #{pod_name} in Podfile.lock"
|
165
56
|
end
|
166
|
-
|
167
|
-
# 3. 如果无法从任何lockfile获取,使用时间戳作为版本
|
168
|
-
timestamp = Time.now.strftime("%Y%m%d_%H%M%S")
|
169
|
-
Pod::UI.puts "⚠️ Warning: Cannot find version/commit for #{pod_name} in lock files, using timestamp: #{timestamp}"
|
170
|
-
return timestamp
|
171
|
-
rescue => e
|
172
|
-
timestamp = Time.now.strftime("%Y%m%d_%H%M%S")
|
173
|
-
Pod::UI.puts "⚠️ Warning: Error getting version for #{pod_name}: #{e.message}, using timestamp: #{timestamp}"
|
174
|
-
return timestamp
|
175
57
|
end
|
58
|
+
|
59
|
+
# 如果checkout_options和dependency中没有版本信息,则使用podspec中的version
|
60
|
+
UI.puts "🔍 get pod spec version: #{pod_name}"
|
61
|
+
version = sandbox.manifest.version(pod_name).version
|
62
|
+
if version
|
63
|
+
UI.puts "🔍 get pod spec version: #{pod_name}# - #{version}"
|
64
|
+
return version
|
65
|
+
end
|
66
|
+
|
67
|
+
# 如果以上都失败,则返回unknown,理论上只要是正常的podfile.lock或者manifest.lock,都不会走到这里
|
68
|
+
UI.puts "🔍 get pod version failed: #{pod_name}"
|
69
|
+
return "unknown"
|
176
70
|
end
|
177
71
|
|
178
72
|
# 计算目录内容的哈希值(用于验证缓存完整性)
|
@@ -66,20 +66,20 @@ module Pod
|
|
66
66
|
end
|
67
67
|
|
68
68
|
class_attr_accessor :simulator_build_enabled
|
69
|
-
simulator_build_enabled = true
|
69
|
+
self.simulator_build_enabled = true
|
70
70
|
|
71
71
|
class_attr_accessor :min_deployment_target
|
72
|
-
min_deployment_target = '14.0'
|
72
|
+
self.min_deployment_target = '14.0'
|
73
73
|
|
74
74
|
private
|
75
75
|
class_attr_accessor :prebuild_all
|
76
|
-
prebuild_all = false
|
76
|
+
self.prebuild_all = false
|
77
77
|
|
78
78
|
class_attr_accessor :bitcode_enabled
|
79
|
-
bitcode_enabled = false
|
79
|
+
self.bitcode_enabled = false
|
80
80
|
|
81
81
|
class_attr_accessor :dont_remove_source_code
|
82
|
-
dont_remove_source_code = false
|
82
|
+
self.dont_remove_source_code = false
|
83
83
|
|
84
84
|
class_attr_accessor :custom_build_options
|
85
85
|
class_attr_accessor :custom_build_options_simulator
|
@@ -123,6 +123,10 @@ Pod::HooksManager.register('cocoapods-binary-matchup', :pre_install) do |install
|
|
123
123
|
update = nil
|
124
124
|
repo_update = nil
|
125
125
|
|
126
|
+
# pod install → update=false, repo_update=false
|
127
|
+
# pod update → update=true, repo_update=false
|
128
|
+
# pod install --repo-update → update=false, repo_update=true
|
129
|
+
# pod update --repo-update → update=true, repo_update=true
|
126
130
|
include ObjectSpace
|
127
131
|
ObjectSpace.each_object(Pod::Installer) { |installer|
|
128
132
|
update = installer.update
|
@@ -173,6 +177,7 @@ Pod::HooksManager.register('cocoapods-binary-matchup', :pre_install) do |install
|
|
173
177
|
# install
|
174
178
|
Pod::UI.puts "\n"
|
175
179
|
Pod::UI.puts "🤖 Pod Install"
|
180
|
+
# 只有进入正常阶段才会执行Integration中的相关hook行为
|
176
181
|
require_relative 'Integration'
|
177
182
|
# go on the normal install step ...
|
178
183
|
end
|
@@ -26,6 +26,7 @@ module Pod
|
|
26
26
|
UI.puts "prebuild_pods_changes"
|
27
27
|
UI.puts "--------------------------------"
|
28
28
|
if @prebuild_pods_changes.nil?
|
29
|
+
# detect the changes with podfile by manifest.lock
|
29
30
|
changes = local_manifest.detect_changes_with_podfile(podfile)
|
30
31
|
@prebuild_pods_changes = Analyzer::SpecsState.new(changes)
|
31
32
|
# save the chagnes info for later stage
|
@@ -126,6 +127,8 @@ module Pod
|
|
126
127
|
Pod::UI.puts "Prebuild frameworks (total #{targets.count})"
|
127
128
|
Pod::Prebuild.remove_build_dir(sandbox_path)
|
128
129
|
targets.each do |target|
|
130
|
+
# If target shouldn't build, we copy all the original files
|
131
|
+
# This is for target with only .a and .h files
|
129
132
|
if !target.should_build?
|
130
133
|
UI.puts "Prebuilding #{target.label}"
|
131
134
|
next
|
@@ -186,6 +189,7 @@ module Pod
|
|
186
189
|
next
|
187
190
|
end
|
188
191
|
|
192
|
+
# copy the vendored frameworks and libraries in _Prebuild to Pods/
|
189
193
|
target.spec_consumers.each do |consumer|
|
190
194
|
file_accessor = Sandbox::FileAccessor.new(root_path, consumer)
|
191
195
|
lib_paths = file_accessor.vendored_frameworks || []
|
@@ -19,9 +19,12 @@ module Pod
|
|
19
19
|
end
|
20
20
|
|
21
21
|
# --- patch ---
|
22
|
+
# filter the pods that should be prebuild(all_binary! or binary => true),remember the pod is must remote pod
|
23
|
+
# this will be effective when enable_prebuild_patch is true(the binary prebuild step)
|
24
|
+
# when in system step, the enable_prebuild_patch is false, so the original method will be called
|
22
25
|
old_method = instance_method(:pod)
|
23
|
-
|
24
26
|
define_method(:pod) do |name, *args|
|
27
|
+
# if not enable, just call the original method
|
25
28
|
if !@@enable_prebuild_patch
|
26
29
|
old_method.bind(self).(name, *args)
|
27
30
|
return
|
@@ -56,6 +59,8 @@ module Pod
|
|
56
59
|
@@force_disable_integration = value
|
57
60
|
end
|
58
61
|
|
62
|
+
# prebuild step's purpose is to build source target code or copy the prebuild framework to the target,
|
63
|
+
# so we need to disable the original method
|
59
64
|
old_method = instance_method(:integrate_user_project)
|
60
65
|
define_method(:integrate_user_project) do
|
61
66
|
if @@force_disable_integration
|
@@ -14,8 +14,11 @@ module Pod
|
|
14
14
|
should_prebuild = Pod::Podfile::DSL.prebuild_all
|
15
15
|
|
16
16
|
options = requirements.last
|
17
|
+
# 如果options是hash,并且包含Pod::Prebuild.keyword,则设置should_prebuild为true
|
17
18
|
if options.is_a?(Hash) && options[Pod::Prebuild.keyword] != nil
|
19
|
+
# [DINetwork', { :binary => true, :configurations => ['Debug'] }]
|
18
20
|
should_prebuild = options.delete(Pod::Prebuild.keyword)
|
21
|
+
# [DINetwork', { :configurations => ['Debug'] }],避免干扰其他配置,不删除可能让后续cocoapods本身解析报错
|
19
22
|
requirements.pop if options.empty?
|
20
23
|
end
|
21
24
|
|
@@ -55,6 +58,7 @@ module Pod
|
|
55
58
|
# ---- patch method ----
|
56
59
|
# We want modify `store_pod` method, but it's hard to insert a line in the
|
57
60
|
# implementation. So we patch a method called in `store_pod`.
|
61
|
+
# use this method to parse prebuild framework(:binary => true)
|
58
62
|
old_method = instance_method(:parse_inhibit_warnings)
|
59
63
|
|
60
64
|
define_method(:parse_inhibit_warnings) do |name, requirements|
|
@@ -80,7 +84,6 @@ module Pod
|
|
80
84
|
|
81
85
|
UI.puts "🔍 Processing #{aggregate_target.name}:"
|
82
86
|
UI.puts "🔍 pod_targets count: #{targets.count}"
|
83
|
-
UI.puts "🔍 pod_targets: #{targets.map(&:pod_name).join(', ')}" if targets.count < 10
|
84
87
|
|
85
88
|
# filter prebuild
|
86
89
|
prebuild_names = target_definition.prebuild_framework_names
|
@@ -98,7 +101,6 @@ module Pod
|
|
98
101
|
end
|
99
102
|
|
100
103
|
all = all.reject {|pod_target| sandbox.local?(pod_target.pod_name) }
|
101
|
-
UI.puts "🔍 prebuild_pod_targets: #{all.map(&:pod_name).join(', ')}"
|
102
104
|
all.uniq
|
103
105
|
end
|
104
106
|
|
@@ -30,12 +30,12 @@ def build_for_iosish_platform(sandbox,
|
|
30
30
|
other_options = []
|
31
31
|
# bitcode enabled
|
32
32
|
other_options += ['BITCODE_GENERATION_MODE=bitcode'] if bitcode_enabled
|
33
|
-
# make less arch to iphone simulator for faster build
|
34
|
-
custom_build_options_simulator += ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'] if simulator == 'iphonesimulator'
|
35
33
|
|
36
34
|
is_succeed, _ = xcodebuild(sandbox, target_label, device, deployment_target, other_options + custom_build_options)
|
37
35
|
exit 1 unless is_succeed
|
38
36
|
if Pod::Podfile::DSL.simulator_build_enabled
|
37
|
+
# make less arch to iphone simulator for faster build
|
38
|
+
custom_build_options_simulator += ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'] if simulator == 'iphonesimulator'
|
39
39
|
is_succeed, _ = xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + custom_build_options_simulator)
|
40
40
|
exit 1 unless is_succeed
|
41
41
|
end
|
data/spec/plugin_spec.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require File.expand_path('../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe "CocoaPods Binary Matchup Plugin" do
|
4
|
+
it "should load the plugin" do
|
5
|
+
Pod::Prebuild.keyword.should == :binary
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should load successfully" do
|
9
|
+
# 简单验证插件加载成功
|
10
|
+
defined?(Pod::Prebuild).should.not.be.nil
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should have basic constants defined" do
|
14
|
+
# 验证基本常量存在
|
15
|
+
Pod.constants.should.include?(:Prebuild)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should define DSL instance methods" do
|
19
|
+
# 验证实例方法存在(这些是在Podfile中使用的方法)
|
20
|
+
# instance_methods是反射方法,用于获取所有的实例方法,注意false代表不获取父类
|
21
|
+
dsl_methods = Pod::Podfile::DSL.instance_methods(false)
|
22
|
+
dsl_methods.should.include?(:all_binary!)
|
23
|
+
dsl_methods.should.include?(:enable_bitcode_for_prebuilt_frameworks!)
|
24
|
+
dsl_methods.should.include?(:keep_source_code_for_prebuilt_frameworks!)
|
25
|
+
dsl_methods.should.include?(:min_deployment_target)
|
26
|
+
dsl_methods.should.include?(:simulator_build_disable!)
|
27
|
+
dsl_methods.should.include?(:set_custom_xcodebuild_options_for_prebuilt_frameworks)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should have correct default values for public attributes" do
|
31
|
+
# 验证公开的默认配置值
|
32
|
+
Pod::Podfile::DSL.simulator_build_enabled.should == true
|
33
|
+
# should是bacon中的测试断言,这里的意思是min_deployment_target应该等于'14.0'
|
34
|
+
Pod::Podfile::DSL.min_deployment_target.should == '14.0'
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should allow setting min_deployment_target" do
|
38
|
+
# 验证可以设置最小部署目标
|
39
|
+
original_target = Pod::Podfile::DSL.min_deployment_target
|
40
|
+
Pod::Podfile::DSL.min_deployment_target = '15.0'
|
41
|
+
Pod::Podfile::DSL.min_deployment_target.should == '15.0'
|
42
|
+
# 恢复原值
|
43
|
+
Pod::Podfile::DSL.min_deployment_target = original_target
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should allow toggling simulator build" do
|
47
|
+
# 验证可以切换模拟器构建设置
|
48
|
+
original_value = Pod::Podfile::DSL.simulator_build_enabled
|
49
|
+
Pod::Podfile::DSL.simulator_build_enabled = false
|
50
|
+
Pod::Podfile::DSL.simulator_build_enabled.should == false
|
51
|
+
# 恢复原值
|
52
|
+
Pod::Podfile::DSL.simulator_build_enabled = original_value
|
53
|
+
end
|
54
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-binary-matchup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- leavez
|
@@ -63,14 +63,14 @@ dependencies:
|
|
63
63
|
requirements:
|
64
64
|
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version:
|
66
|
+
version: 2.6.9
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
71
|
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version:
|
73
|
+
version: 2.6.9
|
74
74
|
- !ruby/object:Gem::Dependency
|
75
75
|
name: rake
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,10 +96,10 @@ files:
|
|
96
96
|
- ".gitignore"
|
97
97
|
- ".travis.yml"
|
98
98
|
- Gemfile
|
99
|
+
- Gemfile.lock
|
99
100
|
- LICENSE.txt
|
100
101
|
- README.md
|
101
102
|
- Rakefile
|
102
|
-
- cocoapods-binary-matchup-0.0.6.gem
|
103
103
|
- cocoapods-binary-matchup.gemspec
|
104
104
|
- lib/cocoapods-binary-matchup/Integration.rb
|
105
105
|
- lib/cocoapods-binary-matchup/Integration_cache.rb
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- lib/cocoapods-binary-matchup/tool/tool.rb
|
116
116
|
- lib/cocoapods-binary.rb
|
117
117
|
- lib/cocoapods_plugin.rb
|
118
|
+
- spec/plugin_spec.rb
|
118
119
|
- spec/spec_helper.rb
|
119
120
|
homepage: https://github.com/omiapp/cocoapod_binary_matchup
|
120
121
|
licenses:
|
@@ -139,4 +140,5 @@ specification_version: 4
|
|
139
140
|
summary: A CocoaPods plugin to integrate pods in form of prebuilt frameworks, not
|
140
141
|
source code, by adding just one flag in podfile. Speed up compiling dramatically.
|
141
142
|
test_files:
|
143
|
+
- spec/plugin_spec.rb
|
142
144
|
- spec/spec_helper.rb
|
Binary file
|