cocoapods-dongjia 1.1.6 → 1.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-dongjia/command/install.rb +0 -6
- data/lib/cocoapods-dongjia/command/open.rb +0 -6
- data/lib/cocoapods-dongjia/command/strip.rb +0 -3
- data/lib/cocoapods-dongjia/gem_version.rb +3 -3
- data/lib/cocoapods_plugin.rb +11 -4
- data/lib/dongjia_binarization.rb +194 -130
- metadata +8 -9
- data/lib/dongjia_branch_inspector.rb +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa1cbb2e3dd015a54ea5849874d80671b2f0a2e1cd1b54613234d7007afe49e0
|
4
|
+
data.tar.gz: a37a16c1768e62d297bdf0c2b58f8bb9e2cd3a1c6fe02285542d0b19d3511e94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b28cd9c347883a14bd00a7be621f386a4c084d6af2eaa4b9e82a914a9d68c47c8cc01edb109213c2b71f4a35a0f3675439536509f1abb569f9d331a02789f03c
|
7
|
+
data.tar.gz: 7d20554732589feca1c49094cdbd01afcbfc619f88703e888b4be228bde87dbcee4b9ea9cb278a1b972732c624b2be1cc30a654302ea2ceaa46bd00f9876cf04
|
@@ -1,11 +1,8 @@
|
|
1
1
|
require 'cocoapods'
|
2
2
|
|
3
3
|
module Pod
|
4
|
-
|
5
4
|
class Command
|
6
|
-
|
7
5
|
class Open < Command
|
8
|
-
|
9
6
|
self.summary = '快速打开项目的 .xcworkspace'
|
10
7
|
|
11
8
|
self.description = <<-DESC
|
@@ -24,9 +21,6 @@ module Pod
|
|
24
21
|
def run
|
25
22
|
`open #{@workspace_path}`
|
26
23
|
end
|
27
|
-
|
28
24
|
end
|
29
|
-
|
30
25
|
end
|
31
|
-
|
32
26
|
end
|
data/lib/cocoapods_plugin.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'cocoapods-dongjia/command'
|
2
2
|
require_relative 'dongjia_source'
|
3
|
-
require_relative 'dongjia_branch_inspector'
|
4
3
|
require_relative 'dongjia_enterprise_inspector'
|
5
4
|
require_relative 'dongjia_pods_iterator'
|
6
5
|
require_relative 'dongjia_router'
|
@@ -15,9 +14,17 @@ module Dongjia
|
|
15
14
|
|
16
15
|
Pod::HooksManager.register('cocoapods-dongjia', :pre_install) do |ctx, params|
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
private_config_path = ctx.podfile.defined_in_file.dirname.join("PrivateConfig.yml")
|
18
|
+
if private_config_path.exist?
|
19
|
+
private_config = YAML.load(File.read(private_config_path))
|
20
|
+
if private_config.is_a?(Hash)
|
21
|
+
binary = private_config["binary"]
|
22
|
+
if binary.is_a?(Hash)
|
23
|
+
Binarization.load_private_config(ctx, binary)
|
24
|
+
Binarization.remove_dirty_pod_projects()
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
21
28
|
|
22
29
|
podfile = ctx.podfile
|
23
30
|
|
data/lib/dongjia_binarization.rb
CHANGED
@@ -5,7 +5,6 @@ require 'net/http'
|
|
5
5
|
require 'json'
|
6
6
|
require 'yaml'
|
7
7
|
require 'down'
|
8
|
-
require 'pry'
|
9
8
|
require 'uri'
|
10
9
|
|
11
10
|
module Dongjia
|
@@ -14,16 +13,16 @@ module Dongjia
|
|
14
13
|
@@ctx = nil
|
15
14
|
@@pod_cfg = {}
|
16
15
|
@@enabled = false
|
17
|
-
@@target_name = ""
|
18
16
|
@@submodules = {}
|
19
17
|
@@server_host = ""
|
20
18
|
|
21
|
-
#
|
22
|
-
@@
|
19
|
+
@@target_name = "dongjia" # 项目的 target 名
|
20
|
+
@@pods_proj = nil # Pods.xcodeproj
|
21
|
+
@@pods_target = nil # Pods.xcodeproj 中的 target 对象
|
23
22
|
|
24
23
|
class << self
|
25
24
|
# 加载配置
|
26
|
-
def load_private_config(ctx)
|
25
|
+
def load_private_config(ctx, binary)
|
27
26
|
@@ctx = ctx
|
28
27
|
|
29
28
|
submodule_info = load_submodules_info
|
@@ -33,108 +32,82 @@ module Dongjia
|
|
33
32
|
{ sha: s[:sha], binary: s[:binary], }
|
34
33
|
]
|
35
34
|
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
{ sha: s["sha"], binary: s["binary"], }
|
54
|
-
]
|
55
|
-
}.each { |k, v|
|
56
|
-
ignored = ignores.include?(k)
|
57
|
-
v[:binary] &&= !ignored && @@enabled
|
58
|
-
v[:ignored] = ignored
|
59
|
-
}
|
60
|
-
rescue => e
|
61
|
-
puts "Error: #{e}"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
35
|
+
|
36
|
+
@@enabled ||= binary["enabled"]
|
37
|
+
@@server_host = binary["server_host"]
|
38
|
+
@@target_name = (binary["target_name"] || "").strip
|
39
|
+
ignores = binary["ignores"] || []
|
40
|
+
|
41
|
+
if @@enabled
|
42
|
+
@@submodules = query_components_existing(submodule_info).to_h { |s|
|
43
|
+
[
|
44
|
+
s["name"],
|
45
|
+
{ sha: s["sha"], binary: s["binary"], }
|
46
|
+
]
|
47
|
+
}.each { |k, v|
|
48
|
+
ignored = ignores.include?(k)
|
49
|
+
v[:binary] &&= !ignored && @@enabled
|
50
|
+
v[:ignored] = ignored
|
51
|
+
}
|
65
52
|
end
|
53
|
+
rescue => e
|
54
|
+
puts "Binarization error: #{e}"
|
66
55
|
end
|
67
56
|
|
68
57
|
# 移除脏工程
|
69
58
|
def remove_dirty_pod_projects
|
70
|
-
@@
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
59
|
+
if @@enabled
|
60
|
+
@@submodules
|
61
|
+
.filter { |k,v| !v[:binary] }
|
62
|
+
.map { |k,v| k }
|
63
|
+
.each { |name|
|
64
|
+
path = File.join(@@ctx.sandbox_root, "#{name}.xcodeproj")
|
65
|
+
next unless File.exist?(path)
|
66
|
+
proj = Xcodeproj::Project.open(path)
|
67
|
+
if proj.targets.map(&:name).include?("#{name}-Binary")
|
68
|
+
FileUtils.rm_rf(path)
|
69
|
+
end
|
70
|
+
}
|
71
|
+
else
|
72
|
+
# 不启用,清除所有包含 -Binary 的工程
|
73
|
+
removing_paths = []
|
74
|
+
Dir.foreach(@@ctx.sandbox_root) { |filename|
|
75
|
+
next if File.extname(filename) != '.xcodeproj'
|
76
|
+
pod_name = filename.delete_suffix('.xcodeproj')
|
77
|
+
next if pod_name == "Pods"
|
78
|
+
process_pod_xcconfig(pod_name)
|
79
|
+
path = File.join(@@ctx.sandbox_root, filename)
|
76
80
|
proj = Xcodeproj::Project.open(path)
|
77
|
-
|
78
|
-
|
79
|
-
end
|
80
|
-
}
|
81
|
-
end
|
82
|
-
|
83
|
-
# 加载子模块信息
|
84
|
-
def load_submodules_info
|
85
|
-
# 获取子模块的哈希值
|
86
|
-
def git_sha_value(component_name)
|
87
|
-
git_dir = ".git/modules/componentsOnRemote/#{component_name}"
|
88
|
-
git_sha = File.read(File.join(git_dir, "HEAD")).strip
|
89
|
-
if git_sha.start_with?("ref: ")
|
90
|
-
head_file = git_sha[5, git_sha.length]
|
91
|
-
git_sha = File.read(File.join(git_dir, head_file)).strip
|
92
|
-
end
|
93
|
-
git_sha
|
94
|
-
end
|
95
|
-
|
96
|
-
Dir.foreach("./componentsOnRemote").to_a
|
97
|
-
.delete_if { |x| x.start_with?('.') }
|
98
|
-
.map { |comp|
|
99
|
-
{
|
100
|
-
name: comp,
|
101
|
-
sha: git_sha_value(comp),
|
102
|
-
binary: false,
|
81
|
+
included_binary_target = proj.targets.map(&:name).any? { |target_name|
|
82
|
+
target_name.end_with?("-Binary")
|
103
83
|
}
|
84
|
+
removing_paths << path if included_binary_target
|
104
85
|
}
|
86
|
+
removing_paths.each { |path| FileUtils.rm_rf(path) }
|
87
|
+
end
|
105
88
|
end
|
106
89
|
|
107
90
|
# 开始处理二进制
|
108
91
|
def process(installer)
|
109
|
-
return unless @@config_file_exist
|
110
92
|
return if @@ctx == nil || @@ctx.sandbox_root == nil
|
111
93
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
}
|
119
|
-
|
120
|
-
pods_proj = Xcodeproj::Project.open(File.join(@@ctx.sandbox_root, "Pods.xcodeproj"))
|
121
|
-
if @@target_name && !@@target_name.empty?
|
122
|
-
pods_target = pods_proj.targets.find { |t| t.name == "Pods-#{@@target_name}" }
|
123
|
-
else
|
124
|
-
pods_target = pods_proj.targets.first
|
94
|
+
path = File.join(@@ctx.sandbox_root, "Pods.xcodeproj")
|
95
|
+
@@pods_proj = Xcodeproj::Project.open(path) if File.exist?(path)
|
96
|
+
@@pods_target = (@@target_name.empty?) ? @@pods_proj.targets.first : @@pods_proj.target_by_name("Pods-#{@@target_name}")
|
97
|
+
if @@pods_target.nil?
|
98
|
+
Pod::UI.warn("[Binarization] 未完成二进制转换,target_name 配置错误")
|
99
|
+
return
|
125
100
|
end
|
126
101
|
|
127
|
-
|
102
|
+
setup_pod_cfg(installer)
|
128
103
|
|
129
|
-
|
130
|
-
proj = Xcodeproj::Project.open(File.join(@@ctx.sandbox_root, "#{name}.xcodeproj"))
|
131
|
-
cfg = @@pod_cfg[name]
|
132
|
-
cfg[:project] = proj
|
104
|
+
download_frameworks
|
133
105
|
|
134
|
-
|
106
|
+
each_pod_proj do |name, cfg|
|
107
|
+
process_pods_project_dependencies(name)
|
135
108
|
|
136
109
|
# 处理 Binary Group
|
137
|
-
process_binary_group(
|
110
|
+
process_binary_group(name)
|
138
111
|
|
139
112
|
# 处理 XXX-xcframeworks.sh 脚本
|
140
113
|
process_xcframeworks_shell(name)
|
@@ -143,54 +116,86 @@ module Dongjia
|
|
143
116
|
end
|
144
117
|
|
145
118
|
# 更新依赖关系
|
146
|
-
each_pod_proj do |name|
|
147
|
-
cfg = @@pod_cfg[name]
|
148
|
-
proj = cfg[:project]
|
119
|
+
each_pod_proj do |name, cfg|
|
149
120
|
target = cfg[:target]
|
150
121
|
next if target.nil?
|
151
122
|
delete_list = []
|
123
|
+
add_list = []
|
152
124
|
target.dependencies.each { |dep|
|
153
|
-
|
125
|
+
dep_pod_name = real_name(dep.name)
|
126
|
+
dep_cfg = @@pod_cfg[dep_pod_name]
|
154
127
|
next if dep_cfg.nil?
|
155
|
-
if dep_cfg[:
|
156
|
-
|
128
|
+
if dep_cfg[:target].name != dep.name
|
129
|
+
add_list << dep_cfg[:target]
|
157
130
|
delete_list << dep
|
158
131
|
end
|
159
132
|
}
|
160
133
|
target.dependencies.delete_if { |dep| delete_list.include?(dep) }
|
161
|
-
|
134
|
+
add_list.each { |t| target.add_dependency(t) }
|
135
|
+
cfg[:save] ||= !delete_list.empty? || !add_list.empty?
|
162
136
|
end
|
163
137
|
|
164
138
|
# 保存
|
165
|
-
|
166
|
-
each_pod_proj do |name|
|
167
|
-
cfg = @@pod_cfg[name]
|
168
|
-
cfg[:project].save if cfg[:save]
|
169
|
-
should_save ||= cfg[:save]
|
170
|
-
end
|
171
|
-
pods_proj.save if should_save
|
139
|
+
save_projects
|
172
140
|
|
173
141
|
process_aggregate_target_xcconfig(installer.aggregate_targets.first.name)
|
174
142
|
end
|
175
143
|
|
176
144
|
private
|
177
145
|
|
146
|
+
# 加载配置
|
147
|
+
def setup_pod_cfg(installer)
|
148
|
+
installer.analysis_result.podfile_dependency_cache.podfile_dependencies.each { |dep|
|
149
|
+
name = dep.name.split('/').first
|
150
|
+
cfg = @@submodules[name] || {}
|
151
|
+
cfg[:binary] = false unless cfg[:binary]
|
152
|
+
cfg[:save] = false unless cfg[:save]
|
153
|
+
cfg[:project] = Xcodeproj::Project.open(File.join(@@ctx.sandbox_root, "#{name}.xcodeproj"))
|
154
|
+
@@pod_cfg[name] = cfg
|
155
|
+
}
|
156
|
+
end
|
157
|
+
|
158
|
+
# 获取实际的 pod 名,如果有 -Binary 后缀,则去除后缀
|
159
|
+
def real_name(name)
|
160
|
+
name = name.delete_suffix("-Binary") if name.end_with?("-Binary")
|
161
|
+
return name
|
162
|
+
end
|
163
|
+
|
164
|
+
def save_projects
|
165
|
+
if Pod::Config.instance.verbose == true
|
166
|
+
pods_should_save = @@pod_cfg.filter { |k, v| v[:save] }.keys
|
167
|
+
Pod::UI.notice "Saving Pods project" unless pods_should_save.empty?
|
168
|
+
pods_should_save.each { |name|
|
169
|
+
puts " #{name}"
|
170
|
+
}
|
171
|
+
end
|
172
|
+
|
173
|
+
should_save = false
|
174
|
+
each_pod_proj do |name, cfg|
|
175
|
+
cfg[:project].save if cfg[:save]
|
176
|
+
should_save ||= cfg[:save]
|
177
|
+
end
|
178
|
+
@@pods_proj.save if !@@pods_proj.nil? && should_save
|
179
|
+
end
|
180
|
+
|
178
181
|
# 遍历 Pods 目录下的 xcodeproj
|
179
182
|
def each_pod_proj
|
180
183
|
Dir.foreach(@@ctx.sandbox_root) do |filename|
|
181
184
|
next if File.extname(filename) != '.xcodeproj'
|
182
|
-
|
185
|
+
|
183
186
|
name = File.basename(filename, '.xcodeproj')
|
184
187
|
next if name == 'Pods'
|
185
188
|
|
186
189
|
cfg = @@pod_cfg[name]
|
190
|
+
next if cfg.nil?
|
187
191
|
|
188
|
-
yield(name) if block_given?
|
192
|
+
yield(name, cfg) if block_given?
|
189
193
|
end
|
190
194
|
end
|
191
195
|
|
192
196
|
# 向服务器查询哪些 Pod 需要打包
|
193
197
|
def query_components_existing(components)
|
198
|
+
return components unless @@enabled
|
194
199
|
result = components
|
195
200
|
begin
|
196
201
|
uri = URI.parse(URI::join(@@server_host, 'api/binary/checkup').to_s)
|
@@ -204,49 +209,94 @@ module Dongjia
|
|
204
209
|
end
|
205
210
|
result = JSON.parse(resp.body).dig('res', 'components')
|
206
211
|
rescue => e
|
207
|
-
puts "
|
212
|
+
puts "Binarization error: #{e}"
|
208
213
|
end
|
209
214
|
return result
|
210
215
|
end
|
211
216
|
|
212
|
-
|
217
|
+
# 加载子模块信息
|
218
|
+
def load_submodules_info
|
219
|
+
return [] unless File.exist?("./componentsOnRemote")
|
220
|
+
|
221
|
+
# 获取子模块的哈希值
|
222
|
+
def git_sha_value(component_name)
|
223
|
+
git_dir = ".git/modules/componentsOnRemote/#{component_name}"
|
224
|
+
git_sha = File.read(File.join(git_dir, "HEAD")).strip
|
225
|
+
if git_sha.start_with?("ref: ")
|
226
|
+
head_file = git_sha[5, git_sha.length]
|
227
|
+
head_path = File.join(git_dir, head_file)
|
228
|
+
if File.exist?(head_path)
|
229
|
+
git_sha = File.read(head_path).strip
|
230
|
+
else
|
231
|
+
git_sha = nil
|
232
|
+
end
|
233
|
+
end
|
234
|
+
git_sha
|
235
|
+
end
|
236
|
+
|
237
|
+
Dir.foreach("./componentsOnRemote").to_a
|
238
|
+
.delete_if { |x| x.start_with?('.') }
|
239
|
+
.delete_if { |x|
|
240
|
+
# 如果子模块初始化错误,会导致目录下没有内容,需要排除掉
|
241
|
+
Dir.foreach("./componentsOnRemote/#{x}").to_a.all? { |f| f.start_with?(".") }
|
242
|
+
}
|
243
|
+
.map { |comp|
|
244
|
+
{
|
245
|
+
name: comp,
|
246
|
+
sha: git_sha_value(comp),
|
247
|
+
binary: false,
|
248
|
+
}
|
249
|
+
}
|
250
|
+
end
|
251
|
+
|
252
|
+
# 处理 Pods.xcodeproj 的依赖
|
253
|
+
def process_pods_project_dependencies(name)
|
254
|
+
cfg = @@pod_cfg[name]
|
255
|
+
proj = cfg[:project]
|
213
256
|
changed = false
|
214
|
-
|
215
|
-
|
257
|
+
|
258
|
+
latest_target = nil
|
259
|
+
removing_target_name = nil
|
216
260
|
|
217
261
|
if cfg[:binary] == true
|
218
|
-
# 使用 Binary 版本的 target
|
262
|
+
# 使用 Binary 版本的 target,如果不存在则创建一个
|
263
|
+
binary_target = proj.target_by_name("#{name}-Binary")
|
219
264
|
if binary_target == nil
|
220
265
|
binary_target = add_binary_target(proj, name)
|
221
266
|
changed = true
|
222
267
|
end
|
223
268
|
|
224
|
-
|
225
|
-
|
226
|
-
# 移除源码版本的 target
|
227
|
-
if source_target
|
228
|
-
replace_target_dependency(pods_target, source_target, binary_target)
|
229
|
-
proj.targets.delete_if { |t| t == source_target }
|
230
|
-
changed = true
|
231
|
-
end
|
269
|
+
latest_target = binary_target
|
270
|
+
removing_target_name = name
|
232
271
|
else
|
233
|
-
@@pod_cfg[name][:target] = source_target
|
234
272
|
# 使用源码版本的 target
|
273
|
+
source_target = proj.target_by_name(name)
|
235
274
|
source_target.build_configurations.each { |cfg|
|
236
275
|
if cfg.build_settings["BUILD_LIBRARY_FOR_DISTRIBUTION"] != "YES"
|
237
276
|
cfg.build_settings["BUILD_LIBRARY_FOR_DISTRIBUTION"] = "YES"
|
238
277
|
changed = true
|
239
278
|
end
|
240
279
|
}
|
280
|
+
|
281
|
+
latest_target = source_target
|
282
|
+
removing_target_name = "#{name}-Binary"
|
241
283
|
end
|
242
|
-
|
284
|
+
|
285
|
+
cfg[:target] = latest_target
|
286
|
+
|
287
|
+
# 更新依赖
|
288
|
+
changed = update_pods_target_dependency(removing_target_name, latest_target) || changed
|
289
|
+
changed = proj.targets.map(&:name).include?(removing_target_name) || changed
|
290
|
+
proj.targets.delete_if { |t| t.name == removing_target_name }
|
291
|
+
|
292
|
+
cfg[:save] = changed
|
243
293
|
end
|
244
294
|
|
245
|
-
#
|
295
|
+
# 处理组件 pod 的 xcconfig
|
246
296
|
def process_pod_xcconfig(name)
|
247
297
|
# 根据 pod 是源码还是二进制包,切换路径为 PODS_CONFIGURATION_BUILD_DIR 或 PODS_XCFRAMEWORKS_BUILD_DIR
|
248
298
|
["debug", "release"].each { |cfg_name|
|
249
|
-
cfg_path = Pathname("
|
299
|
+
cfg_path = Pathname(File.join(@@ctx.sandbox_root, "Target Support Files", name, "#{name}.#{cfg_name}.xcconfig"))
|
250
300
|
next if not File.exist?(cfg_path)
|
251
301
|
cfg = Xcodeproj::Config.new(cfg_path)
|
252
302
|
fsp_str = cfg.attributes["FRAMEWORK_SEARCH_PATHS"] || "$(inherited)"
|
@@ -283,7 +333,7 @@ module Dongjia
|
|
283
333
|
# 处理 Pods/Target Support Files/Pods-项目名/Pods-项目名.debug(release).xcconfig
|
284
334
|
# 所有被二进制化的 pod,增加 "${PODS_XCFRAMEWORKS_BUILD_DIR}/#{pod_name}"
|
285
335
|
["debug", "release"].each { |cfg_name|
|
286
|
-
cfg_path = Pathname("
|
336
|
+
cfg_path = Pathname(File.join(@@ctx.sandbox_root, "Target Support Files", aggregate_target_name, "#{aggregate_target_name}.#{cfg_name}.xcconfig"))
|
287
337
|
next if not File.exist?(cfg_path)
|
288
338
|
cfg = Xcodeproj::Config.new(cfg_path)
|
289
339
|
fsp = cfg.attributes["FRAMEWORK_SEARCH_PATHS"].split(" ") || ["$(inherited)"]
|
@@ -303,7 +353,7 @@ module Dongjia
|
|
303
353
|
def add_binary_target(proj, name)
|
304
354
|
source_target = proj.target_by_name(name)
|
305
355
|
bin_target = proj.new_aggregate_target("#{name}-Binary", [], :ios, '10.0')
|
306
|
-
|
356
|
+
|
307
357
|
# 处理 xcconfig 引用
|
308
358
|
cfg_list0 = source_target.build_configuration_list
|
309
359
|
cfg_list1 = bin_target.build_configuration_list
|
@@ -316,20 +366,33 @@ module Dongjia
|
|
316
366
|
|
317
367
|
# 添加依赖
|
318
368
|
bin_target.dependencies.replace(source_target.dependencies)
|
369
|
+
|
319
370
|
return bin_target
|
320
371
|
end
|
321
372
|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
373
|
+
# 更新 Pods.xcodeproj 中 target 的依赖关系
|
374
|
+
def update_pods_target_dependency(removing_target_name, new_target)
|
375
|
+
dep_names = @@pods_target.dependencies.map(&:name)
|
376
|
+
changed = false
|
377
|
+
|
378
|
+
index = dep_names.index(removing_target_name)
|
379
|
+
if index
|
380
|
+
@@pods_target.dependencies.delete_at(index)
|
381
|
+
changed = true
|
382
|
+
end
|
383
|
+
|
384
|
+
index = dep_names.index(new_target.name)
|
385
|
+
unless index
|
386
|
+
@@pods_target.add_dependency(new_target)
|
387
|
+
changed = true
|
388
|
+
end
|
389
|
+
|
390
|
+
return changed
|
329
391
|
end
|
330
392
|
|
331
393
|
# 下载 framework 到 Pods/_Frameworks 目录下
|
332
394
|
def download_frameworks
|
395
|
+
return unless @@enabled
|
333
396
|
framework_root = File.join(@@ctx.sandbox_root, "_Frameworks")
|
334
397
|
cache_root = File.join(framework_root, "Caches")
|
335
398
|
FileUtils.mkdir_p(cache_root) unless File.exist?(cache_root)
|
@@ -359,8 +422,9 @@ module Dongjia
|
|
359
422
|
}
|
360
423
|
end
|
361
424
|
|
362
|
-
def process_binary_group(
|
425
|
+
def process_binary_group(name)
|
363
426
|
cfg = @@pod_cfg[name]
|
427
|
+
proj = cfg[:project]
|
364
428
|
binary_group = proj.groups.find { |g| g.name == "Binary" }
|
365
429
|
if cfg[:binary] == true
|
366
430
|
if binary_group == nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-dongjia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jiangzhuoyi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,7 +112,6 @@ files:
|
|
112
112
|
- lib/cocoapods-dongjia/gem_version.rb
|
113
113
|
- lib/cocoapods_plugin.rb
|
114
114
|
- lib/dongjia_binarization.rb
|
115
|
-
- lib/dongjia_branch_inspector.rb
|
116
115
|
- lib/dongjia_config.rb
|
117
116
|
- lib/dongjia_enterprise_inspector.rb
|
118
117
|
- lib/dongjia_pods_iterator.rb
|
@@ -130,9 +129,9 @@ licenses:
|
|
130
129
|
- MIT
|
131
130
|
metadata:
|
132
131
|
update_desc: |2
|
133
|
-
-
|
134
|
-
-
|
135
|
-
post_install_message:
|
132
|
+
- 修复源码和二进制切换后的集成依赖问题
|
133
|
+
- 修复一些导致 crash 的问题
|
134
|
+
post_install_message:
|
136
135
|
rdoc_options: []
|
137
136
|
require_paths:
|
138
137
|
- lib
|
@@ -147,8 +146,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
146
|
- !ruby/object:Gem::Version
|
148
147
|
version: '0'
|
149
148
|
requirements: []
|
150
|
-
rubygems_version: 3.
|
151
|
-
signing_key:
|
149
|
+
rubygems_version: 3.0.3.1
|
150
|
+
signing_key:
|
152
151
|
specification_version: 4
|
153
152
|
summary: A longer description of cocoapods-dongjia.
|
154
153
|
test_files: []
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'cocoapods'
|
2
|
-
|
3
|
-
module Pod
|
4
|
-
|
5
|
-
class Podfile
|
6
|
-
|
7
|
-
gitdir = File.join(Dir.pwd, '.git')
|
8
|
-
if File.exist?(gitdir)
|
9
|
-
|
10
|
-
# 获取当前分支,仅对 dev 和 master 进行校验
|
11
|
-
branch = `git symbolic-ref --short -q HEAD`.strip
|
12
|
-
if branch == 'dev' or branch == 'master'
|
13
|
-
|
14
|
-
# Hook pod 方法
|
15
|
-
alias_method :pod_alias_by_inspector, :pod
|
16
|
-
|
17
|
-
def pod(name = nil, *requirements, &block)
|
18
|
-
|
19
|
-
if name.start_with?('DJ') && requirements.count > 0
|
20
|
-
req = requirements.first
|
21
|
-
if req[:branch] && req[:branch] != 'master'
|
22
|
-
UI.warn "检测到 #{name} 指向了分支 #{req[:branch]}\n"
|
23
|
-
exit -1
|
24
|
-
elsif req[:tag]
|
25
|
-
UI.warn "检测到 #{name} 指向了标签 #{req[:tag]}\n"
|
26
|
-
exit -1
|
27
|
-
elsif req[:commit]
|
28
|
-
UI.warn "检测到 #{name} 指向了节点 #{req[:commit]}\n"
|
29
|
-
exit -1
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
pod_alias_by_inspector(name, *requirements, &block)
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|