cocoapods-binaryhqp 0.4.8 → 0.5.2
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/.vscode/launch.json +4 -2
- data/Gemfile.lock +2 -3
- data/README.md +9 -4
- data/lib/cocoapods-binaryhqp/Integration.rb +6 -3
- data/lib/cocoapods-binaryhqp/Main.rb +14 -1
- data/lib/cocoapods-binaryhqp/Prebuild.rb +80 -17
- data/lib/cocoapods-binaryhqp/command_option/command_option.rb +28 -0
- data/lib/cocoapods-binaryhqp/gem_version.rb +1 -1
- data/lib/cocoapods-binaryhqp/helper/feature_switches.rb +6 -2
- data/lib/cocoapods-binaryhqp/helper/podfile_options.rb +6 -2
- data/lib/cocoapods-binaryhqp/rome/build_framework.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3adce240c7874c49810940cf90b4f615622eeacfc52c3c13c117684c6bb8a10f
|
4
|
+
data.tar.gz: d5221a0a35c3fb28154066ad68afa77de704b42c170c948706b8dce2c8592c36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8aa7d3e63f10fb203f085cec2bf730840dadc6240c3faca31d836c871c0f83378515e57ad94925ee44b73b3e5d1bf075b5d9e4e686e236f105725825efe1375
|
7
|
+
data.tar.gz: 4de06e2790d19f79d48814787b4393990a75a87a4a46fafcba7192585f3e151f52ad16d64862e272d6551820142a804e9dc2a01b0e4436df9fb172d0b9964ac5
|
data/.vscode/launch.json
CHANGED
@@ -8,8 +8,10 @@
|
|
8
8
|
"useBundler": true,
|
9
9
|
"cwd": "${workspaceRoot}/demo", // pod 命令执行的路径
|
10
10
|
"program": "/usr/local/bin/pod",
|
11
|
-
"args": ["update",
|
12
|
-
// "args": ["install"]
|
11
|
+
// "args": ["update","--hsource", "--verbose"]// `pod` 命令的参数
|
12
|
+
// "args": ["install", "--verbose"]
|
13
|
+
// "args": ["install","--hsource", "--verbose"]
|
14
|
+
"args":["install", "--help"]
|
13
15
|
}
|
14
16
|
]
|
15
17
|
}
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cocoapods-binaryhqp (0.4.
|
4
|
+
cocoapods-binaryhqp (0.4.9)
|
5
|
+
CFPropertyList
|
5
6
|
cocoapods
|
6
7
|
fourflusher
|
7
|
-
plist
|
8
8
|
xcpretty
|
9
9
|
|
10
10
|
GEM
|
@@ -87,7 +87,6 @@ GEM
|
|
87
87
|
nanaimo (0.3.0)
|
88
88
|
nap (1.1.0)
|
89
89
|
netrc (0.11.0)
|
90
|
-
plist (3.6.0)
|
91
90
|
prettybacon (0.0.2)
|
92
91
|
bacon (~> 1.2)
|
93
92
|
public_suffix (4.0.6)
|
data/README.md
CHANGED
@@ -33,16 +33,17 @@ Then in the flowing normal install process, we hook the integration functions to
|
|
33
33
|
|
34
34
|
## Installation
|
35
35
|
|
36
|
-
##
|
37
|
-
|
36
|
+
## 安装方法
|
37
|
+
|
38
|
+
sudo gem install cocoapods-binaryhqp
|
39
|
+
|
38
40
|
|
39
41
|
## Usage
|
40
42
|
|
41
43
|
``` ruby
|
42
|
-
plugin 'cocoapods-
|
44
|
+
plugin 'cocoapods-binaryhqp'
|
43
45
|
|
44
46
|
use_frameworks!
|
45
|
-
# all_binary!
|
46
47
|
|
47
48
|
target "HP" do
|
48
49
|
pod "ExpectoPatronum", :binary => true
|
@@ -55,6 +56,10 @@ end
|
|
55
56
|
|
56
57
|
**Note**: cocoapods-binary require `use_frameworks!`. If your worry about the boot time and other problems introduced by dynamic framework, static framework is a good choice. Another [plugin](https://github.com/leavez/cocoapods-static-swift-framework) made by me to make all pods static frameworks is recommended.
|
57
58
|
|
59
|
+
## 全部使用源码
|
60
|
+
- pod install --hsource
|
61
|
+
|
62
|
+
|
58
63
|
#### Options
|
59
64
|
|
60
65
|
If you want to disable binary for a specific pod when using `all_binary!`, place a `:binary => false` to it.
|
@@ -214,9 +214,12 @@ module Pod
|
|
214
214
|
# https://github.com/leavez/cocoapods-binary/issues/29
|
215
215
|
if spec.attributes_hash["resource_bundles"]
|
216
216
|
bundle_names = spec.attributes_hash["resource_bundles"].keys
|
217
|
-
|
218
|
-
|
219
|
-
|
217
|
+
# 只对动态库处理,静态库由mainTarget处理resource_bundles,静态库不能清空resource_bundles
|
218
|
+
if not targets.first.build_as_static_framework?
|
219
|
+
spec.attributes_hash["resource_bundles"] = nil
|
220
|
+
spec.attributes_hash["resources"] ||= []
|
221
|
+
spec.attributes_hash["resources"] += bundle_names.map{|n| n+".bundle"}
|
222
|
+
end
|
220
223
|
end
|
221
224
|
|
222
225
|
# to avoid the warning of missing license
|
@@ -2,6 +2,7 @@
|
|
2
2
|
require_relative 'helper/podfile_options'
|
3
3
|
require_relative 'tool/tool'
|
4
4
|
require_relative 'gem_version'
|
5
|
+
require_relative 'command_option/command_option'
|
5
6
|
|
6
7
|
module Pod
|
7
8
|
class Podfile
|
@@ -13,6 +14,10 @@ module Pod
|
|
13
14
|
DSL.prebuild_all = true
|
14
15
|
end
|
15
16
|
|
17
|
+
def all_source!
|
18
|
+
DSL.framework_source_all = true
|
19
|
+
end
|
20
|
+
|
16
21
|
# Enable bitcode for prebuilt frameworks
|
17
22
|
def enable_bitcode_for_prebuilt_frameworks!
|
18
23
|
DSL.bitcode_enabled = true
|
@@ -60,6 +65,9 @@ module Pod
|
|
60
65
|
class_attr_accessor :prebuild_all
|
61
66
|
prebuild_all = false
|
62
67
|
|
68
|
+
class_attr_accessor :framework_source_all
|
69
|
+
framework_source_all = false
|
70
|
+
|
63
71
|
class_attr_accessor :bitcode_enabled
|
64
72
|
bitcode_enabled = false
|
65
73
|
|
@@ -122,6 +130,9 @@ Pod::HooksManager.register('cocoapods-binaryhqp', :pre_install) do |installer_co
|
|
122
130
|
Pod::Installer.force_disable_integration true # don't integrate targets
|
123
131
|
Pod::Config.force_disable_write_lockfile true # disbale write lock file for perbuild podfile
|
124
132
|
Pod::Installer.disable_install_complete_message true # disable install complete message
|
133
|
+
|
134
|
+
Pod::Podfile::DSL.framework_source_all = Pod::Podfile::DSL.framework_source_all || Pod::Command::Install::all_use_source
|
135
|
+
Pod::UI.puts("全部使用源码") if Pod::Podfile::DSL.framework_source_all
|
125
136
|
|
126
137
|
# make another custom sandbox
|
127
138
|
standard_sandbox = installer_context.sandbox
|
@@ -133,7 +144,9 @@ Pod::HooksManager.register('cocoapods-binaryhqp', :pre_install) do |installer_co
|
|
133
144
|
# install
|
134
145
|
lockfile = installer_context.lockfile
|
135
146
|
binary_installer = Pod::Installer.new(prebuild_sandbox, prebuild_podfile, lockfile)
|
136
|
-
|
147
|
+
|
148
|
+
binary_installer.delete_all_standard_sandbox_pod(standard_sandbox)
|
149
|
+
|
137
150
|
if binary_installer.have_exact_prebuild_cache? && !update
|
138
151
|
binary_installer.install_when_cache_hit!
|
139
152
|
else
|
@@ -33,7 +33,7 @@ module Pod
|
|
33
33
|
unchanged_pod_names.reverse_each do |name|
|
34
34
|
mainfest_pod_version = local_manifest.version(name).to_s
|
35
35
|
already_prebuild_version = prebuilded_framework_version(name) || "未找到"
|
36
|
-
if
|
36
|
+
if not compare_version(mainfest_pod_version, already_prebuild_version)
|
37
37
|
Pod::UI.puts("- #{name} 已编译版本 #{already_prebuild_version}, manifest中的版本: #{mainfest_pod_version}") if config.verbose
|
38
38
|
changed_pod_names = changed_pod_names.push(name)
|
39
39
|
unchanged_pod_names.delete(name)
|
@@ -42,12 +42,25 @@ module Pod
|
|
42
42
|
|
43
43
|
changes[:changed] = changed_pod_names
|
44
44
|
changes[:unchanged] = unchanged_pod_names
|
45
|
-
Pod::UI.puts("需要重编译的framework : #{changed_pod_names.to_s}") if config.verbose
|
45
|
+
Pod::UI.puts("Pre 需要重编译的framework : #{changed_pod_names.to_s}") if config.verbose
|
46
46
|
@prebuild_pods_changes = Analyzer::SpecsState.new(changes)
|
47
47
|
# save the chagnes info for later stage
|
48
48
|
Pod::Prebuild::Passer.prebuild_pods_changes = @prebuild_pods_changes
|
49
49
|
@prebuild_pods_changes
|
50
50
|
end
|
51
|
+
|
52
|
+
# compare version
|
53
|
+
# 1.2.0 == 1.2 => true
|
54
|
+
# 1.2.1 != 1.2.0 => false
|
55
|
+
def compare_version(first_version, second_version)
|
56
|
+
first_nums = first_version.split('.')
|
57
|
+
second_nums = second_version.split('.')
|
58
|
+
|
59
|
+
first_nums.pop until first_nums.last.to_i != 0
|
60
|
+
second_nums.pop until second_nums.last.to_i != 0
|
61
|
+
|
62
|
+
first_nums == second_nums
|
63
|
+
end
|
51
64
|
|
52
65
|
|
53
66
|
public
|
@@ -57,19 +70,35 @@ module Pod
|
|
57
70
|
changes = lockfile.detect_changes_with_podfile(podfile)
|
58
71
|
unchanged_pod_names = changes[:unchanged]
|
59
72
|
changed_pod_names = changes[:changed]
|
73
|
+
add_pod_names = changes[:added]
|
74
|
+
removed_pod_names = changes[:removed]
|
75
|
+
|
76
|
+
|
60
77
|
unchanged_pod_names.reverse_each do |name|
|
61
78
|
mainfest_pod_version = lockfile.version(name).to_s
|
62
79
|
already_prebuild_version = prebuilded_framework_version(name) || "未找到"
|
63
|
-
if
|
64
|
-
|
80
|
+
if compare_version(mainfest_pod_version, already_prebuild_version)
|
81
|
+
# 已经编译了
|
82
|
+
removed_pod_names.delete(name) if removed_pod_names.include?(name)
|
83
|
+
add_pod_names.delete(name) if add_pod_names.include?(name)
|
84
|
+
changed_pod_names.delete(name) if changed_pod_names.include?(name)
|
85
|
+
|
86
|
+
else
|
87
|
+
# 未找到相对应的版本
|
88
|
+
if already_prebuild_version == "99999.99999.99999"
|
89
|
+
Pod::UI.puts("- #{name}: 未找到预编译文件, manifest中的版本: #{mainfest_pod_version}") if config.verbose
|
90
|
+
else
|
91
|
+
Pod::UI.puts("- #{name}: 已编译版 #{already_prebuild_version}, manifest中的版本: #{mainfest_pod_version}") if config.verbose
|
92
|
+
end
|
65
93
|
changed_pod_names = changed_pod_names.push(name)
|
66
|
-
unchanged_pod_names.delete(name)
|
94
|
+
unchanged_pod_names.delete(name) if unchanged_pod_names.include?(name)
|
67
95
|
end
|
68
96
|
end
|
69
|
-
|
97
|
+
changes[:removed] = removed_pod_names
|
98
|
+
changes[:added] = add_pod_names
|
70
99
|
changes[:changed] = changed_pod_names
|
71
100
|
changes[:unchanged] = unchanged_pod_names
|
72
|
-
Pod::UI.puts("需要重编译的framework : #{changed_pod_names.
|
101
|
+
Pod::UI.puts("post 需要重编译的framework : #{(changed_pod_names + removed_pod_names + add_pod_names ).to_a}") if config.verbose
|
73
102
|
@prebuild_pods_changes = Analyzer::SpecsState.new(changes)
|
74
103
|
# save the chagnes info for later stage
|
75
104
|
Pod::Prebuild::Passer.prebuild_pods_changes = @prebuild_pods_changes
|
@@ -101,7 +130,7 @@ module Pod
|
|
101
130
|
# 当前已编译的framework的版本
|
102
131
|
def prebuilded_framework_version(name)
|
103
132
|
path = self.sandbox.plist_path_for_target_name(name)
|
104
|
-
framework_version = ""
|
133
|
+
framework_version = "99999.99999.99999"
|
105
134
|
if Pathname.new(path).exist?
|
106
135
|
plist_file = CFPropertyList::List.new(:file => path)
|
107
136
|
data = CFPropertyList.native_types(plist_file.value)
|
@@ -115,7 +144,33 @@ module Pod
|
|
115
144
|
def install_when_cache_hit!
|
116
145
|
# just print log
|
117
146
|
self.sandbox.exsited_framework_target_names.each do |name|
|
118
|
-
UI.puts "Using #{name}"
|
147
|
+
UI.puts "Using #{name}" if config.verbose
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
def delete_standard_sand_box_pod(standard_sanbox)
|
152
|
+
if lockfile
|
153
|
+
changes = lockfile.detect_changes_with_podfile(podfile)
|
154
|
+
need_update_pods = (changes[:added] + changes[:changed] + changes[:removed]).to_a
|
155
|
+
|
156
|
+
need_update_pods.each do |pod_name|
|
157
|
+
pod_path = Pathname.new(standard_sanbox.root.to_s + "/#{pod_name}")
|
158
|
+
Pod::UI.puts("删除 #{pod_path.to_s}") if config.verbose
|
159
|
+
pod_path.rmtree if pod_path.exist?
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def delete_all_standard_sandbox_pod(standard_sanbox)
|
165
|
+
if lockfile
|
166
|
+
changes = lockfile.detect_changes_with_podfile(podfile)
|
167
|
+
need_update_pods = (changes[:added] + changes[:changed] + changes[:removed] + changes[:unchanged]).to_a
|
168
|
+
|
169
|
+
need_update_pods.each do |pod_name|
|
170
|
+
pod_path = Pathname.new(standard_sanbox.root.to_s + "/#{pod_name}")
|
171
|
+
Pod::UI.puts("删除 #{pod_path.to_s}") if config.verbose
|
172
|
+
pod_path.rmtree if pod_path.exist?
|
173
|
+
end
|
119
174
|
end
|
120
175
|
end
|
121
176
|
|
@@ -163,8 +218,8 @@ module Pod
|
|
163
218
|
end.flatten
|
164
219
|
|
165
220
|
# add the dendencies
|
166
|
-
dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []
|
167
|
-
targets = (targets + dependency_targets).uniq
|
221
|
+
# dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []
|
222
|
+
# targets = (targets + dependency_targets).uniq
|
168
223
|
else
|
169
224
|
targets = self.pod_targets
|
170
225
|
end
|
@@ -202,10 +257,17 @@ module Pod
|
|
202
257
|
end
|
203
258
|
end
|
204
259
|
raise "Wrong type: #{resources}" unless resources.kind_of? Array
|
205
|
-
|
260
|
+
# resource : ${PODS_ROOT}
|
261
|
+
# resource_bundles : ${PODS_CONFIGURATION_BUILD_DIR},不做处理
|
206
262
|
path_objects = resources.map do |path|
|
263
|
+
prebuild_real_path = (path.gsub('${PODS_ROOT}', sandbox.root.to_s) if path.start_with? '${PODS_ROOT}')|| ""
|
264
|
+
real_file_path = framework_path + File.basename(path)
|
265
|
+
if Pathname.new(prebuild_real_path).exist?
|
266
|
+
# 静态库的resource,拷贝至framework目录下
|
267
|
+
FileUtils.cp_r(prebuild_real_path, real_file_path, :remove_destination => true)
|
268
|
+
end
|
207
269
|
object = Prebuild::Passer::ResourcePath.new
|
208
|
-
object.real_file_path =
|
270
|
+
object.real_file_path = real_file_path
|
209
271
|
object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'
|
210
272
|
object.target_file_path = path.gsub("${PODS_CONFIGURATION_BUILD_DIR}", standard_sandbox_path.to_s) if path.start_with? "${PODS_CONFIGURATION_BUILD_DIR}"
|
211
273
|
object
|
@@ -255,10 +317,11 @@ module Pod
|
|
255
317
|
useless_target_names = sandbox.exsited_framework_target_names.reject do |name|
|
256
318
|
all_needed_names.include? name
|
257
319
|
end
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
320
|
+
# 不删除已经编译好的framework
|
321
|
+
# useless_target_names.each do |name|
|
322
|
+
# path = sandbox.framework_folder_path_for_target_name(name)
|
323
|
+
# path.rmtree if path.exist?
|
324
|
+
# end
|
262
325
|
|
263
326
|
if not Podfile::DSL.dont_remove_source_code
|
264
327
|
# only keep manifest.lock and framework folder in _Prebuild
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Install < Command
|
4
|
+
@@use_source = false
|
5
|
+
def self.options
|
6
|
+
[
|
7
|
+
['--hsource', 'from cocoapods-binaryhqp, all frameworks use source code'],
|
8
|
+
].concat(super).reject { |(name, _)| name == '--no-repo-update' }
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(argv)
|
12
|
+
super
|
13
|
+
@@use_source = argv.flag?('hsource', false)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.all_use_source
|
17
|
+
@@use_source
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.run(argv)
|
21
|
+
super(argv)
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -28,14 +28,18 @@ module Pod
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# patched content
|
31
|
-
should_prebuild = Pod::Podfile::DSL.prebuild_all
|
31
|
+
should_prebuild = Pod::Podfile::DSL.prebuild_all || (not Pod::Podfile::DSL.framework_source_all)
|
32
32
|
local = false
|
33
33
|
|
34
34
|
options = args.last
|
35
35
|
if options.is_a?(Hash) and options[Pod::Prebuild.keyword] != nil
|
36
|
-
should_prebuild = options[Pod::Prebuild.keyword]
|
36
|
+
should_prebuild = options[Pod::Prebuild.keyword] && (not Pod::Podfile::DSL.framework_source_all)
|
37
37
|
local = (options[:path] != nil)
|
38
38
|
end
|
39
|
+
|
40
|
+
if Pod::Command::Install.all_use_source
|
41
|
+
should_prebuild = false
|
42
|
+
end
|
39
43
|
|
40
44
|
if should_prebuild and (not local)
|
41
45
|
old_method.bind(self).(name, *args)
|
@@ -11,13 +11,17 @@ module Pod
|
|
11
11
|
|
12
12
|
## --- option for setting using prebuild framework ---
|
13
13
|
def parse_prebuild_framework(name, requirements)
|
14
|
-
should_prebuild = Pod::Podfile::DSL.prebuild_all
|
14
|
+
should_prebuild = Pod::Podfile::DSL.prebuild_all && (not Pod::Podfile::DSL.framework_source_all)
|
15
15
|
|
16
16
|
options = requirements.last
|
17
17
|
if options.is_a?(Hash) && options[Pod::Prebuild.keyword] != nil
|
18
|
-
should_prebuild = options.delete(Pod::Prebuild.keyword)
|
18
|
+
should_prebuild = options.delete(Pod::Prebuild.keyword) && (not Pod::Podfile::DSL.framework_source_all)
|
19
19
|
requirements.pop if options.empty?
|
20
20
|
end
|
21
|
+
|
22
|
+
if Pod::Command::Install.all_use_source
|
23
|
+
should_prebuild = false
|
24
|
+
end
|
21
25
|
|
22
26
|
pod_name = Specification.root_name(name)
|
23
27
|
set_prebuild_for_pod(pod_name, should_prebuild)
|
@@ -32,6 +32,8 @@ def build_for_iosish_platform(sandbox,
|
|
32
32
|
# make less arch to iphone simulator for faster build
|
33
33
|
custom_build_options_simulator += ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'] if simulator == 'iphonesimulator'
|
34
34
|
|
35
|
+
custom_build_options += ['ARCHS=arm64']
|
36
|
+
|
35
37
|
is_succeed, _ = xcodebuild(sandbox, target_label, device, deployment_target, other_options + custom_build_options)
|
36
38
|
exit 1 unless is_succeed
|
37
39
|
is_succeed, _ = xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + custom_build_options_simulator)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-binaryhqp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- leavez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- lib/cocoapods-binaryhqp/Integration.rb
|
119
119
|
- lib/cocoapods-binaryhqp/Main.rb
|
120
120
|
- lib/cocoapods-binaryhqp/Prebuild.rb
|
121
|
+
- lib/cocoapods-binaryhqp/command_option/command_option.rb
|
121
122
|
- lib/cocoapods-binaryhqp/gem_version.rb
|
122
123
|
- lib/cocoapods-binaryhqp/helper/feature_switches.rb
|
123
124
|
- lib/cocoapods-binaryhqp/helper/names.rb
|