pindo 4.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/pindo +35 -0
- data/lib/pindo/base/aeshelper.rb +31 -0
- data/lib/pindo/base/deviceinfo.rb +90 -0
- data/lib/pindo/base/executable.rb +224 -0
- data/lib/pindo/base/githelper.rb +489 -0
- data/lib/pindo/base/hashhelper.rb +134 -0
- data/lib/pindo/base/plaininformative.rb +15 -0
- data/lib/pindo/base/plistbuddyexecutable.rb +121 -0
- data/lib/pindo/base/standarderror.rb +14 -0
- data/lib/pindo/client/applovinclient.rb +156 -0
- data/lib/pindo/client/aws3sclient.rb +183 -0
- data/lib/pindo/client/bossclient.rb +229 -0
- data/lib/pindo/client/bossconfigclient.rb +175 -0
- data/lib/pindo/client/giteeclient.rb +65 -0
- data/lib/pindo/client/httpclient.rb +40 -0
- data/lib/pindo/client/pgyerclient.rb +439 -0
- data/lib/pindo/client/tgateclient.rb +103 -0
- data/lib/pindo/command.rb +101 -0
- data/lib/pindo/config/pindoconfig.rb +439 -0
- data/lib/pindo/config/pindouserlocalconfig.rb +81 -0
- data/lib/pindo/deploy/Fastfile +233 -0
- data/lib/pindo/deploy/build.rb +167 -0
- data/lib/pindo/deploy/bundleid.rb +245 -0
- data/lib/pindo/deploy/cert.rb +508 -0
- data/lib/pindo/deploy/check.rb +79 -0
- data/lib/pindo/deploy/configproj.rb +89 -0
- data/lib/pindo/deploy/confusecode.rb +248 -0
- data/lib/pindo/deploy/confuseproj.rb +112 -0
- data/lib/pindo/deploy/fabric.rb +58 -0
- data/lib/pindo/deploy/getitcinfo.rb +248 -0
- data/lib/pindo/deploy/iap.rb +796 -0
- data/lib/pindo/deploy/initconfig.rb +128 -0
- data/lib/pindo/deploy/itcapp.rb +147 -0
- data/lib/pindo/deploy/itcinfo.rb +369 -0
- data/lib/pindo/deploy/pem.rb +55 -0
- data/lib/pindo/deploy/pullconfig.rb +46 -0
- data/lib/pindo/deploy/pushconfig.rb +83 -0
- data/lib/pindo/deploy/quswark.rb +146 -0
- data/lib/pindo/deploy/quswauth.rb +67 -0
- data/lib/pindo/deploy/reportbug.rb +135 -0
- data/lib/pindo/deploy/resign.rb +338 -0
- data/lib/pindo/deploy/tag.rb +108 -0
- data/lib/pindo/deploy/updateconfig.rb +129 -0
- data/lib/pindo/deploy/uploadipa.rb +63 -0
- data/lib/pindo/deploy.rb +44 -0
- data/lib/pindo/dev/autobuild.rb +204 -0
- data/lib/pindo/dev/autoresign.rb +186 -0
- data/lib/pindo/dev/confusecode.rb +127 -0
- data/lib/pindo/dev/confuseproj.rb +111 -0
- data/lib/pindo/dev/createbuild.rb +159 -0
- data/lib/pindo/dev/debug.rb +141 -0
- data/lib/pindo/dev/pub.rb +171 -0
- data/lib/pindo/dev/renewcert.rb +142 -0
- data/lib/pindo/dev.rb +23 -0
- data/lib/pindo/env/dreamstudio.rb +53 -0
- data/lib/pindo/env/flutter.rb +59 -0
- data/lib/pindo/env/flutter.sh +116 -0
- data/lib/pindo/env/quarkenv.rb +58 -0
- data/lib/pindo/env/swarkenv.rb +62 -0
- data/lib/pindo/env/workhard.rb +56 -0
- data/lib/pindo/env.rb +17 -0
- data/lib/pindo/ipa/autoresign.rb +188 -0
- data/lib/pindo/ipa/import.rb +261 -0
- data/lib/pindo/ipa/output.rb +396 -0
- data/lib/pindo/ipa.rb +22 -0
- data/lib/pindo/lib/forcepush.rb +159 -0
- data/lib/pindo/lib/lint.rb +115 -0
- data/lib/pindo/lib/push.rb +143 -0
- data/lib/pindo/lib/update.rb +75 -0
- data/lib/pindo/lib.rb +18 -0
- data/lib/pindo/module/appselect.rb +200 -0
- data/lib/pindo/module/appstore_in_app_purchase.rb +1803 -0
- data/lib/pindo/module/appstore_metadata_connect_api_helper.rb +12 -0
- data/lib/pindo/module/appstore_metadata_fastlane_helper.rb +922 -0
- data/lib/pindo/module/buildconfighelper.rb +13 -0
- data/lib/pindo/module/buildhelper.rb +76 -0
- data/lib/pindo/module/commonconfuseproj.rb +271 -0
- data/lib/pindo/module/config_project.sh +143 -0
- data/lib/pindo/module/configprojhelper.rb +631 -0
- data/lib/pindo/module/iap_tier.json +813 -0
- data/lib/pindo/module/icon_contents.json +116 -0
- data/lib/pindo/module/imessage_icon.json +91 -0
- data/lib/pindo/module/imgset_contents.json +21 -0
- data/lib/pindo/module/launchimg_contents.json +21 -0
- data/lib/pindo/module/pemcreate.rb +63 -0
- data/lib/pindo/module/pgyerhelper.rb +339 -0
- data/lib/pindo/module/xcodebuildpre.rb +258 -0
- data/lib/pindo/module/xcodehelper.rb +521 -0
- data/lib/pindo/options/appconfigoptions.rb +23 -0
- data/lib/pindo/options/deployoptions.rb +363 -0
- data/lib/pindo/pgyer/apptest.rb +104 -0
- data/lib/pindo/pgyer/comment.rb +95 -0
- data/lib/pindo/pgyer/download.rb +105 -0
- data/lib/pindo/pgyer/login.rb +61 -0
- data/lib/pindo/pgyer/upload.rb +234 -0
- data/lib/pindo/pgyer.rb +17 -0
- data/lib/pindo/repo/clone.rb +78 -0
- data/lib/pindo/repo/create.rb +55 -0
- data/lib/pindo/repo/login.rb +64 -0
- data/lib/pindo/repo/search.rb +60 -0
- data/lib/pindo/repo.rb +16 -0
- data/lib/pindo/setup.rb +60 -0
- data/lib/pindo/upgrade.rb +56 -0
- data/lib/pindo/utils/applovin.rb +213 -0
- data/lib/pindo/utils/boss.rb +209 -0
- data/lib/pindo/utils/clearcert.rb +60 -0
- data/lib/pindo/utils/device.rb +279 -0
- data/lib/pindo/utils/icon.rb +91 -0
- data/lib/pindo/utils/icon.sh +133 -0
- data/lib/pindo/utils/podindex.rb +56 -0
- data/lib/pindo/utils/podindex.sh +30 -0
- data/lib/pindo/utils/renewproj.rb +146 -0
- data/lib/pindo/utils/tgate.rb +159 -0
- data/lib/pindo/utils/xcassets.rb +46 -0
- data/lib/pindo/utils/xcassets.sh +88 -0
- data/lib/pindo/utils.rb +29 -0
- data/lib/pindo/version.rb +110 -0
- data/lib/pindo.rb +34 -0
- metadata +364 -0
@@ -0,0 +1,521 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'xcodeproj'
|
3
|
+
|
4
|
+
module Pindo
|
5
|
+
|
6
|
+
module XcodeHelper
|
7
|
+
|
8
|
+
def get_target_by_name(proj_obj:nil, name:nil)
|
9
|
+
new_target = nil
|
10
|
+
proj_obj.targets.each do |target|
|
11
|
+
if target.name.to_s.eql?(name)
|
12
|
+
new_target = target
|
13
|
+
end
|
14
|
+
end
|
15
|
+
return new_target
|
16
|
+
end
|
17
|
+
|
18
|
+
def is_resource_group(file)
|
19
|
+
extname= file[/\.[^\.]+$/]
|
20
|
+
if extname == '.bundle' || extname == '.xcassets' then
|
21
|
+
return true
|
22
|
+
end
|
23
|
+
return false
|
24
|
+
end
|
25
|
+
|
26
|
+
def add_files_proj_with_dir(new_proj_obj:nil, new_target:nil, new_group:nil)
|
27
|
+
|
28
|
+
if File.exist?(new_group.real_path)
|
29
|
+
|
30
|
+
Dir.foreach(new_group.real_path) do |entry|
|
31
|
+
filePath = File.join(new_group.real_path, entry)
|
32
|
+
|
33
|
+
# puts filePath
|
34
|
+
if entry.to_s.start_with?(".") then
|
35
|
+
|
36
|
+
elsif filePath.to_s.end_with?(".DS_Store", ".xcconfig") then
|
37
|
+
# ignore
|
38
|
+
|
39
|
+
elsif filePath.to_s.end_with?(".lproj") then
|
40
|
+
if @variant_group.nil?
|
41
|
+
@variant_group = new_group.new_variant_group("Localizable.strings");
|
42
|
+
end
|
43
|
+
string_file = File.join(filePath, "Localizable.strings")
|
44
|
+
fileReference = @variant_group.new_reference(string_file)
|
45
|
+
new_target.add_resources([fileReference])
|
46
|
+
|
47
|
+
elsif is_resource_group(entry) then
|
48
|
+
fileReference = new_group.new_reference(filePath)
|
49
|
+
new_target.add_resources([fileReference])
|
50
|
+
elsif !File.directory?(filePath) then
|
51
|
+
|
52
|
+
# 向group中增加文件引用
|
53
|
+
fileReference = new_group.new_reference(filePath)
|
54
|
+
# 如果不是头文件则继续增加到Build Phase中
|
55
|
+
if filePath.to_s.end_with?(".m", ".mm", ".cpp", ".swift") then
|
56
|
+
new_target.add_file_references([fileReference])
|
57
|
+
# elsif filePath.to_s.end_with?("pbobjc.m", "pbobjc.mm") then
|
58
|
+
# new_target.add_file_references([fileReference], '-fno-objc-arc')
|
59
|
+
|
60
|
+
elsif filePath.to_s.end_with?(".pch") then
|
61
|
+
|
62
|
+
elsif filePath.to_s.end_with?(".entitlements") then
|
63
|
+
|
64
|
+
elsif filePath.to_s.end_with?("Info.plist") && entry == "Info.plist" then
|
65
|
+
|
66
|
+
elsif filePath.to_s.end_with?(".h") then
|
67
|
+
# new_target.headers_build_phase.add_file_reference(fileReference)
|
68
|
+
elsif filePath.to_s.end_with?(".framework") || filePath.to_s.end_with?(".a") then
|
69
|
+
new_target.frameworks_build_phases.add_file_reference(fileReference)
|
70
|
+
elsif
|
71
|
+
new_target.add_resources([fileReference])
|
72
|
+
end
|
73
|
+
# 目录情况下, 递归添加
|
74
|
+
elsif File.directory?(filePath) && entry != '.' && entry != '..' then
|
75
|
+
sub_group = new_group.find_subpath(entry, true)
|
76
|
+
sub_group.set_source_tree(new_group.source_tree)
|
77
|
+
sub_group.set_path(File.join(new_group.real_path, entry))
|
78
|
+
add_files_proj_with_dir(new_proj_obj:new_proj_obj, new_target:new_target, new_group:sub_group)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
def config_target(new_proj_obj:nil, new_target:nil, config:nil, bundle_id:nil, is_extention:false, setting_array:nil)
|
87
|
+
|
88
|
+
new_proj_obj.root_object.attributes['TargetAttributes'] = new_proj_obj.root_object.attributes['TargetAttributes'] || {}
|
89
|
+
target_atts_obj = new_proj_obj.root_object.attributes['TargetAttributes']
|
90
|
+
target_atts_obj[new_target.uuid] = target_atts_obj[new_target.uuid] || {}
|
91
|
+
target_atts_obj[new_target.uuid]['DevelopmentTeam'] = "9WX2E4VC26"
|
92
|
+
target_atts_obj[new_target.uuid]['ProvisioningStyle'] = "Manual"
|
93
|
+
target_atts_obj[new_target.uuid]['SystemCapabilities'] = {}
|
94
|
+
|
95
|
+
target_systemcapabilities = target_atts_obj[new_target.uuid]['SystemCapabilities']
|
96
|
+
if setting_array.to_s.include?("in_app_purchase")
|
97
|
+
target_systemcapabilities['com.apple.InAppPurchase'] = {}
|
98
|
+
target_systemcapabilities['com.apple.InAppPurchase']['enabled'] = 1
|
99
|
+
else
|
100
|
+
target_systemcapabilities['com.apple.InAppPurchase'] = {}
|
101
|
+
target_systemcapabilities['com.apple.InAppPurchase']['enabled'] = 0
|
102
|
+
end
|
103
|
+
|
104
|
+
if setting_array.to_s.include?("push_notification")
|
105
|
+
target_systemcapabilities['com.apple.Push'] = {}
|
106
|
+
target_systemcapabilities['com.apple.Push']['enabled'] = 1
|
107
|
+
else
|
108
|
+
target_systemcapabilities['com.apple.Push'] = {}
|
109
|
+
target_systemcapabilities['com.apple.Push']['enabled'] = 0
|
110
|
+
end
|
111
|
+
|
112
|
+
if setting_array.to_s.include?("app_group")
|
113
|
+
target_systemcapabilities['com.apple.Group'] = {}
|
114
|
+
target_systemcapabilities['com.apple.Group']['enabled'] = 1
|
115
|
+
else
|
116
|
+
target_systemcapabilities['com.apple.Group'] = {}
|
117
|
+
target_systemcapabilities['com.apple.Group']['enabled'] = 0
|
118
|
+
end
|
119
|
+
|
120
|
+
config.build_settings['ENABLE_BITCODE'] = "NO";
|
121
|
+
config.build_settings['SDKROOT'] = "iphoneos"
|
122
|
+
config.build_settings['CODE_SIGN_IDENTITY[sdk=iphoneos*]'] = "iPhone Distribution"
|
123
|
+
config.build_settings['CODE_SIGN_STYLE'] = "Manual"
|
124
|
+
config.build_settings['CODE_SIGN_IDENTITY'] = "iPhone Developer"
|
125
|
+
config.build_settings['DEVELOPMENT_TEAM'] = "9WX2E4VC26"
|
126
|
+
config.build_settings['PROVISIONING_PROFILE'] = ""
|
127
|
+
config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = bundle_id
|
128
|
+
config.build_settings['PROVISIONING_PROFILE_SPECIFIER'] = "match Development " + bundle_id
|
129
|
+
# config.build_settings['TARGETED_DEVICE_FAMILY'] = "1,2"
|
130
|
+
if is_extention
|
131
|
+
config.build_settings['INFOPLIST_FILE'] = new_target.name + "/Info.plist"
|
132
|
+
config.build_settings['SKIP_INSTALL'] = "YES"
|
133
|
+
|
134
|
+
if new_target.name.include?("iMessage")
|
135
|
+
|
136
|
+
config.build_settings['LD_RUNPATH_SEARCH_PATHS'] = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"
|
137
|
+
config.build_settings['PRODUCT_NAME'] = "$(TARGET_NAME)"
|
138
|
+
|
139
|
+
elsif new_target.name.include?("Extension") || new_target.name.include?("ExtensionAd") || new_target.name.include?("ExtensionPorn") then
|
140
|
+
config.build_settings['LD_RUNPATH_SEARCH_PATHS'] = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"
|
141
|
+
config.build_settings['PRODUCT_NAME'] = "$(TARGET_NAME)"
|
142
|
+
config.build_settings['ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME'] = "AccentColor"
|
143
|
+
config.build_settings['ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME'] = "WidgetBackground"
|
144
|
+
else
|
145
|
+
config.build_settings['CLANG_WARN_SUSPICIOUS_MOVES'] = "YES"
|
146
|
+
config.build_settings['CLANG_WARN_INFINITE_RECURSION'] = "YES"
|
147
|
+
config.build_settings['CLANG_WARN_DOCUMENTATION_COMMENTS'] = "YES"
|
148
|
+
end
|
149
|
+
|
150
|
+
else
|
151
|
+
|
152
|
+
config.build_settings['ASSETCATALOG_COMPILER_APPICON_NAME'] = "AppIcon"
|
153
|
+
config.build_settings['INFOPLIST_FILE'] = "AppEntry/Info.plist"
|
154
|
+
config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = "$(inherited)"
|
155
|
+
config.build_settings['LD_GENERATE_MAP_FILE'] = "$(inherited)"
|
156
|
+
config.build_settings['GCC_PRECOMPILE_PREFIX_HEADER'] = "NO"
|
157
|
+
config.build_settings['LIBRARY_SEARCH_PATHS'] = "$(inherited)"
|
158
|
+
config.build_settings['OTHER_CFLAGS'] = "$(inherited)"
|
159
|
+
config.build_settings['PRODUCT_NAME'] = "$(TARGET_NAME)";
|
160
|
+
config.build_settings['PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR'] = "NO";
|
161
|
+
|
162
|
+
macros = config.build_settings['GCC_PREPROCESSOR_DEFINITIONS']
|
163
|
+
if macros.nil? || macros == ""
|
164
|
+
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = "$(inherited)"
|
165
|
+
end
|
166
|
+
|
167
|
+
end
|
168
|
+
|
169
|
+
end
|
170
|
+
|
171
|
+
def copy_to_newproject(new_proj_path:nil, new_proj_name:nil, old_proj_path:nil, old_proj_name:nil)
|
172
|
+
FileUtils.cp_r(File.join(old_proj_path, "AppEntry"), new_proj_path)
|
173
|
+
if File.exist?(File.join(old_proj_path, "U3DLib"))
|
174
|
+
FileUtils.cp_r(File.join(old_proj_path, "U3DLib"), new_proj_path)
|
175
|
+
end
|
176
|
+
|
177
|
+
if File.exist?(File.join(old_proj_path, "flutter_box"))
|
178
|
+
FileUtils.cp_r(File.join(old_proj_path, "flutter_box"), new_proj_path)
|
179
|
+
end
|
180
|
+
|
181
|
+
if File.exist?(File.join(old_proj_path, "AppLogic"))
|
182
|
+
FileUtils.cp_r(File.join(old_proj_path, "AppLogic"), new_proj_path)
|
183
|
+
end
|
184
|
+
|
185
|
+
if File.exist?(File.join(old_proj_path, "AppUI"))
|
186
|
+
FileUtils.cp_r(File.join(old_proj_path, "AppUI"), new_proj_path)
|
187
|
+
end
|
188
|
+
|
189
|
+
if File.exist?(File.join(old_proj_path, "PResources"))
|
190
|
+
FileUtils.cp_r(File.join(old_proj_path, "PResources"), new_proj_path)
|
191
|
+
end
|
192
|
+
|
193
|
+
if File.exist?(File.join(old_proj_path, "Resources"))
|
194
|
+
FileUtils.cp_r(File.join(old_proj_path, "Resources"), new_proj_path)
|
195
|
+
end
|
196
|
+
|
197
|
+
if File.exist?(File.join(old_proj_path, old_proj_name + "NotificationContent"))
|
198
|
+
FileUtils.cp_r(File.join(old_proj_path, old_proj_name + "NotificationContent"), new_proj_path)
|
199
|
+
if new_proj_name != old_proj_name
|
200
|
+
FileUtils.mv(File.join(new_proj_path, old_proj_name + "NotificationContent"), File.join(new_proj_path, new_proj_name + "NotificationContent"))
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
if File.exist?(File.join(old_proj_path, old_proj_name + "NotificationService"))
|
205
|
+
FileUtils.cp_r(File.join(old_proj_path, old_proj_name + "NotificationService"), new_proj_path)
|
206
|
+
if new_proj_name != old_proj_name
|
207
|
+
FileUtils.mv(File.join(new_proj_path, old_proj_name + "NotificationService"), File.join(new_proj_path, new_proj_name + "NotificationService"))
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
if File.exist?(File.join(old_proj_path, old_proj_name + "Keyboard"))
|
212
|
+
FileUtils.cp_r(File.join(old_proj_path, old_proj_name + "Keyboard"), new_proj_path)
|
213
|
+
if new_proj_name != old_proj_name
|
214
|
+
FileUtils.mv(File.join(new_proj_path, old_proj_name + "Keyboard"), File.join(new_proj_path, new_proj_name + "Keyboard"))
|
215
|
+
old_entitlements_plist = File.join(new_proj_path, new_proj_name + "Keyboard", old_proj_name + "Keyboard.entitlements")
|
216
|
+
new_entitlements_plist = File.join(new_proj_path, new_proj_name + "Keyboard", new_proj_name + "Keyboard.entitlements")
|
217
|
+
if File.exist?(old_entitlements_plist) && old_entitlements_plist != new_entitlements_plist
|
218
|
+
FileUtils.mv(old_entitlements_plist, new_entitlements_plist)
|
219
|
+
# entitlements_plist_dict = Xcodeproj::Plist.read_from_path(new_entitlements_plist)
|
220
|
+
# entitlements_plist_dict['com.apple.security.application-groups'] = [@group_id]
|
221
|
+
# Xcodeproj::Plist.write_to_path(entitlements_plist_dict, new_entitlements_plist)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
if File.exist?(File.join(old_proj_path, old_proj_name + "iMessage"))
|
227
|
+
FileUtils.cp_r(File.join(old_proj_path, old_proj_name + "iMessage"), new_proj_path)
|
228
|
+
if new_proj_name != old_proj_name
|
229
|
+
FileUtils.mv(File.join(new_proj_path, old_proj_name + "iMessage"), File.join(new_proj_path, new_proj_name + "iMessage"))
|
230
|
+
end
|
231
|
+
old_entitlements_plist = File.join(new_proj_path, new_proj_name + "iMessage", old_proj_name + "iMessage.entitlements")
|
232
|
+
new_entitlements_plist = File.join(new_proj_path, new_proj_name + "iMessage", new_proj_name + "iMessage.entitlements")
|
233
|
+
if File.exist?(old_entitlements_plist) && old_entitlements_plist != new_entitlements_plist
|
234
|
+
FileUtils.mv(old_entitlements_plist, new_entitlements_plist)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
|
239
|
+
if File.exist?(File.join(old_proj_path, old_proj_name + "Extension"))
|
240
|
+
FileUtils.cp_r(File.join(old_proj_path, old_proj_name + "Extension"), new_proj_path)
|
241
|
+
if new_proj_name != old_proj_name
|
242
|
+
FileUtils.mv(File.join(new_proj_path, old_proj_name + "Extension"), File.join(new_proj_path, new_proj_name + "Extension"))
|
243
|
+
end
|
244
|
+
old_entitlements_plist = File.join(new_proj_path, new_proj_name + "Extension", old_proj_name + "Extension.entitlements")
|
245
|
+
new_entitlements_plist = File.join(new_proj_path, new_proj_name + "Extension", new_proj_name + "Extension.entitlements")
|
246
|
+
if File.exist?(old_entitlements_plist) && old_entitlements_plist != new_entitlements_plist
|
247
|
+
FileUtils.mv(old_entitlements_plist, new_entitlements_plist)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
|
252
|
+
if File.exist?(File.join(old_proj_path, "fastlane"))
|
253
|
+
FileUtils.cp_r(File.join(old_proj_path, "fastlane"), new_proj_path)
|
254
|
+
end
|
255
|
+
|
256
|
+
if File.exist?(File.join(old_proj_path, "Script"))
|
257
|
+
FileUtils.cp_r(File.join(old_proj_path, "Script"), new_proj_path)
|
258
|
+
end
|
259
|
+
|
260
|
+
if File.exist?(File.join(old_proj_path, "config.json"))
|
261
|
+
FileUtils.cp_r(File.join(old_proj_path, "config.json"), new_proj_path)
|
262
|
+
end
|
263
|
+
|
264
|
+
if File.exist?(File.join(old_proj_path, "VBDL.json"))
|
265
|
+
FileUtils.cp_r(File.join(old_proj_path, "VBDL.json"), new_proj_path)
|
266
|
+
end
|
267
|
+
|
268
|
+
old_entitlements_plist = File.join(old_proj_path, old_proj_name + ".entitlements")
|
269
|
+
new_entitlements_plist = File.join(new_proj_path, new_proj_name + ".entitlements")
|
270
|
+
if File.exist?(old_entitlements_plist)
|
271
|
+
FileUtils.cp_r(old_entitlements_plist, new_entitlements_plist)
|
272
|
+
end
|
273
|
+
|
274
|
+
|
275
|
+
FileUtils.cp_r(File.join(old_proj_path, "Podfile"), new_proj_path)
|
276
|
+
text = File.read(File.join(new_proj_path, "Podfile"))
|
277
|
+
new_contents = text.gsub(/target.*#{old_proj_name}/, "target \'#{new_proj_name}")
|
278
|
+
File.open(File.join(new_proj_path, "Podfile"), "w") {|file| file.puts new_contents }
|
279
|
+
|
280
|
+
if File.exist?(File.join(old_proj_path, "config.json"))
|
281
|
+
FileUtils.cp_r(File.join(old_proj_path, "config.json"), new_proj_path)
|
282
|
+
end
|
283
|
+
|
284
|
+
|
285
|
+
end
|
286
|
+
|
287
|
+
|
288
|
+
def config_project_target(new_proj_name:nil, new_proj_path:nil, new_proj_obj:nil, old_proj_name:nil, old_proj_path:nil, old_proj_obj:nil)
|
289
|
+
new_proj_obj.root_object.known_regions = new_proj_obj.root_object.known_regions || []
|
290
|
+
new_proj_obj.root_object.known_regions = new_proj_obj.root_object.known_regions | ['Base', 'EN', 'en', 'CN', 'de', 'es', 'fr', 'it', 'ja', 'ko', 'nl', 'pt', 'ru', 'th', 'zh-Hans', 'zh-Hant', 'ar', 'ca', 'cs', 'da', 'el', 'fi', 'he','hu','id','ms','nb', 'pl', 'pt-BR', 'ro', 'sk','sv','tr','uk','vi']
|
291
|
+
|
292
|
+
new_proj_obj.root_object.build_configuration_list.set_setting('VALID_ARCHS', "arm64")
|
293
|
+
new_proj_obj.root_object.build_configuration_list.set_setting('SDKROOT', "iphoneos")
|
294
|
+
new_proj_obj.root_object.build_configuration_list.set_setting('CODE_SIGN_IDENTITY[sdk=iphoneos*]', "iPhone Developer")
|
295
|
+
new_proj_obj.root_object.build_configuration_list.set_setting('CODE_SIGN_IDENTITY*', "iPhone Developer")
|
296
|
+
|
297
|
+
new_proj_obj.targets.each do |target|
|
298
|
+
|
299
|
+
target.build_configurations.each do |config|
|
300
|
+
if target.name.to_s.end_with?("Content") then
|
301
|
+
config_target(new_proj_obj:new_proj_obj, new_target:target, config:config, bundle_id:@bundle_id_pushcontent, is_extention:true,setting_array:['push_notification'])
|
302
|
+
elsif target.name.to_s.end_with?("Service") then
|
303
|
+
config_target(new_proj_obj:new_proj_obj, new_target:target, config:config, bundle_id:@bundle_id_pushservice, is_extention:true,setting_array:['push_notification'])
|
304
|
+
elsif target.name.to_s.end_with?("Keyboard") then
|
305
|
+
config_target(new_proj_obj:new_proj_obj, new_target:target, config:config, bundle_id:@bundle_id_keyboard, is_extention:true,setting_array:['app_group'])
|
306
|
+
elsif target.name.to_s.end_with?("iMessage") then
|
307
|
+
|
308
|
+
config_target(new_proj_obj:new_proj_obj, new_target:target, config:config, bundle_id:@bundle_id_imessage, is_extention:true,setting_array:['app_group'])
|
309
|
+
if File.exist?(File.join(new_proj_path, target.display_name, "Assets.xcassets"))
|
310
|
+
config.build_settings['ASSETCATALOG_COMPILER_APPICON_NAME'] = "iMessage App Icon"
|
311
|
+
end
|
312
|
+
elsif target.name.to_s.end_with?("Extension") then
|
313
|
+
config_target(new_proj_obj:new_proj_obj, new_target:target, config:config, bundle_id:@bundle_id_extension, is_extention:true,setting_array:['app_group'])
|
314
|
+
elsif target.name.to_s.end_with?("ExtensionAd") then
|
315
|
+
config_target(new_proj_obj:new_proj_obj, new_target:target, config:config, bundle_id:@bundle_id_extensionad, is_extention:true,setting_array:['app_group'])
|
316
|
+
elsif target.name.to_s.end_with?("ExtensionPorn") then
|
317
|
+
config_target(new_proj_obj:new_proj_obj, new_target:target, config:config, bundle_id:@bundle_id_extensionporn, is_extention:true,setting_array:['app_group'])
|
318
|
+
else
|
319
|
+
config_target(new_proj_obj:new_proj_obj, new_target:target, config:config, bundle_id:@bundle_id, is_extention:false,setting_array:['app_group','push_notification', 'in_app_purchase'])
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
end
|
324
|
+
|
325
|
+
end
|
326
|
+
|
327
|
+
def setting_new_project(new_proj_name:nil, new_proj_path:nil, new_proj_obj:nil, old_proj_name:nil, old_proj_path:nil, old_proj_obj:nil)
|
328
|
+
|
329
|
+
old_proj_target = old_proj_obj.targets.first
|
330
|
+
new_proj_target = new_proj_obj.targets.first
|
331
|
+
|
332
|
+
if File.exist?(File.join(new_proj_path, "AppEntry/PrefixHeader.pch"))
|
333
|
+
new_proj_target.build_configuration_list.set_setting('GCC_PREFIX_HEADER', "$(SRCROOT)/AppEntry/PrefixHeader.pch")
|
334
|
+
end
|
335
|
+
|
336
|
+
launch_storyboard_path = File.join(new_proj_path, "AppEntry", 'LaunchScreen.storyboard')
|
337
|
+
if File.exist?(launch_storyboard_path)
|
338
|
+
new_proj_target.build_configuration_list.set_setting('ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME', "")
|
339
|
+
info_plist_path = File.join(new_proj_path, "AppEntry", "Info.plist")
|
340
|
+
info_plist_dict = Xcodeproj::Plist.read_from_path(info_plist_path)
|
341
|
+
info_plist_dict["UILaunchStoryboardName"] = "LaunchScreen"
|
342
|
+
info_plist_dict["CFBundleIdentifier"] = "$(PRODUCT_BUNDLE_IDENTIFIER)"
|
343
|
+
Xcodeproj::Plist.write_to_path(info_plist_dict, info_plist_path)
|
344
|
+
else
|
345
|
+
launch_path = File.join(new_proj_path, "AppEntry", 'Assets.xcassets', 'LaunchImage.launchimage')
|
346
|
+
new_proj_target.build_configuration_list.set_setting('ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME', "LaunchImage")
|
347
|
+
if File.exist?(launch_path)
|
348
|
+
new_proj_target.build_configuration_list.set_setting('ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME', "LaunchImage")
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
new_proj_obj.save
|
353
|
+
end
|
354
|
+
|
355
|
+
|
356
|
+
def add_file_to_target(new_proj_name:nil, new_proj_path:nil, new_proj_obj:nil, old_proj_name:nil, old_proj_path:nil, old_proj_obj:nil)
|
357
|
+
|
358
|
+
old_proj_target = old_proj_obj.targets.first
|
359
|
+
new_proj_target = new_proj_obj.targets.first
|
360
|
+
|
361
|
+
old_proj_obj.groups.each do |group|
|
362
|
+
|
363
|
+
if group.display_name == "Pods" || group.display_name == "Frameworks" || group.display_name == "Products"
|
364
|
+
puts group.display_name
|
365
|
+
else
|
366
|
+
|
367
|
+
new_target = new_proj_target
|
368
|
+
new_group_name = group.display_name
|
369
|
+
|
370
|
+
if group.display_name == old_proj_name + "iMessage" || group.display_name == old_proj_name + "Keyboard" || group.display_name == old_proj_name + "Extension" || group.display_name == old_proj_name + "NotificationService" || group.display_name == old_proj_name + "NotificationContent"
|
371
|
+
new_group_name = group.display_name.gsub(old_proj_name, new_proj_name)
|
372
|
+
puts "new_group_name +++ #{new_group_name}"
|
373
|
+
puts "group.display_name +++ #{group.display_name}"
|
374
|
+
new_target = get_target_by_name(proj_obj:new_proj_obj,name:new_group_name)
|
375
|
+
end
|
376
|
+
new_group = new_proj_obj.main_group.find_subpath(new_group_name, true)
|
377
|
+
new_group.set_source_tree(group.source_tree)
|
378
|
+
puts group.source_tree
|
379
|
+
new_group.set_path(File.join('./', new_group_name))
|
380
|
+
add_files_proj_with_dir(new_proj_obj:new_proj_obj, new_target:new_target, new_group:new_group)
|
381
|
+
|
382
|
+
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
new_entitlements_plist = File.join(new_proj_path, new_proj_name + ".entitlements")
|
387
|
+
if File.exist?(new_entitlements_plist)
|
388
|
+
new_proj_obj.main_group.new_reference(new_proj_name + ".entitlements")
|
389
|
+
end
|
390
|
+
|
391
|
+
old_proj_obj.targets.each do |target|
|
392
|
+
new_target_name = target.name.to_s.gsub(old_proj_name, new_proj_name)
|
393
|
+
new_target = get_target_by_name(proj_obj:new_proj_obj,name:new_target_name)
|
394
|
+
|
395
|
+
unless new_target.nil?
|
396
|
+
|
397
|
+
device_mode = target.build_configuration_list.get_setting("TARGETED_DEVICE_FAMILY")["Release"]
|
398
|
+
new_target.build_configuration_list.set_setting("TARGETED_DEVICE_FAMILY", device_mode)
|
399
|
+
|
400
|
+
target.frameworks_build_phase.files_references.each do |file|
|
401
|
+
group = new_proj_obj.frameworks_group['iOS'] || new_proj_obj.frameworks_group.new_group('iOS')
|
402
|
+
ref = group.find_file_by_path(file.path)
|
403
|
+
if ref.nil?
|
404
|
+
ref = group.new_file(file.path, :sdk_root)
|
405
|
+
end
|
406
|
+
ref.source_tree = file.source_tree
|
407
|
+
new_target.frameworks_build_phase.add_file_reference(ref, true)
|
408
|
+
end
|
409
|
+
|
410
|
+
# target.resources_build_phase.files_references.each do |file|
|
411
|
+
|
412
|
+
# end
|
413
|
+
# target.source_build_phase.files_references.each do |file|
|
414
|
+
|
415
|
+
# end
|
416
|
+
|
417
|
+
old_group = old_proj_obj.main_group.find_subpath("PResources", false)
|
418
|
+
unless old_group.nil?
|
419
|
+
new_group = new_proj_obj.main_group.find_subpath("PResources", false)
|
420
|
+
old_group.files.each do |file|
|
421
|
+
ref = new_group.find_file_by_path(file.path)
|
422
|
+
unless ref.nil?
|
423
|
+
if target.resources_build_phase.include?(file)
|
424
|
+
new_target.resources_build_phase.add_file_reference(ref, true)
|
425
|
+
else
|
426
|
+
new_target.resources_build_phase.remove_file_reference(ref)
|
427
|
+
end
|
428
|
+
end
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
old_group = old_proj_obj.main_group.find_subpath("Resources", false)
|
433
|
+
unless old_group.nil?
|
434
|
+
new_group = new_proj_obj.main_group.find_subpath("Resources", false)
|
435
|
+
old_group.files.each do |file|
|
436
|
+
ref = new_group.find_file_by_path(file.path)
|
437
|
+
unless ref.nil?
|
438
|
+
if target.resources_build_phase.include?(file)
|
439
|
+
new_target.resources_build_phase.add_file_reference(ref, true)
|
440
|
+
else
|
441
|
+
new_target.resources_build_phase.remove_file_reference(ref)
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
445
|
+
end
|
446
|
+
|
447
|
+
# extention
|
448
|
+
if new_target_name != new_proj_name
|
449
|
+
|
450
|
+
if File.exist?(File.join(new_proj_path, new_target_name, new_target_name + ".entitlements"))
|
451
|
+
new_target.build_configuration_list.set_setting('CODE_SIGN_ENTITLEMENTS', File.join(new_target_name, new_target_name + ".entitlements"))
|
452
|
+
end
|
453
|
+
else
|
454
|
+
|
455
|
+
if File.exist?(File.join(new_proj_path, new_target_name + ".entitlements"))
|
456
|
+
new_target.build_configuration_list.set_setting('CODE_SIGN_ENTITLEMENTS', File.join(new_target_name + ".entitlements"))
|
457
|
+
end
|
458
|
+
end
|
459
|
+
|
460
|
+
end
|
461
|
+
end
|
462
|
+
|
463
|
+
embed_content_build_phase = new_proj_target.new_copy_files_build_phase("Embed App Extensions")
|
464
|
+
embed_content_build_phase.symbol_dst_subfolder_spec=:plug_ins
|
465
|
+
new_proj_obj.products_group.files.each do |file|
|
466
|
+
if file.path.to_s.end_with?(".appex")
|
467
|
+
new_proj_target.add_file_references([file])
|
468
|
+
embed_content_build_phase.add_file_reference(file)
|
469
|
+
end
|
470
|
+
end
|
471
|
+
|
472
|
+
end
|
473
|
+
|
474
|
+
|
475
|
+
def create_project_target(new_proj_name:nil, new_proj_path:nil, new_proj_obj:nil, old_proj_name:nil, old_proj_path:nil, old_proj_obj:nil)
|
476
|
+
|
477
|
+
ios_deployment_targe = "11.0"
|
478
|
+
if @config_json && @config_json['project_info'] && @config_json['project_info']['ios_deployment_targe']
|
479
|
+
ios_deployment_targe = @config_json['project_info']['ios_deployment_targe']
|
480
|
+
end
|
481
|
+
|
482
|
+
new_proj_target = new_proj_obj.new_target(:application, new_proj_name, :ios, ios_deployment_targe, nil, :objc)
|
483
|
+
old_proj_target = old_proj_obj.targets.first
|
484
|
+
|
485
|
+
notification_content_target_name = new_proj_name + "NotificationContent"
|
486
|
+
notification_content_target = nil
|
487
|
+
notification_service_target_name = new_proj_name + "NotificationService"
|
488
|
+
notification_service_target = nil
|
489
|
+
keyboard_target_name = new_proj_name + "Keyboard"
|
490
|
+
keyboard_target = nil
|
491
|
+
imessage_target_name = new_proj_name + "iMessage"
|
492
|
+
imessage_target = nil
|
493
|
+
extension_target_name = new_proj_name + "Extension"
|
494
|
+
extension_target = nil
|
495
|
+
|
496
|
+
old_proj_obj.targets.each do |target|
|
497
|
+
target.build_configurations.each do |config|
|
498
|
+
if target.name.to_s.end_with?("Content") && notification_content_target.nil? then
|
499
|
+
notification_content_target = new_proj_obj.new_target(:app_extension, notification_content_target_name, :ios, ios_deployment_targe, nil, :objc)
|
500
|
+
new_proj_target.add_dependency(notification_content_target)
|
501
|
+
elsif target.name.to_s.end_with?("Service") && notification_service_target.nil? then
|
502
|
+
notification_service_target = new_proj_obj.new_target(:app_extension, notification_service_target_name, :ios, ios_deployment_targe, nil, :objc)
|
503
|
+
new_proj_target.add_dependency(notification_service_target)
|
504
|
+
elsif target.name.to_s.downcase.end_with?("keyboard") && keyboard_target.nil? then
|
505
|
+
keyboard_target = new_proj_obj.new_target(:app_extension, keyboard_target_name, :ios, ios_deployment_targe, nil, :objc)
|
506
|
+
new_proj_target.add_dependency(keyboard_target)
|
507
|
+
elsif target.name.to_s.downcase.end_with?("imessage") && imessage_target.nil? then
|
508
|
+
imessage_target = new_proj_obj.new_target(:messages_extension, imessage_target_name, :ios, ios_deployment_targe, nil, :objc)
|
509
|
+
new_proj_target.add_dependency(imessage_target)
|
510
|
+
elsif target.name.to_s.downcase.end_with?("extension") && imessage_target.nil? then
|
511
|
+
extension_target = new_proj_obj.new_target(:app_extension, extension_target_name, :ios, ios_deployment_targe, nil, :objc)
|
512
|
+
new_proj_target.add_dependency(extension_target)
|
513
|
+
end
|
514
|
+
end
|
515
|
+
end
|
516
|
+
|
517
|
+
end
|
518
|
+
|
519
|
+
end
|
520
|
+
|
521
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
module Pindo
|
3
|
+
module AppConfigOptions
|
4
|
+
|
5
|
+
attr_accessor :args_bundle_id
|
6
|
+
|
7
|
+
def initialize(argv)
|
8
|
+
@args_bundle_id = argv.option('a')
|
9
|
+
super
|
10
|
+
@additional_args = argv.remainder!
|
11
|
+
end
|
12
|
+
|
13
|
+
def validate!
|
14
|
+
super
|
15
|
+
|
16
|
+
if @args_bundle_id.nil?
|
17
|
+
say "You need input a bundle id"
|
18
|
+
@args_bundle_id = ask('Bundle Id : ') || nil
|
19
|
+
end
|
20
|
+
help! 'You need input a bundle id' if @args_bundle_id.nil? || @args_bundle_id.empty?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|