cocoapods-binaryhqp 0.5.0 → 0.5.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41a7a422607d24a0693df14db38d1ce0fa9db2063693eb4d134dd08372eb2aff
4
- data.tar.gz: 230ef35f4cbde58d0a22f23982eb91271e8f18e793792f15f5a865511ed964dd
3
+ metadata.gz: 6b2590d684da0288a98be729d7b148fff1f7691bbcfa5143dc7b1c8c5d2e6349
4
+ data.tar.gz: 28c3ec9dfbc3fb050528817913e9fefbf7edd03fb5346840654d0971a5362c96
5
5
  SHA512:
6
- metadata.gz: 0b976845e07ef81b004f2e3b8b798cf2784fbad540e29bd335127b6b47ddef9b35c0f6eb76970cf86e2ee52e7a0433d7f51926c38f9002435648830e86b4ab01
7
- data.tar.gz: 3ec892b95c5f4d510f14d21afda29990603747b5efd5b49d87388cad77de5f0481c90c3f38725c7be240033e8ea8dc5911b5aa730bb487c77ce862e6195f0402
6
+ metadata.gz: afe7d2c2c22fe9103efe1ea68bda2957ec65db9de37f9bb741971243357266dabfd1a09feefe4cb816a5090e8049283283773a74551d66382ec1a54965b61c3b
7
+ data.tar.gz: 050e1562ea4f15f780a2b6ddae72633a0870dc12413fbc0c9f5561bc38914655e5592c05c4e54b183871078d36cc3fa36618a445fec1a062e1b7b17a3c192a88
data/.vscode/launch.json CHANGED
@@ -8,10 +8,10 @@
8
8
  "useBundler": true,
9
9
  "cwd": "${workspaceRoot}/demo", // pod 命令执行的路径
10
10
  "program": "/usr/local/bin/pod",
11
- // "args": ["update", "--verbose","--sources=http://gitlab.9tong.com/ios-group/HQPFoundation/hqpspecs.git"], // `pod` 命令的参数
12
- // "args": ["install", "--verbose"]
13
- // "args": ["install","--hsource"]
14
- "args":["install", "--help"]
11
+ // "args": ["update", "--verbose"]// `pod` 命令的参数
12
+ "args": ["install", "--verbose"]
13
+ // "args": ["install","--hsource", "--verbose"]
14
+ // "args":["install", "--help"]
15
15
  }
16
16
  ]
17
17
  }
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
- sudo gem build cocoapods-binaryhqp.gemspec && sudo gem install cocoapods-binaryhqp-0.4.7.gem
36
+ ## 安装方法
37
+
38
+ sudo gem install cocoapods-binaryhqp
39
+
38
40
 
39
41
  ## Usage
40
42
 
41
43
  ``` ruby
42
- plugin 'cocoapods-binary'
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
- spec.attributes_hash["resource_bundles"] = nil
218
- spec.attributes_hash["resources"] ||= []
219
- spec.attributes_hash["resources"] += bundle_names.map{|n| n+".bundle"}
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
@@ -145,7 +145,7 @@ Pod::HooksManager.register('cocoapods-binaryhqp', :pre_install) do |installer_co
145
145
  lockfile = installer_context.lockfile
146
146
  binary_installer = Pod::Installer.new(prebuild_sandbox, prebuild_podfile, lockfile)
147
147
 
148
- binary_installer.delete_all_standard_sandbox_pod(standard_sandbox)
148
+
149
149
 
150
150
  if binary_installer.have_exact_prebuild_cache? && !update
151
151
  binary_installer.install_when_cache_hit!
@@ -154,6 +154,8 @@ Pod::HooksManager.register('cocoapods-binaryhqp', :pre_install) do |installer_co
154
154
  binary_installer.repo_update = repo_update
155
155
  binary_installer.install!
156
156
  end
157
+
158
+ binary_installer.delete_all_standard_sandbox_pod(standard_sandbox)
157
159
 
158
160
 
159
161
  # reset the environment
@@ -146,6 +146,14 @@ 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.sandbox
151
+ #处理静态库resources 资源文件
152
+ self.resolve_dependencies
153
+ self.download_dependencies
154
+
155
+ self.handle_static_framework_resouces
156
+
149
157
  end
150
158
 
151
159
  def delete_standard_sand_box_pod(standard_sanbox)
@@ -173,6 +181,43 @@ module Pod
173
181
  end
174
182
  end
175
183
  end
184
+ # 处理静态库资源
185
+ def handle_static_framework_resouces
186
+ all_static_framework_targets = pod_targets.reject{|pod_target| not pod_target.static_framework? or pod_target.resource_paths.empty? }
187
+ all_static_framework_targets.each do |target|
188
+ output_path = sandbox.framework_folder_path_for_target_name(target.name)
189
+ if target.static_framework? and !target.resource_paths.empty?
190
+ framework_path = output_path + target.framework_name
191
+ standard_sandbox_path = sandbox.standard_sanbox_path
192
+ resources = begin
193
+ if Pod::VERSION.start_with? "1.5"
194
+ target.resource_paths
195
+ else
196
+ # resource_paths is Hash{String=>Array<String>} on 1.6 and above
197
+ # (use AFNetworking to generate a demo data)
198
+ # https://github.com/leavez/cocoapods-binary/issues/50
199
+ target.resource_paths.values.flatten
200
+ end
201
+ end
202
+ raise "Wrong type: #{resources}" unless resources.kind_of? Array
203
+
204
+ path_objects = resources.map do |path|
205
+ prebuild_real_path = (path.gsub('${PODS_ROOT}', sandbox.root.to_s) if path.start_with? '${PODS_ROOT}')|| ""
206
+ real_file_path = framework_path + File.basename(path)
207
+ if Pathname.new(prebuild_real_path).exist? and not Pathname.new(real_file_path).exist?
208
+ # 静态库的resource,拷贝至framework目录下
209
+ FileUtils.cp_r(prebuild_real_path, real_file_path, :remove_destination => true)
210
+ end
211
+ object = Prebuild::Passer::ResourcePath.new
212
+ object.real_file_path = real_file_path
213
+ object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'
214
+ object.target_file_path = path.gsub("${PODS_CONFIGURATION_BUILD_DIR}", standard_sandbox_path.to_s) if path.start_with? "${PODS_CONFIGURATION_BUILD_DIR}"
215
+ object
216
+ end
217
+ Prebuild::Passer.resources_to_copy_for_static_framework[target.name] = path_objects
218
+ end
219
+ end
220
+ end
176
221
 
177
222
 
178
223
  # Build the needed framework files
@@ -226,7 +271,6 @@ module Pod
226
271
 
227
272
  targets = targets.reject {|pod_target| sandbox.local?(pod_target.pod_name) }
228
273
 
229
-
230
274
  # build!
231
275
  Pod::UI.puts "Prebuild frameworks (total #{targets.count})"
232
276
  Pod::Prebuild.remove_build_dir(sandbox_path)
@@ -240,37 +284,13 @@ module Pod
240
284
  output_path.rmtree if output_path.exist?
241
285
  output_path.mkpath unless output_path.exist?
242
286
  Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator)
243
-
244
- # save the resource paths for later installing
245
- if target.static_framework? and !target.resource_paths.empty?
246
- framework_path = output_path + target.framework_name
247
- standard_sandbox_path = sandbox.standard_sanbox_path
248
-
249
- resources = begin
250
- if Pod::VERSION.start_with? "1.5"
251
- target.resource_paths
252
- else
253
- # resource_paths is Hash{String=>Array<String>} on 1.6 and above
254
- # (use AFNetworking to generate a demo data)
255
- # https://github.com/leavez/cocoapods-binary/issues/50
256
- target.resource_paths.values.flatten
257
- end
258
- end
259
- raise "Wrong type: #{resources}" unless resources.kind_of? Array
260
-
261
- path_objects = resources.map do |path|
262
- object = Prebuild::Passer::ResourcePath.new
263
- object.real_file_path = framework_path + File.basename(path)
264
- object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'
265
- object.target_file_path = path.gsub("${PODS_CONFIGURATION_BUILD_DIR}", standard_sandbox_path.to_s) if path.start_with? "${PODS_CONFIGURATION_BUILD_DIR}"
266
- object
267
- end
268
- Prebuild::Passer.resources_to_copy_for_static_framework[target.name] = path_objects
269
- end
270
-
271
- end
287
+ end
288
+ # check static_framework resources
289
+ self.handle_static_framework_resouces
272
290
  Pod::Prebuild.remove_build_dir(sandbox_path)
273
291
 
292
+
293
+
274
294
 
275
295
  # copy vendored libraries and frameworks
276
296
  targets.each do |target|
@@ -323,6 +343,7 @@ module Pod
323
343
  filename = File.basename(file)
324
344
  not to_remain_files.include?(filename)
325
345
  end
346
+
326
347
  to_delete_files.each do |path|
327
348
  path.rmtree if path.exist?
328
349
  end
@@ -1,28 +1,51 @@
1
1
  module Pod
2
2
  class Command
3
3
  class Install < Command
4
-
4
+ @@use_source = false
5
+
6
+ class << self
7
+ alias :original_options :options
8
+ end
5
9
  def self.options
6
- [
7
- ['--hsource', 'from cocoapods-binaryhqp, all frameworks use source code'],
8
- ].concat(super).reject { |(name, _)| name == '--no-repo-update' }
10
+ [['--hsource', 'from cocoapods-binaryhqp, all frameworks use source code']].concat(original_options)
9
11
  end
10
12
 
13
+ alias :original_initialize :initialize
11
14
  def initialize(argv)
12
- super
13
15
  @@use_source = argv.flag?('hsource', false)
16
+ original_initialize(argv)
14
17
  end
15
18
 
16
19
  def self.all_use_source
17
20
  @@use_source
18
21
  end
19
22
 
20
- def self.run(argv)
21
- super(argv)
23
+ def self.set_all_use_source(use)
24
+ @@use_source = use
22
25
  end
23
26
 
24
27
 
25
28
  end
26
29
  end
27
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
28
51
 
@@ -1,3 +1,3 @@
1
1
  module CocoapodsBinaryHqp
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.4"
3
3
  end
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.5.0
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - leavez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-02 00:00:00.000000000 Z
11
+ date: 2021-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods