cocoapods-xlbuild 1.0.1 → 1.1.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 +4 -4
- data/lib/cocoapods-xlbuild/Integration.rb +2 -0
- data/lib/cocoapods-xlbuild/Main.rb +9 -2
- data/lib/cocoapods-xlbuild/Prebuild.rb +40 -3
- data/lib/cocoapods-xlbuild/Reference/reference_source_code.rb +0 -3
- 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 +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b115beaa2a868c2f15e555c03786f4e47e57c8e9cd00e4abb45e6140a3dc2604
|
4
|
+
data.tar.gz: 3ebe4a69fb54ba2cfb2b45dbf73b32f0e1edc5b43fbcf762bfb74556b8b42a1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 593546a9bfc0300defc6ce32ba6bbb43af76f2ade7bd40cc874a6169ab1d0b63ad98c99af90cb5f0220ce4e92bf2de2bbcce54f2af25748e89138a1aa046a419
|
7
|
+
data.tar.gz: 38124e8ede2b04e44798e431e1ede9beef5468d9352317ca2ff053dc8d78996c5560133a1e0ef9cdebd507915debb89af2c6be118436acaa8ce6a034b074ac9c
|
@@ -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,6 +86,10 @@ 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
|
@@ -138,6 +145,7 @@ Pod::HooksManager.register('cocoapods-xlbuild', :pre_install) do |installer_cont
|
|
138
145
|
|
139
146
|
# make another custom sandbox
|
140
147
|
standard_sandbox = installer_context.sandbox
|
148
|
+
#linpeng edit: 修改Pod目录为 Pod/_Prebuild
|
141
149
|
prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sandbox)
|
142
150
|
|
143
151
|
# get the podfile for prebuild
|
@@ -176,10 +184,9 @@ Pod::HooksManager.register('cocoapods-xlbuild', :pre_install) do |installer_cont
|
|
176
184
|
end
|
177
185
|
|
178
186
|
## pod 安装依赖的时候会执行install,install的时候会执行run_plugins_post_install_hooks(Prebuildhook了该方法)
|
179
|
-
# 只要有触发install方法就会触发如下的
|
187
|
+
# 只要有触发install方法就会触发如下的 ,pre hook的时候有重新创建一个Install( binary_installer.install!)因此会触发两次的post_install的hook
|
180
188
|
Pod::HooksManager.register('cocoapods-xlbuild', :post_install) do |installer_context|
|
181
189
|
if Pod::Podfile::DSL.static_binary
|
182
|
-
Pod::UI.puts "🤖 replace_tagert_copy_source_sh " + Time.new.inspect
|
183
190
|
Pod::PrebuildSandbox.replace_tagert_copy_source_sh(installer_context)
|
184
191
|
end
|
185
192
|
|
@@ -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,9 +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
16
|
project = Xcodeproj::Project.open(proj_path)
|
20
17
|
exsited_framework_pod_names.each do |target_name|
|
21
18
|
real_reference("_Prebuild/#{target_name}", project, target_name)
|
@@ -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
|