cocoapods-meitu-bin 1.3.0 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10fbbb2a4ad0c86bbae1e71d4c93482c4c41f3f09fb58b57dcf3f2f3a76d8907
4
- data.tar.gz: fa321bbb4812aa3b48ea7b476df5d16554015d7c0d34b32e71cdcce24590ed79
3
+ metadata.gz: bf922746db89582b7329cf9c703a49ea506e2d1384507e7752587d3b9de4123b
4
+ data.tar.gz: ebdb54496afee8b0e0e57bf6e31358b743e204a895c2d0c45fead0813ac0c102
5
5
  SHA512:
6
- metadata.gz: 41081d2f10314f7d6133608c9caae31a6aab43546199d5ec8759fa56e1f3acddd5068e616344d5543f7215258e5fb0c7907a87eee73dd873f19ce563f64cde6a
7
- data.tar.gz: d875fa4ca53418bb58477892185cf4dcd4c4f6d7189b96aed8369dfb6b8177a6a6664e85768b1a831072fcc11e428c814ba9bb51352fc74cc6a648d49bb9b08d
6
+ metadata.gz: ab9245d4c070947805daae07dc13c7376e104ffe405aaa2dbaaaa84a1970cdb90262b0219a518e309c96df2f9ca94ec0d708fc227f1fc1dd7c8bed438bad22eb
7
+ data.tar.gz: e98017a256e5c3e56e27054019654bc12b3b45c4e21d18d1274d7333132fe7cd332c857d1048406a632a3cdaeacb822e20918d41450575c2b953350898f8d0d2
@@ -153,35 +153,17 @@ module Pod
153
153
 
154
154
  # 获取 podfile
155
155
  def podfile
156
- @podfile ||= begin
157
- podfile_path = File.join(Pathname.pwd, 'Podfile')
158
- raise Informative, 'Podfile不存在' unless File.exist?(podfile_path)
159
- sources_manager = Pod::Config.instance.sources_manager
160
- podfile = Podfile.from_file(Pathname.new(podfile_path))
161
- podfile_hash = podfile.to_hash
162
- podfile_hash['sources'] = (podfile_hash['sources'] || []).concat(sources_manager.code_source_list.map(&:url))
163
- podfile_hash['sources'] << sources_manager.binary_source.url
164
- podfile_hash['sources'].uniq!
165
- Podfile.from_hash(podfile_hash)
166
- end
156
+ @podfile ||= Pod::Config.instance.podfile
167
157
  end
168
158
 
169
159
  # 获取 podfile.lock
170
160
  def lockfile
171
- @lockfile ||= begin
172
- lock_path = File.join(Pathname.pwd, 'Podfile.lock')
173
- raise Informative, 'Podfile.lock不存在,请执行pod install' unless File.exist?(lock_path)
174
- Lockfile.from_file(Pathname.new(lock_path))
175
- end
161
+ @lockfile ||= Pod::Config.instance.lockfile
176
162
  end
177
163
 
178
164
  # 获取 sandbox
179
165
  def sandbox
180
- @sandbox ||= begin
181
- sandbox_path = File.join(Pathname.pwd, 'Pods')
182
- raise Informative, 'Pods文件夹不存在,请执行pod install' unless File.exist?(sandbox_path)
183
- Pod::Sandbox.new(sandbox_path)
184
- end
166
+ @sandbox ||= Pod::Config.instance.sandbox
185
167
  end
186
168
 
187
169
  # 根据podfile和podfile.lock分析依赖
@@ -17,12 +17,14 @@ module Pod
17
17
 
18
18
  def self.options
19
19
  [
20
- %w[--error-source 过滤异常的source,比如http的,CI打包只支持SSH认证]
20
+ %w[--error-source 过滤异常的source,比如http的,CI打包只支持SSH认证],
21
+ %w[--export-file 导出当前所有tag版本的podspec]
21
22
  ].concat(super).uniq
22
23
  end
23
24
 
24
25
  def initialize(argv)
25
26
  @error_source = argv.flag?('error-source', false)
27
+ @export_file = argv.flag?('export-file', false)
26
28
  super
27
29
  end
28
30
 
@@ -33,8 +35,26 @@ module Pod
33
35
  repo_update
34
36
  # 分析依赖
35
37
  @analyze_result = analyse
36
- # 打印source
37
- show_cost_source
38
+
39
+ if @error_source
40
+ # 打印source
41
+ show_cost_source
42
+ end
43
+
44
+ if @export_file
45
+ pod_targets = @analyze_result.pod_targets.uniq
46
+ pod_targets.map { |pod_target|
47
+ current_path = Dir.pwd
48
+ spec_path = "#{current_path}/podfile_shell/#{pod_target.root_spec.name}/#{pod_target.root_spec.version.version}/"
49
+ `mkdir -p #{spec_path}`
50
+ if system("cp #{pod_target.root_spec.defined_in_file.to_s} #{spec_path} > /dev/null 2>&1")
51
+ puts "#{pod_target.root_spec.name} 的 #{pod_target.root_spec.version.version} 已经导出"
52
+ else
53
+ `rm -rf #{current_path}/podfile_shell/#{pod_target.root_spec.name} > /dev/null 2>&1`
54
+ end
55
+ # puts pod_target.root_spec.name pod_target.root_spec.version.version pod_target.root_spec.defined_in_file
56
+ }
57
+ end
38
58
  # 计算耗时
39
59
  show_cost_time
40
60
  end
@@ -1,5 +1,5 @@
1
1
  module CBin
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.2"
3
3
  end
4
4
 
5
5
  module Pod
@@ -132,7 +132,7 @@ module Pod
132
132
 
133
133
  start_time = Time.now
134
134
  @activated = Molinillo::Resolver.new(self, self).resolve(dependencies, locked_dependencies)
135
- UI.puts "Molinillo resolve耗时:#{'%.1f' % (Time.now - start_time)}s".green
135
+ UI.puts "pod_time_profiler: Molinillo resolve耗时:#{'%.1f' % (Time.now - start_time)}s".green
136
136
  resolver_specs_by_target
137
137
  rescue Molinillo::ResolverError => e
138
138
  handle_resolver_error(e)
@@ -15,7 +15,7 @@ def get_podfile_lock
15
15
  #获取 PODFILE CHECKSUM 用来判断服务端是否存在该podfile.lock
16
16
  checksum = get_checksum(Pod::Config.instance.podfile_path)
17
17
  PodUpdateConfig.set_checksum(checksum)
18
- #目前只支持MTXX target "MTXX" 项目 #想要支持其他项目可以添加对应 target "xxx"
18
+ #目前只支持MTXX target "MTXX" 项目 想要支持其他项目可以添加对应 target "xxx"
19
19
  content = File.read(Pod::Config.instance.podfile_path)
20
20
  if content
21
21
  if content.include?("target \"MTXX\"")
@@ -38,13 +38,13 @@ def get_podfile_lock
38
38
  end
39
39
  # podfile.lock文件下载和使用逻辑
40
40
  if is_load_podfile_lock
41
- Pod::UI.puts "当前podfile文件的checksum:#{checksum}".green
41
+ Pod::UI.puts "pod_time_profiler: 当前podfile文件的checksum:#{checksum}".green
42
42
  # zip下载地址
43
43
  curl = "https://xiuxiu-dl-meitu-com.obs.cn-north-4.myhuaweicloud.com/ios/binary/MTXX/#{checksum}/podfile.lock.zip"
44
44
  # 判断服务端是否存在该podfile.lock
45
45
  is_load_podfile_lock = false
46
46
  if system("curl -o /dev/null -s -w %{http_code} #{curl} | grep 200 > /dev/null 2>&1")
47
- Pod::UI.puts "匹配到精准podfile.lock文件,使用当前podfile文件的checksum:#{checksum}获取对应的podfile.lock文件".green
47
+ Pod::UI.puts "pod_time_profiler: 匹配到精准podfile.lock文件,使用当前podfile文件的checksum:#{checksum}获取对应的podfile.lock文件".green
48
48
  is_load_podfile_lock = true
49
49
  end
50
50
 
@@ -52,27 +52,27 @@ def get_podfile_lock
52
52
  branch_value = get_branch_name
53
53
  curl = "https://xiuxiu-dl-meitu-com.obs.cn-north-4.myhuaweicloud.com/ios/binary/MTXX/#{branch_value}/podfile.lock.zip"
54
54
  if system("curl -o /dev/null -s -w %{http_code} #{curl} | grep 200 > /dev/null 2>&1")
55
- Pod::UI.puts "无法匹配到精准podfile.lock文件,使用当前分支:#{branch_value} 对应的podfile.lock文件".green
55
+ Pod::UI.puts "pod_time_profiler: 无法匹配到精准podfile.lock文件,使用当前分支:#{branch_value} 对应的podfile.lock文件".green
56
56
  is_load_podfile_lock = true
57
57
  end
58
58
  #兜底使用develop的podfile.lock
59
59
  if !is_load_podfile_lock
60
- Pod::UI.puts "服务端不存在该podfile.lock文件,使用develop分支的podfile.lock文件兜底".green
60
+ Pod::UI.puts "pod_time_profiler: 服务端不存在该podfile.lock文件,使用develop分支的podfile.lock文件兜底".green
61
61
  curl = "https://xiuxiu-dl-meitu-com.obs.cn-north-4.myhuaweicloud.com/ios/binary/MTXX/develop/podfile.lock.zip"
62
62
  is_load_podfile_lock = true
63
63
  end
64
64
  end
65
65
  # 判断是否需要下载podfile.lock文件
66
66
  if is_load_podfile_lock
67
- Pod::UI.puts "获取服务端存储的podfile.lcok文件".green
67
+ Pod::UI.puts "pod_time_profiler: 获取服务端存储的podfile.lcok文件".green
68
68
  #下载并解压的podfile.zip文件
69
69
  if system("curl -O #{curl} > /dev/null 2>&1") && system("unzip -o podfile.lock.zip > /dev/null 2>&1")
70
- Pod::UI.puts "下载并解压podfile.lcok文件成功".green
70
+ Pod::UI.puts "pod_time_profiler: 下载并解压podfile.lcok文件成功".green
71
71
  `rm -rf podfile.lock.zip`
72
72
  # 设置获取到的podfile.lock对象
73
73
  PodUpdateConfig.set_lockfile(Pod::Config.instance.installation_root + 'Podfile.lock')
74
74
  #获取analyzer
75
- Pod::UI.puts "提前根据checksum命中podfile.lcok进行依赖分析".green
75
+ Pod::UI.puts "pod_time_profiler: 提前根据checksum命中podfile.lcok进行依赖分析".green
76
76
  analyzer = Pod::Installer::Analyzer.new(
77
77
  Pod::Config.instance.sandbox,
78
78
  Pod::Config.instance.podfile,
@@ -89,13 +89,13 @@ def get_podfile_lock
89
89
  end
90
90
  end
91
91
  else
92
- puts "获取podfile.lcok文件失败"
92
+ puts "pod_time_profiler: 获取podfile.lcok文件失败"
93
93
  `rm -rf podfile.lock.zip`
94
94
  end
95
95
  end
96
96
  end
97
97
  rescue => error
98
- puts "podfile.lcok相关处理发生异常,报错原因:#{error}"
98
+ puts "pod_time_profiler: podfile.lcok相关处理发生异常,报错原因:#{error}"
99
99
  PodUpdateConfig.clear
100
100
  `rm -rf podfile.lock.zip`
101
101
  `rm -rf podfile.lock`
@@ -109,20 +109,20 @@ def upload_podfile_lock(checksum,upload = false)
109
109
  curl = "https://xiuxiu-dl-meitu-com.obs.cn-north-4.myhuaweicloud.com/ios/binary/MTXX/#{checksum}/podfile.lock.zip"
110
110
  # 服务端不存在该podfiel.lock文件才上传,避免频繁上报同一个文件
111
111
  if upload || !system("curl -o /dev/null -s -w %{http_code} #{curl} | grep 200 > /dev/null 2>&1")
112
- Pod::UI.puts "根据checksum:#{checksum}上报podfile.lcok文件到服务端".green
112
+ Pod::UI.puts "pod_time_profiler: 根据checksum:#{checksum}上报podfile.lcok文件到服务端".green
113
113
  if upload
114
- puts "mbox工作目录/mtxx/MTXX/podfile 对应的checksum = #{checksum}"
114
+ puts "pod_time_profiler: mbox工作目录/mtxx/MTXX/podfile 对应的checksum = #{checksum}"
115
115
  end
116
116
  if system("zip podfile.lock.zip Podfile.lock > /dev/null 2>&1") && system("curl -F \"name=MTXX\" -F \"version=#{checksum}\" -F \"file=@#{Pathname.pwd}/podfile.lock.zip\" http://nezha.community.cloud.meitu.com/file/upload.json > /dev/null 2>&1")
117
- Pod::UI.puts "上报podfile.lcok文件到服务端成功".green
117
+ Pod::UI.puts "pod_time_profiler: 上报podfile.lcok文件到服务端成功".green
118
118
  `rm -rf podfile.lock.zip`
119
119
  else
120
- Pod::UI.puts "上报podfile.lcok文件到服务端失败".red
120
+ Pod::UI.puts "pod_time_profiler: 上报podfile.lcok文件到服务端失败".red
121
121
  `rm -rf podfile.lock.zip`
122
122
  end
123
123
  end
124
124
  rescue => error
125
- puts "上传podfile.lcok文件失败,失败原因:#{error}"
125
+ puts "pod_time_profiler: 上传podfile.lcok文件失败,失败原因:#{error}"
126
126
  `rm -rf podfile.zip`
127
127
  end
128
128
  end
@@ -134,7 +134,7 @@ def upload_mbox_podfile_lock
134
134
  upload_podfile_lock(checksum,true )
135
135
  end
136
136
  rescue => error
137
- puts "mbox podfile.lcok文件兼容处理失败,失败原因:#{error}"
137
+ puts "pod_time_profiler: mbox podfile.lcok文件兼容处理失败,失败原因:#{error}"
138
138
  end
139
139
  end
140
140
  def upload_branch_podfile_lock
@@ -142,10 +142,10 @@ def upload_branch_podfile_lock
142
142
  branch_value = get_branch_name
143
143
  if branch_value && branch_value.is_a?(String) && branch_value.length > 0
144
144
  if system("zip podfile.lock.zip Podfile.lock > /dev/null 2>&1") && system("curl -F \"name=MTXX\" -F \"version=#{branch_value}\" -F \"file=@#{Pathname.pwd}/podfile.lock.zip\" http://nezha.community.cloud.meitu.com/file/upload.json > /dev/null 2>&1")
145
- Pod::UI.puts "根据开发分支名:#{branch_value}上报podfile.lcok文件到服务端成功".green
145
+ Pod::UI.puts "pod_time_profiler: 根据开发分支名:#{branch_value}上报podfile.lcok文件到服务端成功".green
146
146
  `rm -rf podfile.lock.zip`
147
147
  else
148
- Pod::UI.puts "根据开发分支名:#{branch_value}上报podfile.lcok文件到服务端失败".red
148
+ Pod::UI.puts "pod_time_profiler: 根据开发分支名:#{branch_value}上报podfile.lcok文件到服务端失败".red
149
149
  `rm -rf podfile.lock.zip`
150
150
  end
151
151
  end
@@ -201,14 +201,17 @@ Pod::HooksManager.register('cocoapods-meitu-bin', :pre_install) do |_context|
201
201
  require 'cocoapods-meitu-bin/native'
202
202
  require 'cocoapods-meitu-bin/helpers/buildAll/bin_helper'
203
203
  Pod::UI.puts "当前configuration: `#{ENV['configuration'] || Pod::Config.instance.podfile.configuration}`".green
204
- # checksum = Pod::Config.instance.podfile.checksum
205
- # puts Pod::Config.instance
206
- # installer = Installer.new(config.sandbox, config.podfile, config.lockfile)
207
- # puts checksum
208
204
  # pod bin repo update 更新二进制私有源
209
205
  Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new($ARGV)).run
210
-
211
- get_podfile_lock
206
+ content = File.read(Pod::Config.instance.podfile_path)
207
+ if content
208
+ if content.include?("target \"MTXX\"")
209
+ PodUpdateConfig.set_is_mtxx(true)
210
+ else
211
+ PodUpdateConfig.set_is_mtxx(false)
212
+ end
213
+ end
214
+ # get_podfile_lock
212
215
 
213
216
  # 有插件/本地库 且是dev环境下,默认进入源码白名单 过滤 archive命令
214
217
  if _context.podfile.plugins.keys.include?('cocoapods-meitu-bin') && _context.podfile.configuration_env == 'dev'
@@ -242,17 +245,17 @@ Pod::HooksManager.register('cocoapods-meitu-bin', :pre_install) do |_context|
242
245
  PodUpdateConfig.set_prepare_time(Time.now - start_time)
243
246
  end
244
247
 
245
- # 注册 pod install 钩子
246
- Pod::HooksManager.register('cocoapods-meitu-bin', :post_install) do |context|
247
- #基于podfile的checksum上报云端podfile.lock文件
248
- if PodUpdateConfig.is_mtxx
249
- if PodUpdateConfig.checksum
250
- upload_podfile_lock(PodUpdateConfig.checksum)
251
- end
252
- upload_branch_podfile_lock
253
- end
254
-
255
- end
248
+ # # 注册 pod install 钩子
249
+ # Pod::HooksManager.register('cocoapods-meitu-bin', :post_install) do |context|
250
+ # #基于podfile的checksum上报云端podfile.lock文件
251
+ # if PodUpdateConfig.is_mtxx
252
+ # if PodUpdateConfig.checksum
253
+ # upload_podfile_lock(PodUpdateConfig.checksum)
254
+ # end
255
+ # upload_branch_podfile_lock
256
+ # end
257
+ #
258
+ # end
256
259
 
257
260
  Pod::HooksManager.register('cocoapods-meitu-bin', :source_provider) do |context, _|
258
261
  sources_manager = Pod::Config.instance.sources_manager
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-meitu-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-12 00:00:00.000000000 Z
11
+ date: 2023-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -30,20 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.10.2
34
- - - "<="
35
- - !ruby/object:Gem::Version
36
- version: 1.11.2
33
+ version: '0'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - ">="
42
39
  - !ruby/object:Gem::Version
43
- version: 1.10.2
44
- - - "<="
45
- - !ruby/object:Gem::Version
46
- version: 1.11.2
40
+ version: '0'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: cocoapods-generate
49
43
  requirement: !ruby/object:Gem::Requirement