cocoapods-lzspeed 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-lzspeed/command/lzspeed.rb +224 -67
- data/lib/cocoapods-lzspeed/gem_version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '050555688144f48854619c23af7a15626e05147d29e41d592bf9ef7f584c8a58'
|
4
|
+
data.tar.gz: ea80368fc655bbb93af1c91d8eb30a0ea98797ec459b2a3c5ad112c6e7eb6a9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c9c49cbd71acc92a4033f625c260adf87c4ea99a61e8b0701fb405fd3df204570520417fd3aa94d88bdc8ba343ddeb8b5853a0cb69e679f75fd01a6a0b8b96f
|
7
|
+
data.tar.gz: 8b917e23dc7bb9c09f61c1ac703f8900c3581ade636d77a3228700caef1c1a56c1c239fe1988931af1f5ccd618953a358135cef8e8a1228a7c186c1274e5eed9
|
@@ -2,76 +2,233 @@ require 'xcodeproj'
|
|
2
2
|
|
3
3
|
module CocoapodsLZSpeed
|
4
4
|
|
5
|
-
Pod::HooksManager.register('cocoapods-lzspeed', :pre_install) do |context|
|
5
|
+
Pod::HooksManager.register('cocoapods-lzspeed', :pre_install) do |context|
|
6
6
|
|
7
|
-
|
8
|
-
# context.podfile.installation_options.incremental_installation = true
|
9
|
-
Pod::UI.puts 'cocoapods-lzspeed:executed successfully!'
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
class Tools
|
14
|
-
|
15
|
-
def get_project(file_path)
|
16
|
-
|
17
|
-
projPath = 'unknow'
|
18
|
-
|
19
|
-
Dir.foreach(file_path) do |file|
|
20
|
-
|
21
|
-
extn = File.extname file
|
22
|
-
|
23
|
-
if extn == '.xcodeproj'
|
24
|
-
|
25
|
-
projPath = file_path+file
|
26
|
-
|
27
|
-
break
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
return projPath
|
34
|
-
|
35
|
-
end
|
7
|
+
context.podfile.installation_options.generate_multiple_pod_projects = true
|
36
8
|
|
37
|
-
|
9
|
+
# context.podfile.installation_options.incremental_installation = true
|
38
10
|
|
39
|
-
|
11
|
+
Pod::UI.puts 'cocoapods-lzspeed:executed successfully!'
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
Pod::HooksManager.register('cocoapods-lzspeed', :post_install) do |context|
|
16
|
+
|
17
|
+
project_path = get_project('./')
|
18
|
+
|
19
|
+
if project_path != 'unknow' && project_path.include?("QiYiVideo.xcodeproj")
|
20
|
+
|
21
|
+
update_root_project(project_path)
|
22
|
+
|
23
|
+
pods_project_path = get_pod_project('./Pods/')
|
24
|
+
|
25
|
+
update_pod_project(pods_project_path)
|
26
|
+
|
27
|
+
# clean_flag_file('./')
|
28
|
+
|
29
|
+
system 'defaults write com.apple.Xcode PBXNumberOfParallelBuildSubtasks 12'
|
30
|
+
end
|
31
|
+
|
32
|
+
Pod::UI.puts 'cocoapods-lzspeed:executed successfully!'
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_project(file_path)
|
37
|
+
projPath = 'unknow'
|
38
|
+
Dir.foreach(file_path) do |file|
|
39
|
+
extn = File.extname file
|
40
|
+
if extn == '.xcodeproj'
|
41
|
+
projPath = file_path+file
|
42
|
+
break
|
43
|
+
end
|
44
|
+
end
|
45
|
+
return projPath
|
46
|
+
end
|
47
|
+
|
48
|
+
def update_root_project(path)
|
49
|
+
|
50
|
+
targets = Array.new
|
51
|
+
project = Xcodeproj::Project.open(path)
|
52
|
+
target = project.targets[0]
|
53
|
+
|
54
|
+
isUpdate = false
|
55
|
+
|
56
|
+
if target != nil
|
57
|
+
|
58
|
+
if target.dependencies != nil
|
59
|
+
target.dependencies.clear
|
60
|
+
isUpdate = true
|
61
|
+
end
|
62
|
+
|
63
|
+
# s = ''
|
64
|
+
# File.open('./Pods/Target Support Files/Pods-QiYiVideo/Pods-QiYiVideo.debug.xcconfig','r+'){|f|
|
65
|
+
# f.each_line{|line|
|
66
|
+
# Pod::UI.puts line
|
67
|
+
# line_data = line.split('=')
|
68
|
+
# if line_data != nil
|
69
|
+
# if line_data[0].strip == 'OTHER_LDFLAGS'
|
70
|
+
# buffer = line_data[0] + " = " + '-w' + ' -Wall' + ' -fprofile-arcs' + ' -ftest-coverage' + line_data[1]
|
71
|
+
# s += buffer
|
72
|
+
# else
|
73
|
+
# s += line
|
74
|
+
# end
|
75
|
+
# end
|
76
|
+
# }
|
77
|
+
# }
|
78
|
+
|
79
|
+
# s += "CLANG_ENABLE_CODE_COVERAGE = NO\n"
|
80
|
+
# s += "GCC_GENERATE_TEST_COVERAGE_FILES = NO\n"
|
81
|
+
# s += "GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO\n"
|
82
|
+
# s += "LLVM_LTO = YES_THIN\n"
|
83
|
+
# Pod::UI.puts 'cocoapods-lzspeed:' + s
|
84
|
+
# File.write('./Pods/Target Support Files/Pods-QiYiVideo/Pods-QiYiVideo.debug.xcconfig',s)
|
85
|
+
|
86
|
+
target.build_phases.each do |phase|
|
87
|
+
|
88
|
+
#关闭 Embed App Extensions
|
89
|
+
if phase.instance_of? Xcodeproj::Project::Object::PBXCopyFilesBuildPhase
|
90
|
+
if phase.name == 'Embed App Extensions'
|
91
|
+
if phase.files != nil
|
92
|
+
phase.files.clear
|
93
|
+
isUpdate = true
|
94
|
+
end
|
95
|
+
# target.build_phases.delete(phase)
|
96
|
+
# isUpdate = true
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
#关闭 Generate Debug Icon
|
101
|
+
if phase.instance_of? Xcodeproj::Project::Object::PBXShellScriptBuildPhase
|
102
|
+
if phase.name == 'Generate Debug Icon'
|
103
|
+
target.build_phases.delete(phase)
|
104
|
+
# phase.shell_script = ''
|
105
|
+
isUpdate = true
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
if phase.instance_of? Xcodeproj::Project::Object::PBXShellScriptBuildPhase
|
110
|
+
if phase.name == '[CP] Copy Pods Resources'
|
111
|
+
# temp = phase.shell_script
|
112
|
+
# if !temp.include?(".cocoapods-lzspeed~")
|
113
|
+
# shell_script = "if [ ! -f \"$SRCROOT/.cocoapods-lzspeed~\" ] || [ ! -f \"$BUILT_PRODUCTS_DIR/.cocoapods-lzspeed~\" ]; then\n\ttouch \"$SRCROOT/.cocoapods-lzspeed~\" \n\ttouch \"$BUILT_PRODUCTS_DIR/.cocoapods-lzspeed~\"\n\t"
|
114
|
+
# shell_script.concat(temp)
|
115
|
+
# shell_script.concat("fi")
|
116
|
+
# phase.shell_script = shell_script;
|
117
|
+
# isUpdate = true
|
118
|
+
# end
|
119
|
+
|
120
|
+
output_files = phase.output_paths
|
121
|
+
if output_files != nil
|
122
|
+
output_files.delete("${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Assets.car")
|
123
|
+
isUpdate = true
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
target.build_configurations.each do |config|
|
131
|
+
if config.name == "Debug"
|
132
|
+
|
133
|
+
#链接器优化
|
134
|
+
if config.build_settings["LLVM_LTO"] != "YES_THIN"
|
135
|
+
config.build_settings["LLVM_LTO"] = "YES_THIN"
|
136
|
+
isUpdate = true
|
137
|
+
end
|
138
|
+
|
139
|
+
#关闭链接 warning
|
140
|
+
other_ldflags = config.build_settings["OTHER_LDFLAGS"]
|
141
|
+
if other_ldflags.instance_of? Array
|
142
|
+
if !other_ldflags.include?("-w")
|
143
|
+
other_ldflags.insert(0,"-w")
|
144
|
+
config.build_settings["OTHER_LDFLAGS"] = other_ldflags
|
145
|
+
isUpdate = true
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
#关闭 Code Coverage
|
150
|
+
if config.build_settings["CLANG_ENABLE_CODE_COVERAGE"] != "NO"
|
151
|
+
config.build_settings["CLANG_ENABLE_CODE_COVERAGE"] = "NO"
|
152
|
+
end
|
153
|
+
|
154
|
+
if config.build_settings["GCC_GENERATE_TEST_COVERAGE_FILES"] != "NO"
|
155
|
+
config.build_settings["GCC_GENERATE_TEST_COVERAGE_FILES"] = "NO"
|
156
|
+
end
|
157
|
+
|
158
|
+
if config.build_settings["GCC_INSTRUMENT_PROGRAM_FLOW_ARCS"] != "NO"
|
159
|
+
config.build_settings["GCC_INSTRUMENT_PROGRAM_FLOW_ARCS"] = "NO"
|
160
|
+
end
|
161
|
+
|
162
|
+
#处理 关闭 Code Coverage 之后产生的链接问题
|
163
|
+
other_ldflags = config.build_settings["OTHER_LDFLAGS"]
|
164
|
+
if other_ldflags.instance_of? Array
|
165
|
+
if !other_ldflags.include?("-Wall") && !other_ldflags.include?("-fprofile-arcs") && !other_ldflags.include?("-ftest-coverage")
|
166
|
+
other_ldflags.insert(0,"-Wall")
|
167
|
+
other_ldflags.insert(0,"-fprofile-arcs")
|
168
|
+
other_ldflags.insert(0,"-ftest-coverage")
|
169
|
+
config.build_settings["OTHER_LDFLAGS"] = other_ldflags
|
170
|
+
isUpdate = true
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
|
178
|
+
if isUpdate == true
|
179
|
+
project.save
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
183
|
+
|
184
|
+
def get_pod_project(file_path)
|
185
|
+
pods_proj = Array.new
|
186
|
+
Dir.foreach(file_path) do |file|
|
187
|
+
extn = File.extname file
|
188
|
+
if extn == '.xcodeproj'
|
189
|
+
pods_proj << file_path+file
|
190
|
+
end
|
191
|
+
end
|
192
|
+
return pods_proj
|
193
|
+
end
|
194
|
+
|
195
|
+
def update_pod_project(projs)
|
196
|
+
projs.each do |proj|
|
197
|
+
targets = Array.new
|
198
|
+
project = Xcodeproj::Project.open(proj)
|
199
|
+
target = project.targets[0]
|
200
|
+
|
201
|
+
isUpdate = false
|
202
|
+
|
203
|
+
if target != nil
|
204
|
+
target.build_configurations.each do |config|
|
205
|
+
if config.name == "Debug"
|
206
|
+
if config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] != "10.0"
|
207
|
+
config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "10.0"
|
208
|
+
isUpdate = true
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
if isUpdate == true
|
214
|
+
project.save
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
def clean_flag_file(parh)
|
220
|
+
path = File.join(parh,'.cocoapods-lzspeed~')
|
221
|
+
if File.exist?(path) == true
|
222
|
+
File.delete(path)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
module_function :get_project
|
227
|
+
module_function :update_root_project
|
228
|
+
module_function :get_pod_project
|
229
|
+
module_function :update_pod_project
|
230
|
+
module_function :clean_flag_file
|
40
231
|
|
41
|
-
project = Xcodeproj::Project.open(path)
|
42
|
-
|
43
|
-
target = project.targets[0]
|
44
|
-
|
45
|
-
if target != nil
|
46
|
-
|
47
|
-
target.build_phases.each do |phase|
|
48
|
-
|
49
|
-
if phase.instance_of? Xcodeproj::Project::Object::PBXShellScriptBuildPhase
|
50
|
-
|
51
|
-
if phase.name == '[CP] Copy Pods Resources'
|
52
|
-
|
53
|
-
files = phase.output_paths
|
54
|
-
if files != nil
|
55
|
-
files.clear
|
56
|
-
Pod::UI.puts 'Clean Output Files!'
|
57
|
-
end
|
58
|
-
|
59
|
-
paths = phase.output_file_list_paths
|
60
|
-
if paths != nil
|
61
|
-
paths.clear
|
62
|
-
Pod::UI.puts 'Clean Output File Lists!'
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
project.save
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
76
232
|
end
|
77
233
|
|
234
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-lzspeed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ningyuan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
|
-
rubygems_version: 3.0.3
|
80
|
+
rubygems_version: 3.0.3.1
|
81
81
|
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: cocoapods-lzspeed
|