cocoapods-mtxx-bin 0.0.10 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-mtxx-bin/gem_version.rb +1 -1
- data/lib/cocoapods-mtxx-bin/helpers/pod_size_helper.rb +36 -0
- data/lib/cocoapods-mtxx-bin/native/installation_options.rb +1 -1
- data/lib/cocoapods-mtxx-bin/native/installer.rb +42 -3
- data/lib/cocoapods-mtxx-bin/native/lockfile.rb +23 -0
- data/lib/cocoapods-mtxx-bin/native/resolver.rb +1 -1
- 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: 6887cb67f5682b2edff6ac1e6ba31233d4b58a2ae509fecf4fcbcecd5e7af693
|
4
|
+
data.tar.gz: ce7199feb46ac2a4e2e49b30b6ee2e99acf26f4300164f4e7a6689f520c7de31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd5da7bb0b6476632cc6323ba276cf17264adcdfadd000aa1965333860905e43c74d3b8d5072414e81777f8cef92bea5c522057a473c5351e31b17626cf2d839
|
7
|
+
data.tar.gz: 8c4bc558c517cb54bb453026b1222f7f4ddadd67bffaba2c1a5b3868ff08288694b71a37daaa836ec36145c1da404246d93c4a60a2dd3dfb23bf8ffb5c88d8c1
|
@@ -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,
|
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,6 +3,7 @@ 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
|
@@ -56,10 +57,21 @@ module Pod
|
|
56
57
|
end
|
57
58
|
|
58
59
|
# 写入lock文件
|
59
|
-
alias old_write_lockfiles write_lockfiles
|
60
60
|
def write_lockfiles
|
61
61
|
start_time = Time.now
|
62
|
-
|
62
|
+
@lockfile = generate_lockfile
|
63
|
+
|
64
|
+
UI.message "- Writing Lockfile in #{UI.path config.lockfile_path}" do
|
65
|
+
# No need to invoke Sandbox#update_changed_file here since this logic already handles checking if the
|
66
|
+
# contents of the file are the same.
|
67
|
+
@lockfile.write_to_disk(config.lockfile_path)
|
68
|
+
end
|
69
|
+
|
70
|
+
UI.message "- Writing Manifest in #{UI.path sandbox.manifest_path}" do
|
71
|
+
# No need to invoke Sandbox#update_changed_file here since this logic already handles checking if the
|
72
|
+
# contents of the file are the same.
|
73
|
+
@lockfile.write_to_disk(sandbox.manifest_path)
|
74
|
+
end
|
63
75
|
cost_time_hash['write_lockfiles'] = Time.now - start_time
|
64
76
|
end
|
65
77
|
|
@@ -71,6 +83,8 @@ module Pod
|
|
71
83
|
cost_time_hash['perform_post_install_actions'] = Time.now - start_time
|
72
84
|
# 打印耗时
|
73
85
|
print_cost_time
|
86
|
+
# 打印大小大于阈值的库
|
87
|
+
CBin::PodSize.print_pods
|
74
88
|
end
|
75
89
|
|
76
90
|
# 打印耗时
|
@@ -80,7 +94,7 @@ module Pod
|
|
80
94
|
UI.info "|#{'Stage'.center(30)}|#{'Time(s)'.center(15)}|".green
|
81
95
|
UI.info '———————————————————————————————————————————————'.green
|
82
96
|
cost_time_hash.each do |key, value|
|
83
|
-
UI.info "|#{key.center(30)}|#{value.to_s.center(15)}|".green
|
97
|
+
UI.info "|#{key.center(30)}|#{('%.3f' % value).to_s.center(15)}|".green
|
84
98
|
end
|
85
99
|
UI.info '———————————————————————————————————————————————'.green
|
86
100
|
end
|
@@ -159,6 +173,7 @@ module Pod
|
|
159
173
|
|
160
174
|
module Downloader
|
161
175
|
class Cache
|
176
|
+
require 'cocoapods-mtxx-bin/helpers/pod_size_helper'
|
162
177
|
# 多线程锁
|
163
178
|
@@lock = Mutex.new
|
164
179
|
|
@@ -180,6 +195,30 @@ module Pod
|
|
180
195
|
version_file.open('w') { |f| f << Pod::VERSION }
|
181
196
|
end
|
182
197
|
end
|
198
|
+
|
199
|
+
def uncached_pod(request)
|
200
|
+
in_tmpdir do |target|
|
201
|
+
result, podspecs = download(request, target)
|
202
|
+
result.location = nil
|
203
|
+
|
204
|
+
# 记录下载大小大于阈值的库及大小
|
205
|
+
if File.exist?(target.to_s)
|
206
|
+
dir_size = `du -sk #{target.to_s}`.strip().split(' ')[0]
|
207
|
+
CBin::PodSize.add_pod({'name' => request.name, 'size' => dir_size})
|
208
|
+
end
|
209
|
+
|
210
|
+
podspecs.each do |name, spec|
|
211
|
+
destination = path_for_pod(request, :name => name, :params => result.checkout_options)
|
212
|
+
copy_and_clean(target, destination, spec)
|
213
|
+
write_spec(spec, path_for_spec(request, :name => name, :params => result.checkout_options))
|
214
|
+
if request.name == name
|
215
|
+
result.location = destination
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
result
|
220
|
+
end
|
221
|
+
end
|
183
222
|
end
|
184
223
|
end
|
185
224
|
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.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-01 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
|