cocoapods-binaryhqp 0.4.9 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.vscode/launch.json +3 -1
- data/Gemfile.lock +2 -3
- data/README.md +9 -4
- data/lib/cocoapods-binaryhqp/Integration.rb +6 -3
- data/lib/cocoapods-binaryhqp/Main.rb +13 -2
- data/lib/cocoapods-binaryhqp/Prebuild.rb +66 -35
- data/lib/cocoapods-binaryhqp/command_option/command_option.rb +51 -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: 565caa20391d4ee0ad9cd3620069122545da6ad40faaf74907d1d2d3284cf2bf
|
4
|
+
data.tar.gz: bea179595b39bca57caee759a3de746fdfc4da037881f9cca9f8e08eb776a8f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5313617b1242d2e669e8cc11f8dc8dce6706f2736a01b676fbefec2d54b0ff2f41304819c3e33ef0941c4c7f600b37c424ce723fe16071eeebd9c657c97c826
|
7
|
+
data.tar.gz: a4b55835877d6b415b68ce5178c449846093ee40384351cb68f139bd6a7ffadba0e7e2175340ece7c9b00c7569287de4f5386cd5b79f904c75872fb37ec7a567
|
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", "--verbose"
|
11
|
+
// "args": ["update", "--verbose"]// `pod` 命令的参数
|
12
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
|
@@ -134,8 +145,8 @@ Pod::HooksManager.register('cocoapods-binaryhqp', :pre_install) do |installer_co
|
|
134
145
|
lockfile = installer_context.lockfile
|
135
146
|
binary_installer = Pod::Installer.new(prebuild_sandbox, prebuild_podfile, lockfile)
|
136
147
|
|
137
|
-
binary_installer.
|
138
|
-
|
148
|
+
binary_installer.delete_all_standard_sandbox_pod(standard_sandbox)
|
149
|
+
|
139
150
|
if binary_installer.have_exact_prebuild_cache? && !update
|
140
151
|
binary_installer.install_when_cache_hit!
|
141
152
|
else
|
@@ -146,6 +146,11 @@ module Pod
|
|
146
146
|
self.sandbox.exsited_framework_target_names.each do |name|
|
147
147
|
UI.puts "Using #{name}" if config.verbose
|
148
148
|
end
|
149
|
+
|
150
|
+
self.resolve_dependencies
|
151
|
+
#处理资源文件
|
152
|
+
self.handle_static_framework_resouces
|
153
|
+
|
149
154
|
end
|
150
155
|
|
151
156
|
def delete_standard_sand_box_pod(standard_sanbox)
|
@@ -155,11 +160,61 @@ module Pod
|
|
155
160
|
|
156
161
|
need_update_pods.each do |pod_name|
|
157
162
|
pod_path = Pathname.new(standard_sanbox.root.to_s + "/#{pod_name}")
|
158
|
-
Pod::UI.puts("删除 #{pod_path.to_s}")
|
163
|
+
Pod::UI.puts("删除 #{pod_path.to_s}") if config.verbose
|
164
|
+
pod_path.rmtree if pod_path.exist?
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def delete_all_standard_sandbox_pod(standard_sanbox)
|
170
|
+
if lockfile
|
171
|
+
changes = lockfile.detect_changes_with_podfile(podfile)
|
172
|
+
need_update_pods = (changes[:added] + changes[:changed] + changes[:removed] + changes[:unchanged]).to_a
|
173
|
+
|
174
|
+
need_update_pods.each do |pod_name|
|
175
|
+
pod_path = Pathname.new(standard_sanbox.root.to_s + "/#{pod_name}")
|
176
|
+
Pod::UI.puts("删除 #{pod_path.to_s}") if config.verbose
|
159
177
|
pod_path.rmtree if pod_path.exist?
|
160
178
|
end
|
161
179
|
end
|
162
180
|
end
|
181
|
+
# 处理静态库资源
|
182
|
+
def handle_static_framework_resouces
|
183
|
+
all_static_framework_targets = pod_targets.reject{|pod_target| not pod_target.static_framework? or pod_target.resource_paths.empty? }
|
184
|
+
all_static_framework_targets.each do |target|
|
185
|
+
output_path = sandbox.framework_folder_path_for_target_name(target.name)
|
186
|
+
if target.static_framework? and !target.resource_paths.empty?
|
187
|
+
framework_path = output_path + target.framework_name
|
188
|
+
standard_sandbox_path = sandbox.standard_sanbox_path
|
189
|
+
resources = begin
|
190
|
+
if Pod::VERSION.start_with? "1.5"
|
191
|
+
target.resource_paths
|
192
|
+
else
|
193
|
+
# resource_paths is Hash{String=>Array<String>} on 1.6 and above
|
194
|
+
# (use AFNetworking to generate a demo data)
|
195
|
+
# https://github.com/leavez/cocoapods-binary/issues/50
|
196
|
+
target.resource_paths.values.flatten
|
197
|
+
end
|
198
|
+
end
|
199
|
+
raise "Wrong type: #{resources}" unless resources.kind_of? Array
|
200
|
+
|
201
|
+
path_objects = resources.map do |path|
|
202
|
+
prebuild_real_path = (path.gsub('${PODS_ROOT}', sandbox.root.to_s) if path.start_with? '${PODS_ROOT}')|| ""
|
203
|
+
real_file_path = framework_path + File.basename(path)
|
204
|
+
if Pathname.new(prebuild_real_path).exist? and not Pathname.new(real_file_path).exist?
|
205
|
+
# 静态库的resource,拷贝至framework目录下
|
206
|
+
FileUtils.cp_r(prebuild_real_path, real_file_path, :remove_destination => true)
|
207
|
+
end
|
208
|
+
object = Prebuild::Passer::ResourcePath.new
|
209
|
+
object.real_file_path = real_file_path
|
210
|
+
object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'
|
211
|
+
object.target_file_path = path.gsub("${PODS_CONFIGURATION_BUILD_DIR}", standard_sandbox_path.to_s) if path.start_with? "${PODS_CONFIGURATION_BUILD_DIR}"
|
212
|
+
object
|
213
|
+
end
|
214
|
+
Prebuild::Passer.resources_to_copy_for_static_framework[target.name] = path_objects
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
163
218
|
|
164
219
|
|
165
220
|
# Build the needed framework files
|
@@ -213,7 +268,6 @@ module Pod
|
|
213
268
|
|
214
269
|
targets = targets.reject {|pod_target| sandbox.local?(pod_target.pod_name) }
|
215
270
|
|
216
|
-
|
217
271
|
# build!
|
218
272
|
Pod::UI.puts "Prebuild frameworks (total #{targets.count})"
|
219
273
|
Pod::Prebuild.remove_build_dir(sandbox_path)
|
@@ -227,37 +281,13 @@ module Pod
|
|
227
281
|
output_path.rmtree if output_path.exist?
|
228
282
|
output_path.mkpath unless output_path.exist?
|
229
283
|
Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator)
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
framework_path = output_path + target.framework_name
|
234
|
-
standard_sandbox_path = sandbox.standard_sanbox_path
|
235
|
-
|
236
|
-
resources = begin
|
237
|
-
if Pod::VERSION.start_with? "1.5"
|
238
|
-
target.resource_paths
|
239
|
-
else
|
240
|
-
# resource_paths is Hash{String=>Array<String>} on 1.6 and above
|
241
|
-
# (use AFNetworking to generate a demo data)
|
242
|
-
# https://github.com/leavez/cocoapods-binary/issues/50
|
243
|
-
target.resource_paths.values.flatten
|
244
|
-
end
|
245
|
-
end
|
246
|
-
raise "Wrong type: #{resources}" unless resources.kind_of? Array
|
247
|
-
|
248
|
-
path_objects = resources.map do |path|
|
249
|
-
object = Prebuild::Passer::ResourcePath.new
|
250
|
-
object.real_file_path = framework_path + File.basename(path)
|
251
|
-
object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'
|
252
|
-
object.target_file_path = path.gsub("${PODS_CONFIGURATION_BUILD_DIR}", standard_sandbox_path.to_s) if path.start_with? "${PODS_CONFIGURATION_BUILD_DIR}"
|
253
|
-
object
|
254
|
-
end
|
255
|
-
Prebuild::Passer.resources_to_copy_for_static_framework[target.name] = path_objects
|
256
|
-
end
|
257
|
-
|
258
|
-
end
|
284
|
+
end
|
285
|
+
# check static_framework resources
|
286
|
+
self.handle_static_framework_resouces
|
259
287
|
Pod::Prebuild.remove_build_dir(sandbox_path)
|
260
288
|
|
289
|
+
|
290
|
+
|
261
291
|
|
262
292
|
# copy vendored libraries and frameworks
|
263
293
|
targets.each do |target|
|
@@ -297,10 +327,11 @@ module Pod
|
|
297
327
|
useless_target_names = sandbox.exsited_framework_target_names.reject do |name|
|
298
328
|
all_needed_names.include? name
|
299
329
|
end
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
330
|
+
# 不删除已经编译好的framework
|
331
|
+
# useless_target_names.each do |name|
|
332
|
+
# path = sandbox.framework_folder_path_for_target_name(name)
|
333
|
+
# path.rmtree if path.exist?
|
334
|
+
# end
|
304
335
|
|
305
336
|
if not Podfile::DSL.dont_remove_source_code
|
306
337
|
# only keep manifest.lock and framework folder in _Prebuild
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Install < Command
|
4
|
+
@@use_source = false
|
5
|
+
|
6
|
+
class << self
|
7
|
+
alias :original_options :options
|
8
|
+
end
|
9
|
+
def self.options
|
10
|
+
[['--hsource', 'from cocoapods-binaryhqp, all frameworks use source code']].concat(original_options)
|
11
|
+
end
|
12
|
+
|
13
|
+
alias :original_initialize :initialize
|
14
|
+
def initialize(argv)
|
15
|
+
@@use_source = argv.flag?('hsource', false)
|
16
|
+
original_initialize(argv)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.all_use_source
|
20
|
+
@@use_source
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.set_all_use_source(use)
|
24
|
+
@@use_source = use
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
module Pod
|
33
|
+
class Command
|
34
|
+
class Update < Command
|
35
|
+
class << self
|
36
|
+
alias :original_options :options
|
37
|
+
end
|
38
|
+
def self.options
|
39
|
+
[['--hsource', 'from cocoapods-binaryhqp, all frameworks use source code']].concat(original_options)
|
40
|
+
end
|
41
|
+
|
42
|
+
alias :original_initialize :initialize
|
43
|
+
def initialize(argv)
|
44
|
+
use = argv.flag?('hsource', false)
|
45
|
+
Pod::Command::Install.set_all_use_source(use)
|
46
|
+
original_initialize(argv)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
@@ -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.3
|
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
|