cocoapods-meitu-bin 1.4.1 → 2.0.1

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: d866fcda4827c97d86810fa175e8f2e94ba8b9b7cb5fddba738168a39de9e209
4
- data.tar.gz: 1ba573957dfc51fa2cc2b4f42ab483864b78d4f57c59280be20d31b758950d9a
3
+ metadata.gz: 44b755bd80acc307a5c25f91cd7d07911fb0f81df3342739a3e099bdbc3eb6e0
4
+ data.tar.gz: fc5c280e229de927df2e429da8494146de709d16429ecc143e05447244ad34a8
5
5
  SHA512:
6
- metadata.gz: 828c4415a0cb11b9d920a804e59285e1b41d215d96804917e641e8c0438165c565c519ea715bbccc4381aaf1a90c63067166bc9777548f954cd7c00116270866
7
- data.tar.gz: 1ad302d1311dca387411bd59ba4333a17ffcd81f59bed55059dfee8d70b9f74d53679394fe94696c7fd9b30261ac9b03a98bdf6fcffe5e31eb031135d16b7f47
6
+ metadata.gz: e23a6e77f03c087df977c2d23418e2b5a3da59eca718923dfe9653136dd9ef8252c4596b59ddc1c1c3160b19e810b980f049ffd3303183eb5ce25d61ceea89cf
7
+ data.tar.gz: 20441e3f37762cb9c2039fc1a0bffbbfe1f899d2ec64693570008f4489b27c4f8e17a402dfe7cc01fe3b05a085f51e8aa241219d23ba47772659465b2d32d334
@@ -16,7 +16,6 @@ require 'cocoapods-meitu-bin/command/bin/source'
16
16
  require 'cocoapods-meitu-bin/helpers'
17
17
  require 'cocoapods-meitu-bin/helpers/framework_builder'
18
18
  require 'cocoapods-meitu-bin/native/clean'
19
- require 'cocoapods-meitu-bin/native/verify'
20
19
  module Pod
21
20
  class Command
22
21
  # This is an example of a cocoapods plugin adding a top-level subcommand
@@ -3,6 +3,7 @@ require 'cocoapods-meitu-bin/native/podfile'
3
3
  require 'cocoapods-meitu-bin/native/podfile_env'
4
4
  require 'cocoapods/generate'
5
5
  require 'cocoapods'
6
+ require 'ostruct'
6
7
  module CBin
7
8
  class Config
8
9
  def config_file
@@ -164,8 +165,15 @@ class PodUpdateConfig
164
165
  @@is_clear = false
165
166
  @@shell_project = false
166
167
  @@external_source_commit = {}
168
+ @@binary_version_pods = []
167
169
 
170
+ def self.set_binary_version_pods(pods)
171
+ @@binary_version_pods = pods
172
+ end
168
173
 
174
+ def self.binary_version_pods
175
+ @@binary_version_pods
176
+ end
169
177
 
170
178
  def self.set_external_source_commit
171
179
  podfile_obj = Pod::Config.instance.podfile
@@ -1,5 +1,5 @@
1
1
  module CBin
2
- VERSION = "1.4.1"
2
+ VERSION = "2.0.1"
3
3
  end
4
4
 
5
5
  module Pod
@@ -25,11 +25,13 @@ module CBin
25
25
  specs << dependencies_commit_str(pod_name, specifications)
26
26
  end
27
27
  end
28
+ specs << binary_version_pods_str(specifications)
28
29
  specs << minimum_deployment_target_str
29
30
  specs << bundle_identifier_str
30
31
  specs << random_value_str
31
32
  specs << xcode_version
32
33
  specs << (configuration.nil? ? 'Debug' : configuration)
34
+
33
35
  specs_str = specs.join('')
34
36
  if ENV['p_bin_v'] == '1'
35
37
  UI.puts "`#{pod_name}`:#{specs_str}".red
@@ -42,6 +44,85 @@ module CBin
42
44
  "#{original_version}.bin#{specs_str_md5}"
43
45
  end
44
46
 
47
+ # 获取参与二进制版本号生成的组件的tag/commit信息
48
+ def binary_version_pods_str(specifications)
49
+ binary_version_pods = PodUpdateConfig.binary_version_pods
50
+ return '' if binary_version_pods.empty?
51
+
52
+ # 获取所有直接和间接依赖
53
+ all_dependencies = get_all_dependencies(binary_version_pods, specifications)
54
+
55
+ result = []
56
+ all_dependencies.each do |pod_name|
57
+ # 优先使用 external_source_commit
58
+ if PodUpdateConfig.external_source_commit[pod_name]
59
+ result << "#{pod_name}(#{PodUpdateConfig.external_source_commit[pod_name]})"
60
+ next
61
+ end
62
+
63
+ # 如果没有 external_source_commit,则使用版本号
64
+ specifications.each do |spec|
65
+ if spec.root.name == pod_name
66
+ version = spec.root.version.to_s
67
+ # 如果是二进制版本,去掉二进制版本号后缀
68
+ version_arr = version.split('.')
69
+ if version_arr.last.include?('bin')
70
+ version_arr.delete_at(version_arr.size - 1)
71
+ version = version_arr.join('.')
72
+ end
73
+ result << "#{pod_name}(#{version})"
74
+ break
75
+ end
76
+ end
77
+ end
78
+
79
+ if ENV['p_bin_v'] == '1'
80
+ UI.puts "参与二进制版本号生成的组件:#{result.join(',')}".yellow
81
+ end
82
+
83
+ result.join(',')
84
+ end
85
+
86
+ # 递归获取所有依赖(包括直接依赖和间接依赖)
87
+ def get_all_dependencies(pod_names, specifications)
88
+ result = Set.new(pod_names)
89
+ visited = Set.new
90
+
91
+ pod_names.each do |pod_name|
92
+ get_dependencies_recursively(pod_name, specifications, result, visited)
93
+ end
94
+
95
+ # 打印所有PopRock相关的间接依赖
96
+ if ENV['p_bin_d'] == '1'
97
+ poprock_deps = result.select { |name| name.include?('PopRock') }
98
+ if poprock_deps.any?
99
+ UI.puts "\nPopRock相关组件及其依赖:".yellow
100
+ poprock_deps.each do |dep|
101
+ UI.puts "- #{dep}"
102
+ end
103
+ end
104
+ end
105
+
106
+ result.to_a
107
+ end
108
+
109
+ # 递归获取单个组件的所有依赖
110
+ def get_dependencies_recursively(pod_name, specifications, result, visited)
111
+ return if visited.include?(pod_name)
112
+ visited.add(pod_name)
113
+
114
+ specifications.each do |spec|
115
+ if spec.root.name == pod_name
116
+ spec.dependencies.each do |dep|
117
+ next if dep.root_name == pod_name # 跳过自依赖
118
+ result.add(dep.root_name)
119
+ get_dependencies_recursively(dep.root_name, specifications, result, visited)
120
+ end
121
+ break
122
+ end
123
+ end
124
+ end
125
+
45
126
  #最低部署目标,参与二进制版本生成
46
127
  def minimum_deployment_target_str
47
128
  CBin.config.minimum_deployment_target
@@ -352,23 +352,24 @@ ibtool \
352
352
  fwks_dir = "#{result_product_dir}/fwks"
353
353
  FileUtils.mkdir(fwks_dir) unless File.exist?(fwks_dir)
354
354
  fwks.map do |fwk|
355
- new_fwk = get_XCFrameworkIntermediates_path(fwk)
356
- if new_fwk && File.exist?(new_fwk)
357
- `rsync -av #{new_fwk} #{fwks_dir}`
358
- else
359
- `rsync -av #{fwk} #{fwks_dir}`
360
- end
361
- end
362
- end
363
- def get_XCFrameworkIntermediates_path(path)
364
- # 使用正则表达式匹配并提取 AdsFramework
365
- match = path.to_s.match(/\/([^\/]+)\.xcframework/)
366
- if match
367
- framework_path = "#{product_dir}/#{iphoneos}/XCFrameworkIntermediates/#{match[1]}/#{match[1]}.framework"
368
- return framework_path
355
+ `rsync -av #{fwk} #{fwks_dir}`
356
+ # new_fwk = get_XCFrameworkIntermediates_path(fwk)
357
+ # if new_fwk && File.exist?(new_fwk)
358
+ # `rsync -av #{new_fwk} #{fwks_dir}`
359
+ # else
360
+ # `rsync -av #{fwk} #{fwks_dir}`
361
+ # end
369
362
  end
370
- return nil
371
363
  end
364
+ # def get_XCFrameworkIntermediates_path(path)
365
+ # # 使用正则表达式匹配并提取 AdsFramework
366
+ # match = path.to_s.match(/\/([^\/]+)\.xcframework/)
367
+ # if match
368
+ # framework_path = "#{product_dir}/#{iphoneos}/XCFrameworkIntermediates/#{match[1]}/#{match[1]}.framework"
369
+ # return framework_path
370
+ # end
371
+ # return nil
372
+ # end
372
373
 
373
374
  # 拷贝 framework
374
375
  def copy_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]
30
+ spec['vendored_frameworks'] = %W[#{root_dir} #{root_dir}/fwks/*.{framework,xcframework}]
31
31
  # 处理资源
32
32
  resources = %W[#{root_dir}/*.{#{special_resource_exts.join(',')}} #{root_dir}/resources/*]
33
33
  spec['resources'] = resources
@@ -23,6 +23,10 @@ module Pod
23
23
 
24
24
  # 并发执行个数
25
25
  option :multi_threads_count, 4
26
+
27
+ # 默认并发下载
28
+ defaults.delete('parallel_pod_downloads')
29
+ option :parallel_pod_downloads, true
26
30
  end
27
31
  end
28
32
  end
@@ -6,14 +6,17 @@ module Pod
6
6
  class Installer
7
7
  class PodSourceInstaller
8
8
  attr_accessor :installation_options
9
-
10
- alias old_verify_source_is_secure verify_source_is_secure
11
- def verify_source_is_secure(root_spec)
12
- # http source 默认不警告
13
- if installation_options.warn_for_unsecure_source?
14
- old_verify_source_is_secure(root_spec)
15
- end
16
- end
17
9
  end
10
+ # class PodSourceDownloader
11
+ # attr_accessor :installation_options
12
+ #
13
+ # alias old_verify_source_is_secure verify_source_is_secure
14
+ # def verify_source_is_secure(root_spec)
15
+ # # http source 默认不警告
16
+ # if installation_options.warn_for_unsecure_source?
17
+ # old_verify_source_is_secure(root_spec)
18
+ # end
19
+ # end
20
+ # end
18
21
  end
19
22
  end
@@ -1,11 +1,10 @@
1
-
2
-
3
1
  require 'cocoapods'
4
2
  require 'cocoapods-meitu-bin/native/podfile_env'
5
3
 
6
4
  module Pod
7
5
  class Podfile
8
6
  # TREAT_DEVELOPMENTS_AS_NORMAL = 'treat_developments_as_normal'.freeze
7
+ BINARY_VERSION_PODS = 'binary_version_pods'.freeze
9
8
 
10
9
  module DSL
11
10
  def allow_prerelease!
@@ -43,6 +42,13 @@ module Pod
43
42
  def set_configuration_env(env = "dev")
44
43
  set_internal_hash_value(CONFIGURATION_ENV, env)
45
44
  end
45
+
46
+ # 设置参与二进制库版本号生成的组件名称
47
+ def set_binary_version_pods(pods)
48
+ hash_binary_version_pods = get_internal_hash_value(BINARY_VERSION_PODS) || []
49
+ hash_binary_version_pods += Array(pods)
50
+ set_internal_hash_value(BINARY_VERSION_PODS, hash_binary_version_pods)
51
+ end
46
52
  end
47
53
 
48
54
  alias old_plugins plugins
@@ -85,6 +91,11 @@ module Pod
85
91
  get_internal_hash_value(CONFIGURATION, "Debug")
86
92
  end
87
93
 
94
+ # 获取参与二进制库版本号生成的组件名称列表
95
+ def binary_version_pods
96
+ get_internal_hash_value(BINARY_VERSION_PODS, []) + String(ENV[BINARY_VERSION_PODS]).split('|').uniq
97
+ end
98
+
88
99
  private
89
100
 
90
101
  def valid_bin_plugin
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  require 'parallel'
4
2
  require 'cocoapods'
5
3
  require 'cocoapods-meitu-bin/native/podfile'
@@ -146,6 +144,7 @@ module Pod
146
144
 
147
145
  sources_manager = Config.instance.sources_manager
148
146
  use_source_pods = podfile.use_source_pods
147
+ PodUpdateConfig.set_binary_version_pods(podfile.binary_version_pods)
149
148
 
150
149
  # 从BinConfig读取black_list
151
150
  black_list = read_black_list
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.4.1
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-28 00:00:00.000000000 Z
11
+ date: 2025-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -164,7 +164,6 @@ files:
164
164
  - lib/cocoapods-meitu-bin/native/specification.rb
165
165
  - lib/cocoapods-meitu-bin/native/target_validator.rb
166
166
  - lib/cocoapods-meitu-bin/native/validator.rb
167
- - lib/cocoapods-meitu-bin/native/verify.rb
168
167
  - lib/cocoapods-meitu-bin/source_provider_hook.rb
169
168
  - lib/cocoapods_plugin.rb
170
169
  - spec/command/bin_spec.rb
@@ -1,107 +0,0 @@
1
- # 用于效验podfile相关准确性
2
- module Pod
3
- class Command
4
- class Bin < Command
5
- class Verify < Bin
6
- # self.abstract_command = true
7
- self.summary = '效验podfile相关准确性'
8
- self.description = <<-DESC
9
- #{summary},效验podfile相关准确性
10
- DESC
11
-
12
- def self.options
13
- [
14
- %w[--verify-podfile podfile是否正确且相关依赖正常],
15
- %w[--verify-podfile-branch 效验podfile是否包含:branch=>'xxx'语法],
16
- ].concat(super).uniq
17
- end
18
-
19
- def initialize(argv)
20
- @verify_podfile = argv.flag?('verify-podfile', false)
21
- @verify_podfile_branch = argv.flag?('verify-podfile-branch', false)
22
- super
23
- end
24
-
25
- def run
26
- # Pod::UI.puts "共删除#{size}二进制版本pod缓存".red
27
-
28
- if @verify_podfile
29
- analyzing_dependencies
30
- end
31
- if @verify_podfile_branch
32
- verify_podfile_branch
33
- end
34
- end
35
-
36
- private
37
- def verify_podfile
38
- begin
39
- podfile
40
- rescue Pod::DSLError => error
41
- info ="podfile文件效验失败:#{error}"
42
- raise Pod::DSLError.new(info, path, error, contents)
43
- end
44
- begin
45
- analyzing_dependencies
46
- rescue Pod::DSLError => error
47
- # puts "podfile依赖分析失败:#{error}"
48
- info = "podfile依赖分析失败:#{error}"
49
- raise Pod::DSLError.new(info, path, error, contents)
50
- end
51
- end
52
- def verify_podfile_branch
53
- begin
54
- podfile
55
- rescue Pod::DSLError => error
56
- info = "podfile文件效验失败:#{error.message}"
57
- raise Pod::DSLError.new(info, path, error, contents)
58
- end
59
- podfile_obj = podfile
60
- branch_list = []
61
- podfile_obj.target_definitions.each do |target_name, target_definition|
62
- target_definition.dependencies.each do |dependency|
63
- if dependency.external_source
64
- if dependency.external_source[:branch]
65
- branch = dependency.external_source[:branch]
66
- branch_list << "#{dependency.name}:#{branch}"
67
- end
68
- end
69
- end
70
- end
71
- if branch_list.count > 0
72
- Pod::UI.puts "podfile包含以下branch:#{branch_list}".red
73
- Pod::UI.puts "请检查podfile是否包含 :branch => 'xxx' 语法".red
74
-
75
- raise Pod::DSLError.new("合入develop分支不能使用branch,podfile包含branch,请检查:#{branch_list}", nil, nil, nil)
76
- end
77
- end
78
- def analyzing_dependencies
79
- analyzer = Pod::Installer::Analyzer.new(
80
- sandbox,
81
- podfile,
82
- lockfile
83
- )
84
- analyzer.update_repositories
85
- analyzer.analyze(true)
86
- end
87
- def podfile
88
- @podfile ||= Pod::Config.instance.podfile
89
- end
90
-
91
- # 获取 podfile.lock
92
- def lockfile
93
- @lockfile ||= Pod::Config.instance.lockfile
94
- end
95
-
96
- # 获取 sandbox
97
- def sandbox
98
- @sandbox ||= Pod::Config.instance.sandbox
99
- end
100
- def clean_all_binary
101
- # Your method implementation here
102
-
103
- end
104
- end
105
- end
106
- end
107
- end