cocoapods-ppbuild 0.0.5 → 1.0.0
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: 231833d75f5a03801907494182800a0f3e3cbeba1706c4317b0c6574ded2245c
|
4
|
+
data.tar.gz: a0396c24d329fa72fb4ff504884ceb2d57db21780fc82e6c5bde9fb714842ecf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e47d544f99c690e320808859dbf9669dbd2346ff8592dced553e4d5bb3829f69986315da4c81bf383b34cda28c6de9f75a048b8170040f01906523d5e4e9761
|
7
|
+
data.tar.gz: f991800a994b002b43d6fb0e3e80fb34fc525303895ff61d3b95cab5f01f9a7e0568187f87bd909cd6827b0ed8f0069b2f03ff5a0a06e3bc2ef7f2f9b326d82e
|
@@ -61,8 +61,6 @@ module Pod
|
|
61
61
|
end
|
62
62
|
|
63
63
|
target_names.each do |name|
|
64
|
-
|
65
|
-
Pod::UI.puts "........... oname: #{name}"
|
66
64
|
# symbol link copy all substructure
|
67
65
|
real_file_folder = prebuild_sandbox.framework_folder_path_for_target_name(name)
|
68
66
|
|
@@ -112,7 +110,6 @@ module Pod
|
|
112
110
|
if object.real_file_path != nil
|
113
111
|
real_path = Pathname.new(object.target_file_path)
|
114
112
|
real_path.rmtree if real_path.exist?
|
115
|
-
Pod::UI.puts "........... object.target_file_path: #{object.target_file_path}"
|
116
113
|
make_link(object.real_file_path, object.target_file_path, false)
|
117
114
|
end
|
118
115
|
end
|
@@ -142,8 +139,13 @@ module Pod
|
|
142
139
|
if changes == nil
|
143
140
|
updated_names = PrebuildSandbox.from_standard_sandbox(self.sandbox).exsited_framework_pod_names
|
144
141
|
else
|
145
|
-
|
146
|
-
|
142
|
+
t_changes = Pod::Prebuild::Passer.prebuild_pods_changes
|
143
|
+
added = t_changes.added
|
144
|
+
changed = t_changes.changed
|
145
|
+
deleted = t_changes.deleted
|
146
|
+
updated_names = (added + changed + deleted).to_a
|
147
|
+
|
148
|
+
updated_names = (changes + updated_names).uniq
|
147
149
|
end
|
148
150
|
|
149
151
|
updated_names.each do |name|
|
@@ -160,87 +162,133 @@ module Pod
|
|
160
162
|
|
161
163
|
end
|
162
164
|
|
165
|
+
def save_change_targets!
|
166
|
+
sandbox_path = sandbox.root
|
167
|
+
existed_framework_folder = sandbox.generate_framework_path
|
168
|
+
if local_manifest != nil
|
169
|
+
changes = prebuild_pods_changes
|
170
|
+
added = changes.added
|
171
|
+
changed = changes.changed
|
172
|
+
unchanged = changes.unchanged
|
173
|
+
deleted = changes.deleted.to_a
|
174
|
+
|
175
|
+
existed_framework_folder.mkdir unless existed_framework_folder.exist?
|
176
|
+
exsited_framework_pod_names = sandbox.exsited_framework_pod_names
|
177
|
+
|
178
|
+
# additions
|
179
|
+
missing = unchanged.select do |pod_name|
|
180
|
+
not exsited_framework_pod_names.include?(pod_name)
|
181
|
+
end
|
182
|
+
|
183
|
+
# 保存有改变的target列表
|
184
|
+
root_names_to_update = (added + changed + missing).uniq
|
185
|
+
updates_target_names = (root_names_to_update + deleted).uniq
|
186
|
+
cache = []
|
187
|
+
updates_targets = []
|
188
|
+
updates_target_names.each do |pod_name|
|
189
|
+
tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)
|
190
|
+
if tars.nil?
|
191
|
+
tars = []
|
192
|
+
end
|
193
|
+
updates_targets = (updates_targets + tars).uniq
|
194
|
+
end
|
195
|
+
updates_dependency_targets = updates_targets.map {|t|
|
196
|
+
t.recursive_dependent_targets
|
197
|
+
}.flatten.uniq || []
|
198
|
+
dependency_names = updates_dependency_targets.map { |e| e.pod_name }
|
199
|
+
if Pod::Prebuild::Passer.prebuild_pod_targets_changes.nil?
|
200
|
+
Pod::Prebuild::Passer.prebuild_pod_targets_changes = (updates_target_names + dependency_names).uniq
|
201
|
+
else
|
202
|
+
Pod::Prebuild::Passer.prebuild_pod_targets_changes = (Pod::Prebuild::Passer.prebuild_pod_targets_changes + updates_target_names + dependency_names).uniq
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
163
206
|
|
164
207
|
# Modify specification to use only the prebuild framework after analyzing
|
165
208
|
old_method2 = instance_method(:resolve_dependencies)
|
166
209
|
define_method(:resolve_dependencies) do
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
210
|
+
if Pod::is_prebuild_stage
|
211
|
+
# call original
|
212
|
+
old_method2.bind(self).()
|
213
|
+
self.save_change_targets!
|
214
|
+
else
|
215
|
+
# Remove the old target files, else it will not notice file changes
|
216
|
+
self.remove_target_files_if_needed
|
217
|
+
# call original
|
218
|
+
old_method2.bind(self).()
|
219
|
+
# ...
|
220
|
+
# ...
|
221
|
+
# ...
|
222
|
+
# after finishing the very complex orginal function
|
223
|
+
|
224
|
+
# check the pods
|
225
|
+
# Although we have did it in prebuild stage, it's not sufficient.
|
226
|
+
# Same pod may appear in another target in form of source code.
|
227
|
+
# Prebuild.check_one_pod_should_have_only_one_target(self.prebuild_pod_targets)
|
228
|
+
self.validate_every_pod_only_have_one_form
|
229
|
+
|
230
|
+
|
231
|
+
# prepare
|
232
|
+
cache = []
|
233
|
+
|
234
|
+
def add_vendered_framework(spec, platform, added_framework_file_path)
|
235
|
+
if spec.attributes_hash[platform] == nil
|
236
|
+
spec.attributes_hash[platform] = {}
|
237
|
+
end
|
238
|
+
vendored_frameworks = spec.attributes_hash[platform]["vendored_frameworks"] || []
|
239
|
+
vendored_frameworks = [vendored_frameworks] if vendored_frameworks.kind_of?(String)
|
240
|
+
vendored_frameworks += [added_framework_file_path]
|
241
|
+
spec.attributes_hash[platform]["vendored_frameworks"] = vendored_frameworks
|
190
242
|
end
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
spec.attributes_hash["source_files"] = []
|
198
|
-
["ios", "watchos", "tvos", "osx"].each do |plat|
|
199
|
-
if spec.attributes_hash[plat] != nil
|
200
|
-
spec.attributes_hash[plat]["source_files"] = []
|
243
|
+
def empty_source_files(spec)
|
244
|
+
spec.attributes_hash["source_files"] = []
|
245
|
+
["ios", "watchos", "tvos", "osx"].each do |plat|
|
246
|
+
if spec.attributes_hash[plat] != nil
|
247
|
+
spec.attributes_hash[plat]["source_files"] = []
|
248
|
+
end
|
201
249
|
end
|
202
250
|
end
|
203
|
-
end
|
204
251
|
|
205
252
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
253
|
+
specs = self.analysis_result.specifications
|
254
|
+
prebuilt_specs = (specs.select do |spec|
|
255
|
+
self.prebuild_pod_names.include? spec.root.name
|
256
|
+
end)
|
210
257
|
|
211
|
-
|
258
|
+
prebuilt_specs.each do |spec|
|
212
259
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
260
|
+
# Use the prebuild framworks as vendered frameworks
|
261
|
+
# get_corresponding_targets
|
262
|
+
targets = Pod.fast_get_targets_for_pod_name(spec.root.name, self.pod_targets, cache)
|
263
|
+
targets.each do |target|
|
264
|
+
# the framework_file_path rule is decided when `install_for_prebuild`,
|
265
|
+
# as to compitable with older version and be less wordy.
|
266
|
+
framework_file_path = target.framework_name
|
267
|
+
framework_file_path = target.name + "/" + framework_file_path if targets.count > 1
|
268
|
+
add_vendered_framework(spec, target.platform.name.to_s, framework_file_path)
|
269
|
+
end
|
270
|
+
# Clean the source files
|
271
|
+
# we just add the prebuilt framework to specific platform and set no source files
|
272
|
+
# for all platform, so it doesn't support the sence that 'a pod perbuild for one
|
273
|
+
# platform and not for another platform.'
|
274
|
+
empty_source_files(spec)
|
275
|
+
|
276
|
+
# to remove the resurce bundle target.
|
277
|
+
# When specify the "resource_bundles" in podspec, xcode will generate a bundle
|
278
|
+
# target after pod install. But the bundle have already built when the prebuit
|
279
|
+
# phase and saved in the framework folder. We will treat it as a normal resource
|
280
|
+
# file.
|
281
|
+
if spec.attributes_hash["resource_bundles"]
|
282
|
+
bundle_names = spec.attributes_hash["resource_bundles"].keys
|
283
|
+
spec.attributes_hash["resource_bundles"] = nil
|
284
|
+
spec.attributes_hash["resources"] ||= []
|
285
|
+
spec.attributes_hash["resources"] += bundle_names.map{|n| n+".bundle"}
|
286
|
+
end
|
240
287
|
|
241
|
-
|
242
|
-
|
288
|
+
# to avoid the warning of missing license
|
289
|
+
spec.attributes_hash["license"] = {}
|
243
290
|
|
291
|
+
end
|
244
292
|
end
|
245
293
|
|
246
294
|
end
|
@@ -249,23 +297,25 @@ module Pod
|
|
249
297
|
# Override the download step to skip download and prepare file in target folder
|
250
298
|
old_method = instance_method(:install_source_of_pod)
|
251
299
|
define_method(:install_source_of_pod) do |pod_name|
|
252
|
-
|
253
|
-
|
254
|
-
pod_installer = create_pod_installer(pod_name)
|
255
|
-
# \copy from original
|
256
|
-
|
257
|
-
if self.prebuild_pod_names.include? pod_name
|
258
|
-
pod_installer.install_for_prebuild!(self.sandbox)
|
300
|
+
if Pod::is_prebuild_stage
|
301
|
+
tmp = old_method.bind(self).(pod_name)
|
259
302
|
else
|
260
|
-
|
261
|
-
|
303
|
+
# copy from original
|
304
|
+
pod_installer = create_pod_installer(pod_name)
|
305
|
+
# \copy from original
|
306
|
+
|
307
|
+
if self.prebuild_pod_names.include? pod_name
|
308
|
+
pod_installer.install_for_prebuild!(self.sandbox)
|
309
|
+
else
|
310
|
+
pod_installer.install!
|
311
|
+
end
|
262
312
|
|
263
|
-
|
264
|
-
|
265
|
-
|
313
|
+
# copy from original
|
314
|
+
return @installed_specs.concat(pod_installer.specs_by_platform.values.flatten.uniq)
|
315
|
+
# \copy from original
|
316
|
+
end
|
266
317
|
end
|
267
318
|
|
268
|
-
|
269
319
|
end
|
270
320
|
end
|
271
321
|
|
@@ -278,33 +328,34 @@ end
|
|
278
328
|
module Pod
|
279
329
|
module Generator
|
280
330
|
class EmbedFrameworksScript
|
281
|
-
|
282
331
|
old_method = instance_method(:script)
|
283
332
|
define_method(:script) do
|
284
|
-
|
285
333
|
script = old_method.bind(self).()
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
echo $path;
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
334
|
+
if not Pod::is_prebuild_stage
|
335
|
+
patch = <<-SH.strip_heredoc
|
336
|
+
#!/bin/sh
|
337
|
+
|
338
|
+
# ---- this is added by cocoapods-ppbuild ---
|
339
|
+
# Readlink cannot handle relative symlink well, so we override it to a new one
|
340
|
+
# If the path isn't an absolute path, we add a realtive prefix.
|
341
|
+
old_read_link=`which readlink`
|
342
|
+
readlink () {
|
343
|
+
path=`$old_read_link "$1"`;
|
344
|
+
if [ $(echo "$path" | cut -c 1-1) = '/' ]; then
|
345
|
+
echo $path;
|
346
|
+
else
|
347
|
+
echo "`dirname $1`/$path";
|
348
|
+
fi
|
349
|
+
}
|
350
|
+
# ---
|
351
|
+
SH
|
352
|
+
|
353
|
+
# patch the rsync for copy dSYM symlink
|
354
|
+
script = script.gsub "rsync --delete", "rsync --copy-links --delete"
|
355
|
+
|
356
|
+
script = patch + script
|
357
|
+
end
|
358
|
+
script
|
308
359
|
end
|
309
360
|
end
|
310
361
|
end
|
@@ -116,7 +116,7 @@ Pod::HooksManager.register('cocoapods-ppbuild', :pre_install) do |installer_cont
|
|
116
116
|
require_relative 'helper/prebuild_sandbox'
|
117
117
|
require_relative 'Prebuild'
|
118
118
|
|
119
|
-
Pod::UI.puts "火速编译中..."
|
119
|
+
# Pod::UI.puts "火速编译中..."
|
120
120
|
|
121
121
|
# Fetch original installer (which is running this pre-install hook) options,
|
122
122
|
# then pass them to our installer to perform update if needed
|
@@ -148,7 +148,8 @@ Pod::HooksManager.register('cocoapods-ppbuild', :pre_install) do |installer_cont
|
|
148
148
|
# install
|
149
149
|
lockfile = installer_context.lockfile
|
150
150
|
binary_installer = Pod::Installer.new(prebuild_sandbox, prebuild_podfile, lockfile)
|
151
|
-
|
151
|
+
|
152
|
+
require_relative 'Integration'
|
152
153
|
if binary_installer.have_exact_prebuild_cache? && !update
|
153
154
|
binary_installer.install_when_cache_hit!
|
154
155
|
else
|
@@ -170,7 +171,6 @@ Pod::HooksManager.register('cocoapods-ppbuild', :pre_install) do |installer_cont
|
|
170
171
|
# install
|
171
172
|
Pod::UI.puts "\n"
|
172
173
|
Pod::UI.puts "🤖 Pod Install"
|
173
|
-
require_relative 'Integration'
|
174
174
|
# go on the normal install step ...
|
175
175
|
end
|
176
176
|
|
@@ -62,43 +62,6 @@ module Pod
|
|
62
62
|
UI.puts "Using #{name}"
|
63
63
|
end
|
64
64
|
end
|
65
|
-
|
66
|
-
def save_change_targets!
|
67
|
-
sandbox_path = sandbox.root
|
68
|
-
existed_framework_folder = sandbox.generate_framework_path
|
69
|
-
|
70
|
-
if local_manifest != nil
|
71
|
-
changes = prebuild_pods_changes
|
72
|
-
added = changes.added
|
73
|
-
changed = changes.changed
|
74
|
-
unchanged = changes.unchanged
|
75
|
-
deleted = changes.deleted.to_a
|
76
|
-
|
77
|
-
existed_framework_folder.mkdir unless existed_framework_folder.exist?
|
78
|
-
exsited_framework_pod_names = sandbox.exsited_framework_pod_names
|
79
|
-
|
80
|
-
# additions
|
81
|
-
missing = unchanged.select do |pod_name|
|
82
|
-
not exsited_framework_pod_names.include?(pod_name)
|
83
|
-
end
|
84
|
-
|
85
|
-
# 保存有改变的target列表
|
86
|
-
root_names_to_update = (added + changed + missing).uniq
|
87
|
-
updates_target_names = (root_names_to_update + deleted).uniq
|
88
|
-
cache = []
|
89
|
-
updates_targets = []
|
90
|
-
updates_target_names.each do |pod_name|
|
91
|
-
tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)
|
92
|
-
if tars.nil? || tars.empty?
|
93
|
-
Pod::UI.puts "There's no target named (#{pod_name}) in Pod.xcodeproj." if t.nil?
|
94
|
-
else
|
95
|
-
updates_targets = (updates_targets + tars).uniq
|
96
|
-
end
|
97
|
-
end
|
98
|
-
updates_dependency_targets = updates_targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []
|
99
|
-
Pod::Prebuild::Passer.prebuild_pod_targets_changes = (updates_targets + updates_dependency_targets).uniq
|
100
|
-
end
|
101
|
-
end
|
102
65
|
|
103
66
|
# Build the needed framework files
|
104
67
|
def prebuild_frameworks!
|
@@ -128,8 +91,8 @@ module Pod
|
|
128
91
|
cache = []
|
129
92
|
targets = root_names_to_update.map do |pod_name|
|
130
93
|
tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)
|
131
|
-
if tars.nil?
|
132
|
-
|
94
|
+
if tars.nil?
|
95
|
+
tars = []
|
133
96
|
end
|
134
97
|
tars
|
135
98
|
end.flatten
|
@@ -261,13 +224,10 @@ module Pod
|
|
261
224
|
end
|
262
225
|
end
|
263
226
|
|
264
|
-
#
|
265
|
-
|
227
|
+
# hook run_plugins_post_install_hooks 方法
|
228
|
+
install_hooks_method = instance_method(:run_plugins_post_install_hooks)
|
266
229
|
define_method(:run_plugins_post_install_hooks) do
|
267
|
-
|
268
|
-
self.save_change_targets!
|
269
|
-
end
|
270
|
-
old_method2.bind(self).()
|
230
|
+
install_hooks_method.bind(self).()
|
271
231
|
if Pod::is_prebuild_stage
|
272
232
|
self.prebuild_frameworks!
|
273
233
|
end
|
@@ -73,7 +73,6 @@ module Pod
|
|
73
73
|
flag_file_path = folder + "#{pod_name}.pod_name"
|
74
74
|
return "" unless flag_file_path.exist?
|
75
75
|
version = File.read(flag_file_path)
|
76
|
-
Pod::UI.puts "............ version: #{version}"
|
77
76
|
version
|
78
77
|
end
|
79
78
|
|
@@ -115,3 +114,22 @@ module Pod
|
|
115
114
|
end
|
116
115
|
end
|
117
116
|
end
|
117
|
+
|
118
|
+
module Pod
|
119
|
+
class Sandbox
|
120
|
+
# hook 清除pod方法,得到删除的pod,通知主pod更新
|
121
|
+
clean_method = instance_method(:clean_pod)
|
122
|
+
define_method(:clean_pod) do |pod_name|
|
123
|
+
if Pod::is_prebuild_stage
|
124
|
+
if Pod::Prebuild::Passer.prebuild_pod_targets_changes.nil?
|
125
|
+
Pod::Prebuild::Passer.prebuild_pod_targets_changes = [pod_name]
|
126
|
+
else
|
127
|
+
Pod::Prebuild::Passer.prebuild_pod_targets_changes = (Pod::Prebuild::Passer.prebuild_pod_targets_changes + [pod_name]).uniq
|
128
|
+
end
|
129
|
+
end
|
130
|
+
clean_method.bind(self).(pod_name)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-ppbuild
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 彭懂
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|