cocoapods-mtxx-bin 0.0.10 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40602fdc840e2eb27939c1f3eaffb2d008c35ac79834e9388a254b5663138510
4
- data.tar.gz: bde311b8c960a178b1c033715d60e22281b97a90143602649ed4edff83d5ac51
3
+ metadata.gz: f14e9ea300e62342de7ad1999cba481413d19066015bba58eaffb5a75c95001c
4
+ data.tar.gz: 5adc6de925603cc92ef507d48e77033d6d828d3e9503adfa9ea13a942771608e
5
5
  SHA512:
6
- metadata.gz: 6061d7be0b25cf7270f789cac3fa6984029a47ff4856c769615a96777a9b968b7de071d6eeb857729f15a18126293ff24571722b811e8ef807ac75116cf9a336
7
- data.tar.gz: 8c1d5822f00a15c3613b4b9bb1a2b23c92e95e478c5e98fee6b92746d3d126c18351f6c64ea11895735995b6843f08b5196ab2e13ffb8a07f0c0a29c3c0cd420
6
+ metadata.gz: d302ef5efe2bdfba39904c903a68f779c7ae409276d4271a78f6663725af5d6f546322ca0a3693c595ca3cbea5adf0cb91067a7cf06b5eaa8fefca51b1bdb319
7
+ data.tar.gz: f239253f6770287351b31fb9da0486272948a07036e59b50ec09651a8ed13f5c9da6893d3cce2f3b2b6c9ab41bf8e70fe46f243f028940e4d2d385e7816b81c8
@@ -1,5 +1,5 @@
1
1
  module CBin
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.13"
3
3
  end
4
4
 
5
5
  module Pod
@@ -0,0 +1,36 @@
1
+ module CBin
2
+ class PodSize
3
+ include Pod
4
+
5
+ # 存放大于阈值的Pod
6
+ @@pods = []
7
+ # 阈值,单位MB
8
+ @@size_threshold = 500
9
+
10
+ # 添加超过阈值的pod
11
+ def self.add_pod(pod)
12
+ if pod['size'].to_i < @@size_threshold * 1024
13
+ return
14
+ end
15
+ @@pods << pod
16
+ end
17
+
18
+ # 打印超过阈值的Pod库
19
+ def self.print_pods
20
+ if @@pods.empty?
21
+ return
22
+ end
23
+ UI.puts "\n"
24
+ UI.puts "以下Pod库下载大小大于阈值`#{@@size_threshold}MB`:".green
25
+ @@pods.map do |pod|
26
+ unit = 'KB'
27
+ size = pod['size'].to_i
28
+ if size >= 1024
29
+ unit = 'MB'
30
+ size = ('%.1f' % (size / 1024.0)).to_f
31
+ end
32
+ UI.puts " - #{pod['name']}:#{size}#{unit}".green
33
+ end
34
+ end
35
+ end
36
+ end
@@ -16,7 +16,7 @@ module Pod
16
16
  env_option :warn_for_unsecure_source, false
17
17
 
18
18
  # 是否多线程执行 install_pod_sources
19
- env_option :install_with_multi_threads, true
19
+ env_option :install_with_multi_threads, false
20
20
 
21
21
  # 是否多进程执行 update_repositories
22
22
  env_option :update_source_with_multi_threads, false
@@ -3,9 +3,18 @@ require 'parallel'
3
3
  require 'cocoapods'
4
4
  require 'xcodeproj'
5
5
  require 'cocoapods-mtxx-bin/native/pod_source_installer'
6
+ require 'cocoapods-mtxx-bin/helpers/pod_size_helper'
6
7
 
7
8
  module Pod
8
9
  class Installer
10
+ alias mtxx_create_analyzer create_analyzer
11
+ def create_analyzer(plugin_sources = nil)
12
+ # 修复MBox下即使存在Podfile.lock依赖分析依然很慢的问题
13
+ if !lockfile.nil? && lockfile.internal_data.empty?
14
+ @lockfile = Lockfile.from_file(config.lockfile_path) if config.lockfile_path
15
+ end
16
+ mtxx_create_analyzer(plugin_sources)
17
+ end
9
18
 
10
19
  def cost_time_hash
11
20
  @cost_time_hash ||= begin
@@ -56,10 +65,21 @@ module Pod
56
65
  end
57
66
 
58
67
  # 写入lock文件
59
- alias old_write_lockfiles write_lockfiles
60
68
  def write_lockfiles
61
69
  start_time = Time.now
62
- old_write_lockfiles
70
+ @lockfile = generate_lockfile
71
+
72
+ UI.message "- Writing Lockfile in #{UI.path config.lockfile_path}" do
73
+ # No need to invoke Sandbox#update_changed_file here since this logic already handles checking if the
74
+ # contents of the file are the same.
75
+ @lockfile.write_to_disk(config.lockfile_path)
76
+ end
77
+
78
+ UI.message "- Writing Manifest in #{UI.path sandbox.manifest_path}" do
79
+ # No need to invoke Sandbox#update_changed_file here since this logic already handles checking if the
80
+ # contents of the file are the same.
81
+ @lockfile.write_to_disk(sandbox.manifest_path)
82
+ end
63
83
  cost_time_hash['write_lockfiles'] = Time.now - start_time
64
84
  end
65
85
 
@@ -71,6 +91,8 @@ module Pod
71
91
  cost_time_hash['perform_post_install_actions'] = Time.now - start_time
72
92
  # 打印耗时
73
93
  print_cost_time
94
+ # 打印大小大于阈值的库
95
+ CBin::PodSize.print_pods
74
96
  end
75
97
 
76
98
  # 打印耗时
@@ -80,7 +102,7 @@ module Pod
80
102
  UI.info "|#{'Stage'.center(30)}|#{'Time(s)'.center(15)}|".green
81
103
  UI.info '———————————————————————————————————————————————'.green
82
104
  cost_time_hash.each do |key, value|
83
- UI.info "|#{key.center(30)}|#{value.to_s.center(15)}|".green
105
+ UI.info "|#{key.center(30)}|#{('%.3f' % value).to_s.center(15)}|".green
84
106
  end
85
107
  UI.info '———————————————————————————————————————————————'.green
86
108
  end
@@ -159,6 +181,7 @@ module Pod
159
181
 
160
182
  module Downloader
161
183
  class Cache
184
+ require 'cocoapods-mtxx-bin/helpers/pod_size_helper'
162
185
  # 多线程锁
163
186
  @@lock = Mutex.new
164
187
 
@@ -180,6 +203,30 @@ module Pod
180
203
  version_file.open('w') { |f| f << Pod::VERSION }
181
204
  end
182
205
  end
206
+
207
+ def uncached_pod(request)
208
+ in_tmpdir do |target|
209
+ result, podspecs = download(request, target)
210
+ result.location = nil
211
+
212
+ # 记录下载大小大于阈值的库及大小
213
+ if File.exist?(target.to_s)
214
+ dir_size = `du -sk #{target.to_s}`.strip().split(' ')[0]
215
+ CBin::PodSize.add_pod({'name' => request.name, 'size' => dir_size})
216
+ end
217
+
218
+ podspecs.each do |name, spec|
219
+ destination = path_for_pod(request, :name => name, :params => result.checkout_options)
220
+ copy_and_clean(target, destination, spec)
221
+ write_spec(spec, path_for_spec(request, :name => name, :params => result.checkout_options))
222
+ if request.name == name
223
+ result.location = destination
224
+ end
225
+ end
226
+
227
+ result
228
+ end
229
+ end
183
230
  end
184
231
  end
185
232
  end
@@ -42,5 +42,28 @@ module Pod
42
42
  end
43
43
  result
44
44
  end
45
+
46
+ class << self
47
+ def generate_spec_repos(spec_repos)
48
+ result = Hash.new
49
+ spec_repos.map do |source, specs|
50
+ next unless source
51
+ next if specs.empty?
52
+ key = source.url || source.name
53
+
54
+ # save `trunk` as 'trunk' so that the URL itself can be changed without lockfile churn
55
+ key = Pod::TrunkSource::TRUNK_REPO_NAME if source.name == Pod::TrunkSource::TRUNK_REPO_NAME
56
+
57
+ value = specs.map { |s| s.root.name }.uniq
58
+ # 合并重复的source源,而不是替换
59
+ if result[key].nil?
60
+ result[key] = YAMLHelper.sorted_array(value)
61
+ else
62
+ result[key] = YAMLHelper.sorted_array(result[key].concat(value))
63
+ end
64
+ end
65
+ result.compact
66
+ end
67
+ end
45
68
  end
46
69
  end
@@ -133,7 +133,7 @@ module Pod
133
133
 
134
134
  start_time = Time.now
135
135
  @activated = Molinillo::Resolver.new(self, self).resolve(dependencies, locked_dependencies)
136
- UI.puts "Molinillo resolve耗时:#{Time.now - start_time}".green
136
+ UI.puts "Molinillo resolve耗时:#{'%.1f' % (Time.now - start_time)}s".green
137
137
  resolver_specs_by_target
138
138
  rescue Molinillo::ResolverError => e
139
139
  handle_resolver_error(e)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-mtxx-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-30 00:00:00.000000000 Z
11
+ date: 2022-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -135,6 +135,7 @@ files:
135
135
  - lib/cocoapods-mtxx-bin/helpers/framework_builder.rb
136
136
  - lib/cocoapods-mtxx-bin/helpers/library.rb
137
137
  - lib/cocoapods-mtxx-bin/helpers/library_builder.rb
138
+ - lib/cocoapods-mtxx-bin/helpers/pod_size_helper.rb
138
139
  - lib/cocoapods-mtxx-bin/helpers/sources_helper.rb
139
140
  - lib/cocoapods-mtxx-bin/helpers/spec_creator.rb
140
141
  - lib/cocoapods-mtxx-bin/helpers/spec_files_helper.rb