cocoapods-meitu-bin 1.1.3 → 1.1.5

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: 56df1ca5fc20d16f6cdbc2aaada6d1118af7b0cb95867057da93ef80af119c85
4
- data.tar.gz: d0bd9f61753c5131fbb49ab175295b7de30fc88a568827199cda409fa4105ed6
3
+ metadata.gz: 466b8b10f18760c5cd7a468a4a4ee860bcec5650fc79be7622f4bd545eac6562
4
+ data.tar.gz: 140cfcba73e84f74f011a42d7d4e2f2a1c8366c5c74a3529d38da10b2c6b0f98
5
5
  SHA512:
6
- metadata.gz: 3b9c119faaf7a735b139d8bf84f277d603e035456e9e8bf0c437a331c8ce27c7685e4d7b10181170ec4e44692c01e77e033401673681098f1bd38fad5b8d70bf
7
- data.tar.gz: 7eea023f3c6fc7dbf97968fb08d7d8234d3acfb49e989cf722bc57cc851035868da1dda2f066ae56e61c252a82c3501a31322fe09ee13159da19cd463b800d09
6
+ metadata.gz: f5d00b8d229b43e33cd69997aa29f2856bde47fdd1701fc64ea9e0597bbd49e4758b1bd9b98de2f8fe2cf8d2e32af9e90fb083b2af134acdc5a39bfc440020c6
7
+ data.tar.gz: 8a0c5673d4ab1c328eba75fa07e9c48920e3d60571dca4214e32323defa762d139c94d298796d32e553eb7772685a485bc2a0df09fdc49f7fd3e6f84563a529c
@@ -151,6 +151,8 @@ end
151
151
  class PodUpdateConfig
152
152
  @@pods = []
153
153
  @@lockfile = nil
154
+ @@repo_update = true
155
+ @@prepare_time = 0
154
156
  def self.add_value(value)
155
157
  @@pods << value
156
158
  end
@@ -161,6 +163,19 @@ class PodUpdateConfig
161
163
  @@lockfile
162
164
  end
163
165
  # 一个类方法,用于显示数组中的值
166
+ def self.repo_update
167
+ @@repo_update
168
+ end
169
+ def self.set_repo_update
170
+ @@repo_update = false
171
+ end
172
+ def self.set_prepare_time(time)
173
+ @@prepare_time = time
174
+ end
175
+ def self.prepare_time
176
+ @@prepare_time
177
+ end
178
+
164
179
  def self.pods
165
180
  @@pods
166
181
  end
@@ -1,5 +1,5 @@
1
1
  module CBin
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.5"
3
3
  end
4
4
 
5
5
  module Pod
@@ -348,8 +348,22 @@ ibtool \
348
348
  fwks_dir = "#{result_product_dir}/fwks"
349
349
  FileUtils.mkdir(fwks_dir) unless File.exist?(fwks_dir)
350
350
  fwks.map do |fwk|
351
- `rsync -av #{fwk} #{fwks_dir}`
351
+ new_fwk = get_XCFrameworkIntermediates_path(fwk)
352
+ if new_fwk && File.exist?(new_fwk)
353
+ `rsync -av #{new_fwk} #{fwks_dir}`
354
+ else
355
+ `rsync -av #{fwk} #{fwks_dir}`
356
+ end
357
+ end
358
+ end
359
+ def get_XCFrameworkIntermediates_path(path)
360
+ # 使用正则表达式匹配并提取 AdsFramework
361
+ match = path.to_s.match(/\/([^\/]+)\.xcframework/)
362
+ if match
363
+ framework_path = "#{product_dir}/#{iphoneos}/XCFrameworkIntermediates/#{match[1]}/#{match[1]}.framework"
364
+ return framework_path
352
365
  end
366
+ return nil
353
367
  end
354
368
 
355
369
  # 拷贝 framework
@@ -27,7 +27,7 @@ module CBin
27
27
  # 处理vendored_libraries和vendored_frameworks
28
28
  spec['vendored_libraries'] = "#{root_dir}/libs/*.a"
29
29
  #兼容.xcframework
30
- spec['vendored_frameworks'] = %W[#{root_dir} #{root_dir}/fwks/*.framework #{root_dir}/fwks/*.xcframework]
30
+ spec['vendored_frameworks'] = %W[#{root_dir} #{root_dir}/fwks/*.framework]
31
31
  # 处理资源
32
32
  resources = %W[#{root_dir}/*.{#{special_resource_exts.join(',')}} #{root_dir}/resources/*]
33
33
  spec['resources'] = resources
@@ -66,7 +66,6 @@ module CBin
66
66
  repo_name = Pod::Config.instance.sources_manager.binary_source.name
67
67
  # repo_name = 'example-private-spec-bin'
68
68
  argvs = %W[#{repo_name} #{binary_podsepc_json} --skip-import-validation --use-libraries --allow-warnings --verbose]
69
-
70
69
  begin
71
70
  push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
72
71
  push.validate!
@@ -35,6 +35,7 @@ module Pod
35
35
  # 依赖分析
36
36
  alias old_resolve_dependencies resolve_dependencies
37
37
  def resolve_dependencies
38
+ start_time = Time.now
38
39
  list = PodUpdateConfig.pods
39
40
  # 判断 PodUpdateConfig.pods 是否为空,且数组大于0
40
41
  if list && !list.empty?
@@ -43,8 +44,24 @@ module Pod
43
44
  if PodUpdateConfig.lockfile
44
45
  self.instance_variable_set("@lockfile",PodUpdateConfig.lockfile)
45
46
  end
46
- start_time = Time.now
47
- analyzer = old_resolve_dependencies
47
+
48
+ plugin_sources = run_source_provider_hooks
49
+ analyzer = create_analyzer(plugin_sources)
50
+
51
+ UI.section 'Updating local specs repositories' do
52
+ analyzer.update_repositories
53
+ end if repo_update? && PodUpdateConfig.repo_update
54
+
55
+ UI.section 'Analyzing dependencies' do
56
+ analyze(analyzer)
57
+ validate_build_configurations
58
+ end
59
+
60
+ UI.section 'Verifying no changes' do
61
+ verify_no_podfile_changes!
62
+ verify_no_lockfile_changes!
63
+ end if deployment?
64
+ cost_time_hash['prepare'] = PodUpdateConfig.prepare_time
48
65
  cost_time_hash['resolve_dependencies'] = Time.now - start_time
49
66
  analyzer
50
67
  end
@@ -16,7 +16,6 @@ def get_podfile_lock
16
16
  end
17
17
  # 判断是否有update参数 时不获取服务端podfile.lock文件
18
18
  ARGV.each do |arg|
19
- puts "pod 执行 #{arg}"
20
19
  if arg == 'update'
21
20
  is_load_podfile_lock = false
22
21
  end
@@ -25,11 +24,23 @@ def get_podfile_lock
25
24
  if is_load_podfile_lock
26
25
  #获取 PODFILE CHECKSUM 用来判断服务端是否存在该podfile.lock
27
26
  checksum = Pod::Config.instance.podfile.checksum
28
- puts checksum
29
27
  # zip下载地址
30
28
  curl = "https://xiuxiu-dl-meitu-com.obs.cn-north-4.myhuaweicloud.com/ios/binary/MTXX/#{checksum}/podfile.lock.zip"
31
- # 判断zip文件是否存在 存在下载并解压
29
+
30
+ # 判断服务端是否存在该podfile.lock
31
+ is_load_podfile_lock = false
32
32
  if system("curl -o /dev/null -s -w %{http_code} #{curl} | grep 200 > /dev/null 2>&1")
33
+ is_load_podfile_lock = true
34
+ end
35
+ branch_value = ENV['branch']
36
+ if !is_load_podfile_lock && branch_value && branch_value == 'develop'
37
+ curl = "https://xiuxiu-dl-meitu-com.obs.cn-north-4.myhuaweicloud.com/ios/binary/MTXX/develop/podfile.lock.zip"
38
+ if system("curl -o /dev/null -s -w %{http_code} #{curl} | grep 200 > /dev/null 2>&1")
39
+ is_load_podfile_lock = true
40
+ end
41
+ end
42
+ # 判断是否需要下载podfile.lock文件
43
+ if is_load_podfile_lock
33
44
  puts "获取服务端存储的podfile.lcok文件".green
34
45
  #下载并解压的podfile.zip文件
35
46
  if system("curl -O #{curl} > /dev/null 2>&1") && system("unzip -o podfile.lock.zip > /dev/null 2>&1")
@@ -44,8 +55,9 @@ def get_podfile_lock
44
55
  Pod::Config.instance.podfile,
45
56
  PodUpdateConfig.lockfile
46
57
  )
58
+ analyzer.update_repositories
59
+ PodUpdateConfig.set_repo_update
47
60
  analyzer.analyze(true)
48
-
49
61
  #获取analyzer中所有git 且branch 指向的pod
50
62
  Pod::Config.instance.podfile.dependencies.map do |dependency|
51
63
  if dependency.external_source && dependency.external_source[:git] && (dependency.external_source[:branch] || (dependency.external_source.size == 1))
@@ -103,19 +115,37 @@ def upload_mbox_podfile_lock
103
115
  puts "mbox podfile.lcok文件兼容处理失败,失败原因:#{error}"
104
116
  end
105
117
  end
118
+ def upload_develop_podfile_lock
119
+ begin
120
+ branch_value = ENV['branch']
121
+ if branch_value && branch_value == 'develop'
122
+ if system("zip podfile.lock.zip Podfile.lock > /dev/null 2>&1") && system("curl -F \"name=MTXX\" -F \"version=develop\" -F \"file=@#{Pathname.pwd}/podfile.lock.zip\" http://nezha.community.cloud.meitu.com/file/upload.json > /dev/null 2>&1")
123
+ Pod::UI.puts "上报podfile.lcok文件到服务端成功".green
124
+ `rm -rf podfile.lock.zip`
125
+ else
126
+ Pod::UI.puts "上报podfile.lcok文件到服务端失败".red
127
+ `rm -rf podfile.lock.zip`
128
+ end
129
+ end
130
+ rescue => error
131
+
132
+ end
133
+ end
134
+
106
135
  Pod::HooksManager.register('cocoapods-meitu-bin', :pre_install) do |_context|
136
+ start_time = Time.now
107
137
  require 'cocoapods-meitu-bin/native'
108
138
  require 'cocoapods-meitu-bin/helpers/buildAll/bin_helper'
109
-
110
139
  Pod::UI.puts "当前configuration: `#{ENV['configuration'] || Pod::Config.instance.podfile.configuration}`".green
111
140
  # checksum = Pod::Config.instance.podfile.checksum
112
141
  # puts Pod::Config.instance
113
142
  # installer = Installer.new(config.sandbox, config.podfile, config.lockfile)
114
143
  # puts checksum
115
- get_podfile_lock
116
144
  # pod bin repo update 更新二进制私有源
117
145
  Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new($ARGV)).run
118
146
 
147
+ get_podfile_lock
148
+
119
149
  # 有插件/本地库 且是dev环境下,默认进入源码白名单 过滤 archive命令
120
150
  if _context.podfile.plugins.keys.include?('cocoapods-meitu-bin') && _context.podfile.configuration_env == 'dev'
121
151
  dependencies = _context.podfile.dependencies
@@ -128,7 +158,7 @@ Pod::HooksManager.register('cocoapods-meitu-bin', :pre_install) do |_context|
128
158
  end
129
159
 
130
160
  end
131
-
161
+ PodUpdateConfig.set_prepare_time(Time.now - start_time)
132
162
  # 同步 BinPodfile 文件
133
163
  project_root = Pod::Config.instance.project_root
134
164
  path = File.join(project_root.to_s, 'BinPodfile')
@@ -145,16 +175,19 @@ Pod::HooksManager.register('cocoapods-meitu-bin', :pre_install) do |_context|
145
175
  raise Pod::DSLError.new(message, path, e, contents)
146
176
  end
147
177
  end
178
+ PodUpdateConfig.set_prepare_time(Time.now - start_time)
148
179
  end
149
180
 
150
181
  # 注册 pod install 钩子
151
182
  Pod::HooksManager.register('cocoapods-meitu-bin', :post_install) do |context|
152
- # p "hello world! post_install"
183
+ #基于podfile的checksum上报云端podfile.lock文件
153
184
  upload_podfile_lock(Pod::Config.instance.podfile.checksum)
154
185
  #判断是否在 mbox 工作目录执行pod install
155
186
  if system("mbox status > /dev/null 2>&1")
156
187
  upload_mbox_podfile_lock
157
188
  end
189
+ #基于 develop 分支,上报podfile.lock文件
190
+ upload_develop_podfile_lock
158
191
  end
159
192
 
160
193
  Pod::HooksManager.register('cocoapods-meitu-bin', :source_provider) do |context, _|
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.1.3
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-18 00:00:00.000000000 Z
11
+ date: 2023-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel