cocoapods-xlbuild 1.0.0 → 1.1.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 +4 -4
- data/lib/cocoapods-xlbuild/Integration.rb +2 -0
- data/lib/cocoapods-xlbuild/Main.rb +63 -5
- data/lib/cocoapods-xlbuild/Prebuild.rb +40 -3
- data/lib/cocoapods-xlbuild/Reference/reference_source_code.rb +40 -5
- data/lib/cocoapods-xlbuild/gem_version.rb +1 -1
- data/lib/cocoapods-xlbuild/helper/prebuild_sandbox.rb +0 -2
- data/lib/cocoapods-xlbuild/rome/build_framework.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfe84969c5bf4aa57c96cca09cfcb42a628f69e836e5e10127378a5084a342c7
|
4
|
+
data.tar.gz: c13a23f3b99456911d876d8f6a4b7de58d9e9c704f32e2d26adf3b7b0442b21c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 633cc3ba7e6eccd7dcb343642d3ef9b07f100a592029befadf334a9f61a68af18399cca0961f281fe1a30d06933754ca0444759d6d26f69c210150eb0f7b310c
|
7
|
+
data.tar.gz: d196bff9a8e17fe7949648db27b6a5737a3c9fc1fd6323e3745151f818d7383b84cb64166d78222ebbf0bbc378a7d02f7e527ffe654a6bcfbee2e5260c718854
|
@@ -310,6 +310,7 @@ module Pod
|
|
310
310
|
|
311
311
|
|
312
312
|
# Override the download step to skip download and prepare file in target folder
|
313
|
+
# linpeng edit: hook集成安装源码的方法(源码下载完之后会将源码关联引用到Pod工程)
|
313
314
|
old_method = instance_method(:install_source_of_pod)
|
314
315
|
define_method(:install_source_of_pod) do |pod_name|
|
315
316
|
if Pod::is_prebuild_stage
|
@@ -320,6 +321,7 @@ module Pod
|
|
320
321
|
# \copy from original
|
321
322
|
|
322
323
|
if self.prebuild_pod_names.include? pod_name
|
324
|
+
#linpeng edit: Pod::is_prebuild_stage 编译完成后 还会执行该步骤 该步骤会将_Prebuild/GenerateFramework/xxxx目录关联引用到Pod/xxxx目录里面 替换framework原本的源码
|
323
325
|
pod_installer.install_for_prebuild!(self.sandbox)
|
324
326
|
else
|
325
327
|
pod_installer.install!
|
@@ -5,6 +5,9 @@ require_relative 'tool/tool'
|
|
5
5
|
module Pod
|
6
6
|
class Podfile
|
7
7
|
module DSL
|
8
|
+
def set_local_frameworks_cache_path(path)
|
9
|
+
DSL.local_frameworks_cache_path = path
|
10
|
+
end
|
8
11
|
# Enable prebuiding for all pods
|
9
12
|
# it has a lower priority to other xlbuild settings
|
10
13
|
def use_dynamic_binary!
|
@@ -83,10 +86,58 @@ module Pod
|
|
83
86
|
|
84
87
|
class_attr_accessor :custom_build_options
|
85
88
|
class_attr_accessor :custom_build_options_simulator
|
89
|
+
|
90
|
+
class_attr_accessor :local_frameworks_cache_path
|
91
|
+
local_frameworks_cache_path = nil
|
92
|
+
|
86
93
|
self.custom_build_options = []
|
87
94
|
self.custom_build_options_simulator = []
|
88
95
|
end
|
89
96
|
end
|
97
|
+
|
98
|
+
class Type
|
99
|
+
class_attr_accessor :pod_flag_file
|
100
|
+
@pod_flag_file = "build.xl"
|
101
|
+
|
102
|
+
def self.frameworks_type
|
103
|
+
is_static_binary = Pod::Podfile::DSL.static_binary
|
104
|
+
frameworks_type = is_static_binary ? "static" : "dynamic"
|
105
|
+
return frameworks_type
|
106
|
+
end
|
107
|
+
|
108
|
+
# 动静态库切换时候需要重新build(删除Pod目录重新构建)
|
109
|
+
def self.adjust_dynamic_static_change_pod(pod_root_path)
|
110
|
+
pod_type_path = pod_root_path+Pod::Type.pod_flag_file
|
111
|
+
if not File.exist?(pod_type_path)
|
112
|
+
FileUtils.remove_dir(pod_root_path)
|
113
|
+
else
|
114
|
+
frameworks_type = Pod::Type.frameworks_type
|
115
|
+
aFile = File.new(pod_type_path, "r")
|
116
|
+
if aFile
|
117
|
+
content = aFile.readlines[0]
|
118
|
+
if not frameworks_type.equal?(content)
|
119
|
+
FileUtils.remove_dir(pod_root_path)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
#构建结束 标记当前打包的是动|静态库
|
128
|
+
def self.adjust_dynamic_static_change_pod_finish(pod_root_path)
|
129
|
+
# 标记状态
|
130
|
+
pod_type_path = pod_root_path+Pod::Type.pod_flag_file
|
131
|
+
if File.exist?(pod_type_path)
|
132
|
+
File.delete(pod_type_path)
|
133
|
+
end
|
134
|
+
|
135
|
+
frameworks_type = Pod::Type.frameworks_type
|
136
|
+
File.open(pod_type_path, "w+") { |f|
|
137
|
+
f.write(frameworks_type)
|
138
|
+
}
|
139
|
+
end
|
140
|
+
end
|
90
141
|
end
|
91
142
|
|
92
143
|
Pod::HooksManager.register('cocoapods-xlbuild', :pre_install) do |installer_context|
|
@@ -138,8 +189,13 @@ Pod::HooksManager.register('cocoapods-xlbuild', :pre_install) do |installer_cont
|
|
138
189
|
|
139
190
|
# make another custom sandbox
|
140
191
|
standard_sandbox = installer_context.sandbox
|
192
|
+
#linpeng edit: 修改Pod目录为 Pod/_Prebuild
|
141
193
|
prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sandbox)
|
142
194
|
|
195
|
+
# 动|静态库(mach-o type)切换需要重新build(删除Pod目录)
|
196
|
+
pod_root_path = standard_sandbox.root
|
197
|
+
Pod::Type.adjust_dynamic_static_change_pod pod_root_path
|
198
|
+
|
143
199
|
# get the podfile for prebuild
|
144
200
|
prebuild_podfile = Pod::Podfile.from_ruby(podfile.defined_in_file)
|
145
201
|
|
@@ -168,26 +224,28 @@ Pod::HooksManager.register('cocoapods-xlbuild', :pre_install) do |installer_cont
|
|
168
224
|
Pod::Installer.disable_install_complete_message false
|
169
225
|
Pod::UserInterface.warnings = [] # clean the warning in the prebuild step, it's duplicated.
|
170
226
|
|
227
|
+
|
228
|
+
# install完成标记mach-o type
|
229
|
+
Pod::Type.adjust_dynamic_static_change_pod_finish pod_root_path
|
230
|
+
|
171
231
|
# -- step 2: pod install ---
|
172
232
|
# install
|
173
|
-
Pod::UI.puts "🤖 Pod Install "
|
233
|
+
Pod::UI.puts "🤖 Pod Install "
|
174
234
|
# go on the normal install step ...
|
175
235
|
|
176
236
|
end
|
177
237
|
|
178
238
|
## pod 安装依赖的时候会执行install,install的时候会执行run_plugins_post_install_hooks(Prebuildhook了该方法)
|
179
|
-
# 只要有触发install方法就会触发如下的
|
239
|
+
# 只要有触发install方法就会触发如下的 ,pre hook的时候有重新创建一个Install( binary_installer.install!)因此会触发两次的post_install的hook
|
180
240
|
Pod::HooksManager.register('cocoapods-xlbuild', :post_install) do |installer_context|
|
181
|
-
Pod::UI.puts "🤖 Pod Install hook " + Time.new.inspect
|
182
241
|
if Pod::Podfile::DSL.static_binary
|
183
|
-
Pod::UI.puts "🤖 replace_tagert_copy_source_sh " + Time.new.inspect
|
184
242
|
Pod::PrebuildSandbox.replace_tagert_copy_source_sh(installer_context)
|
185
243
|
end
|
186
244
|
|
187
245
|
if !Pod.is_prebuild_stage && Pod::Podfile::DSL.dont_remove_source_code
|
188
|
-
Pod::UI.puts "🤖 pod工程关联引用源码 " + Time.new.inspect
|
189
246
|
require_relative 'reference/reference_source_code'
|
190
247
|
installer_context.refrence_source_code
|
248
|
+
installer_context.adjust_dynamic_framework_dsym
|
191
249
|
end
|
192
250
|
end
|
193
251
|
|
@@ -115,14 +115,52 @@ module Pod
|
|
115
115
|
Pod::Prebuild.remove_build_dir(sandbox_path)
|
116
116
|
targets.each do |target|
|
117
117
|
#linpeng edit + target.version
|
118
|
-
|
118
|
+
@sandbox_framework_folder_path_for_target_name = sandbox.framework_folder_path_for_target_name(target.name)
|
119
|
+
output_path = @sandbox_framework_folder_path_for_target_name
|
119
120
|
output_path.rmtree if output_path.exist?
|
120
121
|
if !target.should_build?
|
121
122
|
UI.puts "Prebuilding #{target.label}"
|
122
123
|
next
|
123
124
|
end
|
124
125
|
output_path.mkpath unless output_path.exist?
|
125
|
-
|
126
|
+
|
127
|
+
#local cache
|
128
|
+
localCachePathRoot = Pod::Podfile::DSL.local_frameworks_cache_path
|
129
|
+
is_static_binary = Pod::Podfile::DSL.static_binary
|
130
|
+
type_frameworks_dir = is_static_binary ? "static" : "dynamic"
|
131
|
+
is_has_local_cache = localCachePathRoot != nil
|
132
|
+
if not is_has_local_cache
|
133
|
+
#开始使用XcodeBuild进行编译静态库
|
134
|
+
Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator)
|
135
|
+
else
|
136
|
+
targetFrameworkPath = localCachePathRoot + "/#{type_frameworks_dir}/#{target.name}/#{target.version}"
|
137
|
+
if Dir.exist?(targetFrameworkPath)
|
138
|
+
puts "[XL].本地缓存仓库获取:#{target.name}(#{target.version}) #{type_frameworks_dir}"
|
139
|
+
Dir.foreach(targetFrameworkPath) do |file|
|
140
|
+
if file !="." and file !=".."
|
141
|
+
f = targetFrameworkPath+"/"+file
|
142
|
+
FileUtils.cp_r(f, output_path, :remove_destination => false )
|
143
|
+
end
|
144
|
+
end
|
145
|
+
else
|
146
|
+
#开始使用XcodeBuild进行编译静态库
|
147
|
+
Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator)
|
148
|
+
|
149
|
+
#save for cache
|
150
|
+
puts "[XL].本地缓存仓库新增:#{target.name}(#{target.version} #{type_frameworks_dir}"
|
151
|
+
local_cache_path = targetFrameworkPath
|
152
|
+
FileUtils.makedirs(local_cache_path) unless File.exists?local_cache_path
|
153
|
+
c_output_path = output_path.to_s
|
154
|
+
if Dir.exist?(output_path)
|
155
|
+
Dir.foreach(output_path) do |file|
|
156
|
+
if file !="." and file !=".."
|
157
|
+
f = c_output_path+"/"+file
|
158
|
+
FileUtils.cp_r(f, local_cache_path, :remove_destination => false )
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
126
164
|
|
127
165
|
# save the resource paths for later installing,动态库需要将frameworkwork中资源链接到pod上
|
128
166
|
if target.static_framework? and !target.resource_paths.empty?
|
@@ -228,7 +266,6 @@ module Pod
|
|
228
266
|
# hook run_plugins_post_install_hooks 方法
|
229
267
|
install_hooks_method = instance_method(:run_plugins_post_install_hooks)
|
230
268
|
define_method(:run_plugins_post_install_hooks) do
|
231
|
-
puts "[HY].run_plugins_post_install_hooks 触发 state:#{Pod::is_prebuild_stage}"
|
232
269
|
install_hooks_method.bind(self).()
|
233
270
|
if Pod::is_prebuild_stage
|
234
271
|
#开始编译
|
@@ -13,10 +13,6 @@ module Pod
|
|
13
13
|
|
14
14
|
exsited_framework_pod_names = pre_sandbox.exsited_framework_pod_names || []
|
15
15
|
proj_path = sandbox_path + get_project_name("Pods")
|
16
|
-
|
17
|
-
proj_path_new = Pathname.new(sandbox.project_path)
|
18
|
-
|
19
|
-
puts "[HY].沙盒路径:#{sandbox_path}"
|
20
16
|
project = Xcodeproj::Project.open(proj_path)
|
21
17
|
exsited_framework_pod_names.each do |target_name|
|
22
18
|
real_reference("_Prebuild/#{target_name}", project, target_name)
|
@@ -24,7 +20,46 @@ module Pod
|
|
24
20
|
project.save;
|
25
21
|
end
|
26
22
|
|
27
|
-
|
23
|
+
|
24
|
+
# 动态库dsym问题[CP] Copy dSYM
|
25
|
+
def adjust_dynamic_framework_dsym
|
26
|
+
sandbox_path = Pathname.new(sandbox.root).to_s
|
27
|
+
pre_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(sandbox)
|
28
|
+
exsited_framework_pod_names = pre_sandbox.exsited_framework_pod_names || []
|
29
|
+
|
30
|
+
exsited_framework_pod_names.each do |target_name|
|
31
|
+
input_xcfilelist = sandbox_path + "/Target Support Files/" + target_name + "/#{target_name}-copy-dsyms-input-files.xcfilelist"
|
32
|
+
output_xcfilelist = sandbox_path + "/Target Support Files/" + target_name + "/#{target_name}-copy-dsyms-output-files.xcfilelist"
|
33
|
+
remove_duplicated_bcsymbolmap_lines(input_xcfilelist)
|
34
|
+
remove_duplicated_bcsymbolmap_lines(output_xcfilelist)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
#https://github.com/CocoaPods/CocoaPods/issues/10373
|
39
|
+
def remove_duplicated_bcsymbolmap_lines(path)
|
40
|
+
if File.exist?path
|
41
|
+
top_lines = []
|
42
|
+
bcsymbolmap_lines = []
|
43
|
+
for line in File.readlines(path).map { |line| line.strip }
|
44
|
+
if line.include? ".bcsymbolmap"
|
45
|
+
bcsymbolmap_lines.append(line)
|
46
|
+
else
|
47
|
+
#去重
|
48
|
+
if not top_lines.include?line
|
49
|
+
top_lines.append(line)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
final_lines = top_lines + bcsymbolmap_lines.uniq
|
55
|
+
File.open(path, "w+") do |f|
|
56
|
+
f.puts(final_lines)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
private
|
28
63
|
def get_project_name(tageter_name)
|
29
64
|
return "#{tageter_name}.xcodeproj"
|
30
65
|
end
|
@@ -12,9 +12,7 @@ module Pod
|
|
12
12
|
tn = "Pods-#{target.name}"
|
13
13
|
dir = Pathname.new(File.join(installer_context.sandbox.root,"Target Support Files", tn))
|
14
14
|
sh_path = File.join(dir, "#{tn}-resources.sh")
|
15
|
-
puts "[HY].sh_path #{sh_path}"
|
16
15
|
if File.exists?(sh_path)
|
17
|
-
puts "[HY].resource.sh存在"
|
18
16
|
list.each do |tarname|
|
19
17
|
replace_content_file sh_path, tarname
|
20
18
|
end
|
@@ -23,8 +23,7 @@ def build_for_iosish_platform(sandbox,
|
|
23
23
|
deployment_target = target.platform.deployment_target.to_s
|
24
24
|
|
25
25
|
target_label = target.label # name with platform if it's used in multiple platforms
|
26
|
-
#
|
27
|
-
Pod::UI.puts "[HY].Prebuilding #{target_label} -> #{target.version}"
|
26
|
+
Pod::UI.puts "[XL].Prebuilding #{target_label} -> #{target.version}"
|
28
27
|
|
29
28
|
other_options = []
|
30
29
|
# bitcode enabled
|
@@ -95,11 +94,13 @@ def build_for_iosish_platform(sandbox,
|
|
95
94
|
FileUtils.mv tmp_lipoed_binary_path, "#{device_framework_path}.dSYM/Contents/Resources/DWARF/#{module_name}", :force => true
|
96
95
|
end
|
97
96
|
# move
|
97
|
+
# linpeng edit:xxxx.framework.DSYM文件挪到GenerateFramework的xxx目录下
|
98
98
|
FileUtils.mv device_dsym, output_path, :force => true
|
99
99
|
end
|
100
100
|
|
101
101
|
# output
|
102
102
|
output_path.mkpath unless output_path.exist?
|
103
|
+
#linpeng edit: 将build文件夹的xxxx.framework移动到GenerateFramework的xxxx目录下
|
103
104
|
FileUtils.mv device_framework_path, output_path, :force => true
|
104
105
|
# 如果是静态库则需要手动处理资源文件
|
105
106
|
if Pod::Podfile::DSL.static_binary
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-xlbuild
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 林鹏
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 工程静态库编译,提高编译速度.
|
14
14
|
email:
|