cocoapods-bb-PodAssistant 0.3.14.9 → 0.3.15.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 76613430484281c489857dca49640b225d66d912b05c2feb488e0c7efab5bf30
|
|
4
|
+
data.tar.gz: f310bc2ab0fac4f48a728a812fe487e26efe958b12a8042794e20512e2c6ce48
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: da38a902099ce6249365e29f537c39b20998670bfcd3271b561ad10789eaf148e131b1384608b7ade608a658ef9e4e26ab8055fef345d2dcefcbf1812684fa45
|
|
7
|
+
data.tar.gz: d107c8364b31827bf08850e75248557a4fe24a0dd898f7d1ed4d25182fdac46eb0193fb7f27ff987246e757fd49f227654f7d6945f2bed5890efa8f421a20712
|
|
@@ -79,7 +79,7 @@ module BB
|
|
|
79
79
|
app_targets = project.targets.select { |t| t.product_type == "com.apple.product-type.application" }
|
|
80
80
|
|
|
81
81
|
if !app_targets.empty?
|
|
82
|
-
target = app_targets.find { |t| !t.name.include?("Extension") && !t.name.include?("Tests") } || app_targets.first
|
|
82
|
+
target = app_targets.find { |t| !t.name.include?("Extension") && !t.name.include?("Widget") && !t.name.include?("Clip") && !t.name.include?("Tests") } || app_targets.first
|
|
83
83
|
config = target.build_configurations.find { |c| c.name == "Release" } || target.build_configurations.first
|
|
84
84
|
plist_rel = config&.build_settings&.[]('INFOPLIST_FILE')
|
|
85
85
|
|
|
@@ -81,6 +81,75 @@ module BB
|
|
|
81
81
|
# 获取时间差
|
|
82
82
|
time = $podEndTime - $podStartTime
|
|
83
83
|
puts "[PodAssistant] pod操作总耗时【#{time.to_s.send(:red)}秒】start:#{$podStartTime} end:#{$podEndTime}".green
|
|
84
|
+
# # podfile配置插件进行关键字扫描,参照
|
|
85
|
+
# plugin 'cocoapods-bb-PodAssistant',
|
|
86
|
+
# :scan_enable => true, # 是否需要开启,建议不用每次扫描,需要打开
|
|
87
|
+
# :scan_scope => 'all', # all / source / pod,对应全部/源码/Pods库
|
|
88
|
+
# :scan_keywords => ['SimulateIDFA', 'OpenUDID'], # 扫描关键字
|
|
89
|
+
# :scan_ignore => ['MGTVSDK'] # 过滤关键字
|
|
90
|
+
# 关键字扫描
|
|
91
|
+
podfile = if installer.respond_to?(:podfile)
|
|
92
|
+
installer.podfile
|
|
93
|
+
elsif installer.respond_to?(:installer) && installer.installer.respond_to?(:podfile)
|
|
94
|
+
installer.installer.podfile
|
|
95
|
+
else
|
|
96
|
+
Pod::Config.instance.podfile
|
|
97
|
+
end
|
|
98
|
+
plugins = podfile&.plugins || {}
|
|
99
|
+
config = (plugins['cocoapods-bb-PodAssistant'] || {}).transform_keys(&:to_sym)
|
|
100
|
+
scan_enable = config[:scan_enable] || false # 是否开启扫描
|
|
101
|
+
scan_scope = config[:scan_scope] || 'source' # all / source / pod
|
|
102
|
+
keywords = config[:scan_keywords] || ["SimulateIDFA", "OpenUDID"] # 扫描关键字
|
|
103
|
+
ignore_list = config[:scan_ignore] || [""] # 忽略列表
|
|
104
|
+
scan_enable ||= ENV['POD_SCAN_ENABLE'] == '1' # 支持环境配置 ENV['POD_SCAN_ENABLE'] = '1'
|
|
105
|
+
# puts "scan_enable:#{scan_enable}"
|
|
106
|
+
# puts "scan_scope:#{scan_scope}"
|
|
107
|
+
# puts "keywords:#{keywords}"
|
|
108
|
+
# puts "ignore_list:#{ignore_list}"
|
|
109
|
+
if scan_enable
|
|
110
|
+
puts "config:#{plugins}"
|
|
111
|
+
puts "[PodAssistant] 开始关键字扫描...".yellow
|
|
112
|
+
project_root = Dir.pwd
|
|
113
|
+
pods_path = installer.sandbox_root.to_s
|
|
114
|
+
scan_keys = keywords.map { |k| Regexp.escape(k) }.join('|')
|
|
115
|
+
ignore_list = (ignore_list || []).reject(&:empty?)
|
|
116
|
+
case scan_scope
|
|
117
|
+
when 'all'
|
|
118
|
+
puts "开始扫描全部内容"
|
|
119
|
+
search_path = project_root
|
|
120
|
+
include_ext = ""
|
|
121
|
+
when 'source'
|
|
122
|
+
puts "开始扫描源码内容"
|
|
123
|
+
search_path = project_root
|
|
124
|
+
include_ext = "--include=*.{h,m,mm,swift,cpp,c}"
|
|
125
|
+
when 'pod'
|
|
126
|
+
puts "开始扫描Pods内容"
|
|
127
|
+
search_path = pods_path
|
|
128
|
+
include_ext = "--include=*.{h,m,mm,swift,cpp,c}"
|
|
129
|
+
else
|
|
130
|
+
search_path = project_root
|
|
131
|
+
end
|
|
132
|
+
grep_cmd = %Q(grep -lr -E "#{scan_keys}" #{search_path} #{include_ext})
|
|
133
|
+
puts "扫描指令 % #{grep_cmd}".yellow
|
|
134
|
+
result = `#{grep_cmd}`
|
|
135
|
+
if result && !result.strip.empty?
|
|
136
|
+
puts "ignore_list:#{ignore_list}".yellow
|
|
137
|
+
filtered = result.lines.reject do |line|
|
|
138
|
+
ignore_list.any? { |i| line.include?(i) }
|
|
139
|
+
end
|
|
140
|
+
if filtered.any?
|
|
141
|
+
puts "[PodAssistant][ ⚠️ 风险] 检测到敏感字段:".red
|
|
142
|
+
puts "#{filtered}".yellow
|
|
143
|
+
abort("[PodAssistant] 检测到违规关键字,请处理后再提交".red)
|
|
144
|
+
else
|
|
145
|
+
puts "[PodAssistant] 未检测到敏感字段".green
|
|
146
|
+
end
|
|
147
|
+
else
|
|
148
|
+
puts "[PodAssistant] 未检测到敏感字段".green
|
|
149
|
+
end
|
|
150
|
+
else
|
|
151
|
+
puts "[PodAssistant] 关键字扫描未开启".yellow
|
|
152
|
+
end
|
|
84
153
|
rescue => exception
|
|
85
154
|
# 如果没有下载则#{Dir.home}/.AllPodsTimeAndSize.csv文件不会生成,产生异常
|
|
86
155
|
puts "[PodAssistant] post_install error(已捕获): #{exception}".red
|