cocoapods-mPaaS 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 +7 -0
- data/lib/cocoapods-mPaaS/baselineTools.rb +493 -0
- data/lib/cocoapods-mPaaS/checkUpdateTools.rb +42 -0
- data/lib/cocoapods-mPaaS/cocoapods_hook.rb +929 -0
- data/lib/cocoapods-mPaaS/command/mPaaS.rb +44 -0
- data/lib/cocoapods-mPaaS/command/mpaas/dev.rb +17 -0
- data/lib/cocoapods-mPaaS/command/mpaas/info.rb +170 -0
- data/lib/cocoapods-mPaaS/command/mpaas/init.rb +112 -0
- data/lib/cocoapods-mPaaS/command/mpaas/local_command.rb +49 -0
- data/lib/cocoapods-mPaaS/command/mpaas/open.rb +17 -0
- data/lib/cocoapods-mPaaS/command/mpaas/update.rb +223 -0
- data/lib/cocoapods-mPaaS/command/mpaas/version.rb +32 -0
- data/lib/cocoapods-mPaaS/command.rb +1 -0
- data/lib/cocoapods-mPaaS/dsl.rb +498 -0
- data/lib/cocoapods-mPaaS/gem_version.rb +5 -0
- data/lib/cocoapods-mPaaS/installNew.rb +303 -0
- data/lib/cocoapods-mPaaS/locales/en.yml +140 -0
- data/lib/cocoapods-mPaaS/locales/zh-Hans.yml +144 -0
- data/lib/cocoapods-mPaaS/localization.rb +238 -0
- data/lib/cocoapods-mPaaS/logTools.rb +67 -0
- data/lib/cocoapods-mPaaS/mPaaSPodfile.rb +117 -0
- data/lib/cocoapods-mPaaS/module_config.rb +298 -0
- data/lib/cocoapods-mPaaS/podfileTools.rb +48 -0
- data/lib/cocoapods-mPaaS/post_install_hook_processor.rb +61 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/DemoViewController.h +13 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/DemoViewController.m +43 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/Contents.json +6 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_Discovery.imageset/Contents.json +22 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_Discovery.imageset/TabBar_Discovery@2x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_Discovery.imageset/TabBar_Discovery@3x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_Discovery_Sel.imageset/Contents.json +22 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_Discovery_Sel.imageset/TabBar_Discovery_Sel@2x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_Discovery_Sel.imageset/TabBar_Discovery_Sel@3x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_Friends.imageset/Contents.json +22 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_Friends.imageset/TabBar_Friends@2x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_Friends.imageset/TabBar_Friends@3x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_Friends_Sel.imageset/Contents.json +22 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_Friends_Sel.imageset/TabBar_Friends_Sel@2x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_Friends_Sel.imageset/TabBar_Friends_Sel@3x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_HomeBar.imageset/Contents.json +22 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_HomeBar.imageset/icon30-line@2x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_HomeBar.imageset/icon30-line@3x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_HomeBar_Sel.imageset/Contents.json +22 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_HomeBar_Sel.imageset/icon30@2x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_HomeBar_Sel.imageset/icon30@3x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_PublicService.imageset/Contents.json +22 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_PublicService.imageset/TabBar_PublicService@2x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_PublicService.imageset/TabBar_PublicService@3x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_PublicService_Sel.imageset/Contents.json +22 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_PublicService_Sel.imageset/TabBar_PublicService_Sel@2x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/Images_mPaaS.xcassets/TabBar_PublicService_Sel.imageset/TabBar_PublicService_Sel@3x.png +0 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPAppDelegate.h +10 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPAppDelegate.m +43 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPDrawerController.h +8 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPDrawerController.m +135 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPDrawerLauncherAppDelegate.h +10 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPDrawerLauncherAppDelegate.m +43 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPDrawerLeftView.h +16 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPDrawerLeftView.m +86 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPDrawerMainViewController.h +21 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPDrawerMainViewController.m +104 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPLauncherAppDelegate.h +10 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPLauncherAppDelegate.m +91 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPNavigationController.h +8 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPNavigationController.m +25 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPNavigationLauncherAppDelegate.h +10 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPNavigationLauncherAppDelegate.m +43 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPTabBarController.h +8 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPTabBarController.m +27 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPViewController.h +8 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MPViewController.m +19 -0
- data/lib/cocoapods-mPaaS/templates/APMobileFramework/AutoConfig/MobileRuntime.plist +26 -0
- data/lib/cocoapods-mPaaS/write_info_list_mPaaSApp.rb +125 -0
- data/lib/cocoapods-mPaaS/xcode_helper.rb +334 -0
- data/lib/cocoapods-mPaaS.rb +41 -0
- data/lib/cocoapods_plugin.rb +15 -0
- metadata +160 -0
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
require "cocoapods-mPaaS/baselineTools"
|
|
2
|
+
require "cocoapods-mPaaS/mPaaSPodfile"
|
|
3
|
+
require 'cocoapods-mPaaS/localization'
|
|
4
|
+
|
|
5
|
+
module Pod
|
|
6
|
+
class Podfile
|
|
7
|
+
# attr_accessor :is_pod_support_mPaaS
|
|
8
|
+
attr_accessor :default_baseline
|
|
9
|
+
attr_accessor :is_use_tinyApp
|
|
10
|
+
attr_accessor :fix_pods
|
|
11
|
+
attr_accessor :is_use_mPaaS_online
|
|
12
|
+
attr_accessor :local_component_json_path
|
|
13
|
+
attr_accessor :local_content_json_path
|
|
14
|
+
attr_accessor :local_content_json_fallback
|
|
15
|
+
attr_accessor :mpaas_repo_url
|
|
16
|
+
|
|
17
|
+
module DSL
|
|
18
|
+
# 这里标记模块可选依赖的 magic word
|
|
19
|
+
VERSION_REMOVE = "mPaaS_remove"
|
|
20
|
+
|
|
21
|
+
def mPaaS_baseline(baseline)
|
|
22
|
+
# 增加初始化的校验
|
|
23
|
+
if baseline == 'x.x.x'
|
|
24
|
+
info = Pod::MPAAS::Localization.t('mpaas.dsl.replace_baseline_version_note')
|
|
25
|
+
raise Pod::Informative, info
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
self.default_baseline = BaselineTools.filterVerison(baseline)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def use_tinyApp!
|
|
32
|
+
self.is_use_tinyApp = true
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def use_mPaaS_online!
|
|
36
|
+
self.is_use_mPaaS_online = true
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def mPaaS_local_component_json(path)
|
|
40
|
+
self.local_component_json_path = path
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def mPaaS_local_content_json(path, fallback = false)
|
|
44
|
+
self.local_content_json_path = path
|
|
45
|
+
self.local_content_json_fallback = fallback
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def mPaaS_repo_url(url)
|
|
49
|
+
self.mpaas_repo_url = url
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# 只是记录展示用
|
|
53
|
+
def mPaaS_version_code(*version_code)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def tinyAppExist?
|
|
57
|
+
project_dir = Dir::pwd
|
|
58
|
+
podfile_path = File.join(project_dir, "Podfile")
|
|
59
|
+
|
|
60
|
+
mPaaSPodfile = MPaaSPodfile.new
|
|
61
|
+
mPaaSPodfile.run(podfile_path)
|
|
62
|
+
# puts("___________________#{mPaaSPodfile.mPaaSBaseline}\n_____#{mPaaSPodfile.mPaaSPodVersion}\n_____#{mPaaSPodfile.mPaaSVersionCode}\n_____#{mPaaSPodfile.mPaaSPodNames}\n_____")
|
|
63
|
+
|
|
64
|
+
mPaaSPodfile.mPaaSPodNames.each do |name|
|
|
65
|
+
if name == "mPaaS_TinyApp" || name == "mPaaS_TinyApp_without_BLE"
|
|
66
|
+
return true
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
return false
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def lbsExist?
|
|
74
|
+
project_dir = Dir::pwd
|
|
75
|
+
podfile_path = File.join(project_dir, "Podfile")
|
|
76
|
+
|
|
77
|
+
mPaaSPodfile = MPaaSPodfile.new
|
|
78
|
+
mPaaSPodfile.run(podfile_path)
|
|
79
|
+
#puts("___________________#{mPaaSPodfile.mPaaSBaseline}\n_____#{mPaaSPodfile.mPaaSPodVersion}\n_____#{mPaaSPodfile.mPaaSVersionCode}\n_____#{mPaaSPodfile.mPaaSPodNames}\n_____")
|
|
80
|
+
|
|
81
|
+
mPaaSPodfile.mPaaSPodNames.each do |name|
|
|
82
|
+
if name == "mPaaS_LBS"
|
|
83
|
+
return true
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
return false
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def aliAccountExist?
|
|
91
|
+
project_dir = Dir::pwd
|
|
92
|
+
podfile_path = File.join(project_dir, "Podfile")
|
|
93
|
+
|
|
94
|
+
mPaaSPodfile = MPaaSPodfile.new
|
|
95
|
+
mPaaSPodfile.run(podfile_path)
|
|
96
|
+
# puts("___________________#{mPaaSPodfile.mPaaSBaseline}\n_____#{mPaaSPodfile.mPaaSPodVersion}\n_____#{mPaaSPodfile.mPaaSVersionCode}\n_____#{mPaaSPodfile.mPaaSPodNames}\n_____")
|
|
97
|
+
|
|
98
|
+
mPaaSPodfile.mPaaSPodNames.each do |name|
|
|
99
|
+
if name == "mPaaS_AliAccount"
|
|
100
|
+
return true
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
return false
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def moduleExist?(moduleName)
|
|
108
|
+
project_dir = Dir::pwd
|
|
109
|
+
podfile_path = File.join(project_dir, "Podfile")
|
|
110
|
+
|
|
111
|
+
mPaaSPodfile = MPaaSPodfile.new
|
|
112
|
+
mPaaSPodfile.run(podfile_path)
|
|
113
|
+
# puts("___________________#{mPaaSPodfile.mPaaSBaseline}\n_____#{mPaaSPodfile.mPaaSPodVersion}\n_____#{mPaaSPodfile.mPaaSVersionCode}\n_____#{mPaaSPodfile.mPaaSPodNames}\n_____")
|
|
114
|
+
|
|
115
|
+
mPaaSPodfile.mPaaSPodNames.each do |name|
|
|
116
|
+
if name == moduleName
|
|
117
|
+
return true
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
return false
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def fix_pod(name, version)
|
|
125
|
+
unless self.fix_pods
|
|
126
|
+
self.fix_pods = {}
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
self.fix_pods[name] = version
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def remove_pod(name)
|
|
133
|
+
unless self.default_baseline
|
|
134
|
+
info = Pod::MPAAS::Localization.t('mpaas.dsl.use_global_default_baseline')
|
|
135
|
+
raise Pod::Informative, info
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
content_hash = BaselineTools.getContentFileByVersion(self.default_baseline)
|
|
139
|
+
opt_fw = content_hash["optional_frameworks"]
|
|
140
|
+
|
|
141
|
+
if opt_fw && opt_fw[name]
|
|
142
|
+
# 新 content.json:只标记可选模块的直接 frameworks
|
|
143
|
+
opt_fw[name].each do |pod_name|
|
|
144
|
+
fix_pod pod_name, VERSION_REMOVE
|
|
145
|
+
end
|
|
146
|
+
else
|
|
147
|
+
# 兼容老 content.json 或未在 optional_frameworks 中的模块:标记全部
|
|
148
|
+
baseline_hash = BaselineTools.getBaselineByVersion(self.default_baseline)
|
|
149
|
+
dependencies_hash = baseline_hash[name]
|
|
150
|
+
dependencies_hash && dependencies_hash.each do |pod_name, pod_version|
|
|
151
|
+
fix_pod pod_name, VERSION_REMOVE
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
def mPaaS_igenore_headers(*headers)
|
|
156
|
+
headers.each do |item|
|
|
157
|
+
if item.is_a?(String)
|
|
158
|
+
MPaaSCocoapodShare.instance.igenore_headers.add(item)
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def mpaas_target_ignore_headers(*headers)
|
|
164
|
+
return if current_target_definition.abstract?
|
|
165
|
+
|
|
166
|
+
# 获取当前的 target 名称作为 Hash 的 Key
|
|
167
|
+
target_name = current_target_definition.name
|
|
168
|
+
|
|
169
|
+
headers.each do |item|
|
|
170
|
+
if item.is_a?(String)
|
|
171
|
+
MPaaSCocoapodShare.instance.targetmap_igenore_headers[target_name] << item
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
rescue => e
|
|
175
|
+
LogTools.p_red "CocoaPods get current target name error: #{e.message}"
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Podfile 中 DSL 用
|
|
179
|
+
def mPaaS_pod(name, *version)
|
|
180
|
+
begin
|
|
181
|
+
unless current_target_definition.abstract?
|
|
182
|
+
MPaaSCocoapodShare.instance.usedMpaasTarget.add(current_target_definition.name.to_s)
|
|
183
|
+
end
|
|
184
|
+
rescue => e
|
|
185
|
+
LogTools.p_red "cocoapods get current target name error:#{e.message}"
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
current_verison = ""
|
|
189
|
+
if version && !version.empty?
|
|
190
|
+
# 先保留一段时间的继续取值
|
|
191
|
+
current_verison = BaselineTools.filterVerison(version[0])
|
|
192
|
+
|
|
193
|
+
LogTools.p_yellow "--------------------------------Warning-----------------------------------------------"
|
|
194
|
+
LogTools.p_red Pod::MPAAS::Localization.t('mpaas.dsl.mpaas_pod_deprecated_warning', name: name, version: version[0])
|
|
195
|
+
LogTools.p_red ""
|
|
196
|
+
LogTools.p_red Pod::MPAAS::Localization.t('mpaas.dsl.specify_global_default_baseline_warning')
|
|
197
|
+
else
|
|
198
|
+
if self.default_baseline
|
|
199
|
+
current_verison = self.default_baseline
|
|
200
|
+
else
|
|
201
|
+
info = Pod::MPAAS::Localization.t('mpaas.dsl.version_not_found_for_pod', name: name, current_version: current_verison)
|
|
202
|
+
raise Pod::Informative, info
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
baseline_hash = BaselineTools.getBaselineByVersion(current_verison, true)
|
|
207
|
+
dependencies_hash = baseline_hash[name]
|
|
208
|
+
if dependencies_hash
|
|
209
|
+
LogTools.v_green "mPaaS_pod : #{name}(#{current_verison}) <> #{dependencies_hash}\n"
|
|
210
|
+
dependencies_hash.each do |pod_name, pod_version|
|
|
211
|
+
if pod_name == "MPNebulaSDKPlugins"
|
|
212
|
+
if self.is_use_tinyApp || tinyAppExist?
|
|
213
|
+
LogTools.v_red "No need to pod MPNebulaSDKPlugins ..."
|
|
214
|
+
next
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# 10.1.60 恶心兼容处理 1
|
|
219
|
+
if name == "mPaaS_Nebula" && pod_name == "NebulaBiz" && (tinyAppExist?) # || lbsExist?
|
|
220
|
+
LogTools.p_yellow "skip NebulaBiz in mPaaS_Nebula..."
|
|
221
|
+
next
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# 10.1.60 恶心兼容处理 1a 20200413
|
|
225
|
+
# 如果 lbs 和 nebula 共存,用 nebula 的版本
|
|
226
|
+
if name == "mPaaS_LBS" && pod_name == "NebulaBiz" && moduleExist?('mPaaS_Nebula') && !tinyAppExist?# || lbsExist?
|
|
227
|
+
LogTools.p_yellow "skip NebulaBiz in mPaaS_LBS...(use mPaaS_LBS & mPaaS_Nebula)"
|
|
228
|
+
next
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
if name == "mPaaS_LBS" && pod_name == "TinyAppCommon" && moduleExist?('mPaaS_Nebula') && !tinyAppExist?# || lbsExist?
|
|
232
|
+
LogTools.p_yellow "skip TinyAppCommon in mPaaS_LBS...(use mPaaS_LBS & mPaaS_Nebula)"
|
|
233
|
+
next
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# 10.1.60 恶心兼容处理 2
|
|
237
|
+
if name == "mPaaS_Nebula" && pod_name == "TinyAppCommon" && (tinyAppExist?) # || lbsExist?
|
|
238
|
+
LogTools.p_yellow "skip TinyAppCommon in mPaaS_Nebula..."
|
|
239
|
+
next
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
# 10.1.60 恶心兼容处理 3
|
|
243
|
+
if name == "mPaaS_TinyApp" && pod_name == "Nebula" && aliAccountExist?
|
|
244
|
+
LogTools.p_yellow "skip Nebula in mPaaS_TinyApp..."
|
|
245
|
+
next
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
# 10.1.60 恶心兼容处理 3a
|
|
249
|
+
if name == "mPaaS_Nebula" && pod_name == "Nebula" && aliAccountExist?
|
|
250
|
+
LogTools.p_yellow "skip Nebula in mPaaS_Nebula..."
|
|
251
|
+
next
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
# 10.1.60 恶心兼容处理 4
|
|
255
|
+
if name == "mPaaS_LBS" && pod_name == "Nebula" && aliAccountExist?
|
|
256
|
+
LogTools.p_yellow "skip Nebula in mPaaS_LBS..."
|
|
257
|
+
next
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# 10.2.3 恶心兼容处理 5
|
|
261
|
+
if name == "mPaaS_CDP" && (pod_name == "NebulaBiz" || pod_name == "TinyAppCommon" || pod_name == "Nebula") && moduleExist?('mPaaS_Nebula')
|
|
262
|
+
LogTools.p_yellow "skip #{pod_name} in mPaaS_CDP... use mPaaS_Nebula"
|
|
263
|
+
next
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# 10.2.3 恶心兼容处理 5a
|
|
267
|
+
if name == "mPaaS_CDP" && (pod_name == "NebulaBiz" || pod_name == "TinyAppCommon" || pod_name == "Nebula") && tinyAppExist?
|
|
268
|
+
LogTools.p_yellow "skip #{pod_name} in mPaaS_CDP... use mPaaS_TinyApp"
|
|
269
|
+
next
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
if self.fix_pods && self.fix_pods.has_key?(pod_name)
|
|
273
|
+
# 版本号取 fix_pods 中的
|
|
274
|
+
LogTools.v_red "fix_pod #{pod_name}, #{self.fix_pods[pod_name]}"
|
|
275
|
+
|
|
276
|
+
fix_pod_verison = self.fix_pods[pod_name]
|
|
277
|
+
if fix_pod_verison && !fix_pod_verison.empty? && fix_pod_verison != VERSION_REMOVE
|
|
278
|
+
pod pod_name, fix_pod_verison
|
|
279
|
+
elsif fix_pod_verison == VERSION_REMOVE
|
|
280
|
+
# 查询当前父模块的可选依赖,判断 pod_name 是否允许被移除
|
|
281
|
+
unless @_remove_pod_options
|
|
282
|
+
@_remove_pod_options = BaselineTools.getOptionsInLocalByBaseline(self.default_baseline) || {}
|
|
283
|
+
content_hash_for_opt = BaselineTools.getContentFileByVersion(self.default_baseline)
|
|
284
|
+
@_remove_pod_opt_fw = content_hash_for_opt["optional_frameworks"]
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
opt_module_names = @_remove_pod_options[name] || []
|
|
288
|
+
if opt_module_names.empty?
|
|
289
|
+
pod pod_name, pod_version
|
|
290
|
+
LogTools.p_yellow "[Warning] remove_pod '#{pod_name}' 未生效:'#{name}' 没有声明可选依赖(options)"
|
|
291
|
+
else
|
|
292
|
+
# 收集当前父模块所有可选子模块的直接 frameworks
|
|
293
|
+
removable_frameworks = []
|
|
294
|
+
opt_module_names.each do |opt_name|
|
|
295
|
+
if @_remove_pod_opt_fw
|
|
296
|
+
removable_frameworks = removable_frameworks | (@_remove_pod_opt_fw[opt_name] || [])
|
|
297
|
+
else
|
|
298
|
+
# 兼容老 content.json,没有 optional_frameworks,用 baseline_hash 的 keys
|
|
299
|
+
removable_frameworks = removable_frameworks | (baseline_hash[opt_name] ? baseline_hash[opt_name].keys : [])
|
|
300
|
+
end
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
if removable_frameworks.include?(pod_name)
|
|
304
|
+
LogTools.p_yellow "remove_pod #{pod_name} in #{name}"
|
|
305
|
+
else
|
|
306
|
+
pod pod_name, pod_version
|
|
307
|
+
LogTools.p_yellow "[Warning] remove_pod '#{pod_name}' 未生效:'#{pod_name}' 不在 '#{name}' 的可选依赖 frameworks 中"
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
else
|
|
312
|
+
# 如果没设版本号,就认为是去除处理
|
|
313
|
+
LogTools.v_red "fix_pod(remove) #{pod_name}"
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
next
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
if self.is_use_mPaaS_online
|
|
320
|
+
pod_version_online = BaselineTools.getPodVersionOnlineByName(pod_name, current_verison)
|
|
321
|
+
if pod_version != pod_version_online
|
|
322
|
+
LogTools.p_green "#{pod_name} changed to #{pod_version_online} from #{pod_version}"
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
pod pod_name, pod_version_online
|
|
326
|
+
else
|
|
327
|
+
if pod_version.nil? || pod_version.empty?
|
|
328
|
+
info = Pod::MPAAS::Localization.t('mpaas.dsl.sorry_version_not_found', pod_name: pod_name)
|
|
329
|
+
raise Pod::Informative, info
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
pod pod_name, pod_version
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
end
|
|
336
|
+
else
|
|
337
|
+
info = "No #{name} : #{current_verison} found !!! Check name & version in Podfile"
|
|
338
|
+
raise Pod::Informative, info
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
def mPaaS_used(use)
|
|
343
|
+
begin
|
|
344
|
+
unless current_target_definition.abstract?
|
|
345
|
+
if use
|
|
346
|
+
MPaaSCocoapodShare.instance.usedMpaasTarget.add(current_target_definition.name.to_s)
|
|
347
|
+
else
|
|
348
|
+
MPaaSCocoapodShare.instance.usedMpaasTarget.delete(current_target_definition.name.to_s)
|
|
349
|
+
MPaaSCocoapodShare.instance.unuseMpaasTarget.add(current_target_definition.name.to_s)
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
rescue => e
|
|
353
|
+
LogTools.p_red "cocoapods get current target name error:#{e.message}"
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
alias_method :origin_pod, :pod
|
|
359
|
+
|
|
360
|
+
# 方法的嵌套 ? 最大程度的减少对原有逻辑的侵入性
|
|
361
|
+
def use_pod_for_mPaaS!
|
|
362
|
+
# self.is_pod_support_mPaaS = true
|
|
363
|
+
|
|
364
|
+
def pod(name = nil, *requirements)
|
|
365
|
+
current_verison = ""
|
|
366
|
+
|
|
367
|
+
if requirements && !requirements.empty?
|
|
368
|
+
current_verison = requirements[0]
|
|
369
|
+
|
|
370
|
+
# baseline_hash = BaselineTools.getBaselineByVersion(requirements[0])
|
|
371
|
+
# dependencies_hash = baseline_hash[name]
|
|
372
|
+
# if dependencies_hash
|
|
373
|
+
# LogTools.v_green "pod (origin) : #{name} <> #{dependencies_hash}"
|
|
374
|
+
# dependencies_hash.each do |pod_name, pod_version|
|
|
375
|
+
# origin_pod(pod_name, pod_version)
|
|
376
|
+
# end
|
|
377
|
+
# else
|
|
378
|
+
# #todo 测试走这里
|
|
379
|
+
# origin_pod(name, *requirements)
|
|
380
|
+
# end
|
|
381
|
+
else
|
|
382
|
+
if self.default_baseline
|
|
383
|
+
current_verison = self.default_baseline
|
|
384
|
+
else
|
|
385
|
+
# 这个地不能抛异常,原生pod其他第三方有可能会走到这
|
|
386
|
+
# info = "当前 #{name} : #{current_verison} 找不到版本 ! 请在 mPaaS_pod 后指定版本,或者使用全局默认标识 mPaaS_baseline"
|
|
387
|
+
# raise Pod::Informative, info
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
# 如果未显式声明版本号,这里取下 default_baseline
|
|
391
|
+
# baseline_hash = BaselineTools.getBaselineByVersion(self.default_baseline)
|
|
392
|
+
# dependencies_hash = baseline_hash[name]
|
|
393
|
+
# if dependencies_hash
|
|
394
|
+
# LogTools.v_green "pod (origin) : #{name} <> #{dependencies_hash}"
|
|
395
|
+
# dependencies_hash.each do |pod_name, pod_version|
|
|
396
|
+
# origin_pod(pod_name, pod_version)
|
|
397
|
+
# end
|
|
398
|
+
# else
|
|
399
|
+
# #todo 测试走这里
|
|
400
|
+
# origin_pod(name, *requirements)
|
|
401
|
+
# end
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
baseline_hash = BaselineTools.getBaselineByVersion(current_verison, true)
|
|
405
|
+
dependencies_hash = baseline_hash[name]
|
|
406
|
+
if dependencies_hash
|
|
407
|
+
LogTools.v_green "pod (origin) : #{name} <> #{dependencies_hash}\n"
|
|
408
|
+
dependencies_hash.each do |pod_name, pod_version|
|
|
409
|
+
|
|
410
|
+
if pod_name == "MPNebulaSDKPlugins"
|
|
411
|
+
if self.is_use_tinyApp || tinyAppExist?
|
|
412
|
+
LogTools.v_red "No need to pod MPNebulaSDKPlugins ..."
|
|
413
|
+
next
|
|
414
|
+
end
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
origin_pod(pod_name, pod_version)
|
|
418
|
+
end
|
|
419
|
+
else
|
|
420
|
+
#todo 测试走这里
|
|
421
|
+
origin_pod(name, *requirements)
|
|
422
|
+
# LogTools.p_red name
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
end
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
# Gem::Dependency.new("", ">= 1.0").match?("", Pod::VERSION)
|
|
429
|
+
|
|
430
|
+
# 以下为原有判断逻辑,始终会进 pod
|
|
431
|
+
# def use_pod_for_mPaaS!
|
|
432
|
+
# self.is_pod_support_mPaaS = true
|
|
433
|
+
# end
|
|
434
|
+
|
|
435
|
+
# # Gem::Dependency.new("", ">= 1.0").match?("", Pod::VERSION)
|
|
436
|
+
# alias_method :origin_pod, :pod
|
|
437
|
+
|
|
438
|
+
# def pod(name = nil, *requirements)
|
|
439
|
+
# # LogTools.p_green "#{is_pod_support_mPaaS}"
|
|
440
|
+
|
|
441
|
+
# # 如果没有定义 use_pod_for_mPaaS,直接走原逻辑
|
|
442
|
+
# unless is_pod_support_mPaaS
|
|
443
|
+
# origin_pod(name, *requirements)
|
|
444
|
+
# return
|
|
445
|
+
# end
|
|
446
|
+
|
|
447
|
+
# if requirements && !requirements.empty?
|
|
448
|
+
# baseline_hash = BaselineTools.getBaselineByVersion(requirements[0])
|
|
449
|
+
# dependencies_hash = baseline_hash[name]
|
|
450
|
+
# if dependencies_hash
|
|
451
|
+
# LogTools.v_green "#{name} <> #{dependencies_hash}"
|
|
452
|
+
# dependencies_hash.each do |pod_name, pod_version|
|
|
453
|
+
# origin_pod(pod_name, pod_version)
|
|
454
|
+
# end
|
|
455
|
+
# else
|
|
456
|
+
# #todo 测试走这里
|
|
457
|
+
# origin_pod(name, *requirements)
|
|
458
|
+
# end
|
|
459
|
+
# else
|
|
460
|
+
# #todo 测试走这里
|
|
461
|
+
# origin_pod(name, *requirements)
|
|
462
|
+
# end
|
|
463
|
+
# end
|
|
464
|
+
|
|
465
|
+
# def mPaaS_pod(name, version)
|
|
466
|
+
# baseline_file_path = File.join(CocoapodsmPaaS::MPAAS_LOCAL_PATH, "baseline", version, "content.json")
|
|
467
|
+
# if File::exist?(baseline_file_path)
|
|
468
|
+
# baseline_hash = JSON.parse(File.read(baseline_file_path))
|
|
469
|
+
# dependencies_hash = baseline_hash[name]
|
|
470
|
+
# if dependencies_hash
|
|
471
|
+
# dependencies_hash.each do |pod_name, pod_version|
|
|
472
|
+
# pod pod_name, pod_version
|
|
473
|
+
# end
|
|
474
|
+
# else
|
|
475
|
+
# LogTools.p_red "No #{name} & #{version} found !!! Check name & version in Podfile"
|
|
476
|
+
# end
|
|
477
|
+
# else
|
|
478
|
+
# #todo 抛异常
|
|
479
|
+
# LogTools.p_red "No baseline file found !!! Check #{version} in mPaaS Setup dir"
|
|
480
|
+
# end
|
|
481
|
+
# end
|
|
482
|
+
|
|
483
|
+
# 一些特殊定制的,修复冲突用的先写这里吧
|
|
484
|
+
def fix_AMap3DMap_10_1_32!
|
|
485
|
+
fix_pod "APMobileLBS", "1.0.1.190225153620.1"
|
|
486
|
+
fix_pod "AMapFoundationKit", ""
|
|
487
|
+
fix_pod "MAMapKit", ""
|
|
488
|
+
end
|
|
489
|
+
|
|
490
|
+
def fix_AMap3DMap_10_1_60!
|
|
491
|
+
fix_pod "APMobileLBS", "1.0.1.190807105749.1"
|
|
492
|
+
fix_pod "AMapFoundationKit", ""
|
|
493
|
+
fix_pod "MAMapKit", ""
|
|
494
|
+
end
|
|
495
|
+
|
|
496
|
+
end
|
|
497
|
+
end
|
|
498
|
+
end
|