pindo 5.0.4 → 5.0.5
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/pindo/base/githelper.rb +1 -1
- data/lib/pindo/command/android/autobuild.rb +121 -0
- data/lib/pindo/command/android/build.rb +113 -0
- data/lib/pindo/command/android/debug.rb +60 -14
- data/lib/pindo/command/android.rb +5 -2
- data/lib/pindo/command/ios/autobuild.rb +6 -0
- data/lib/pindo/command/ios/build.rb +7 -1
- data/lib/pindo/command/unity/apk.rb +69 -6
- data/lib/pindo/command/utils/renewcert.rb +2 -2
- data/lib/pindo/module/android/apk_helper.rb +91 -0
- data/lib/pindo/module/android/base_helper.rb +293 -0
- data/lib/pindo/module/android/build_helper.rb +112 -0
- data/lib/pindo/module/android/gradle_helper.rb +48 -0
- data/lib/pindo/module/android/so_helper.rb +18 -0
- data/lib/pindo/module/build/buildhelper.rb +50 -37
- data/lib/pindo/module/build/unityhelper.rb +16 -16
- data/lib/pindo/module/pgyer/pgyerhelper.rb +14 -11
- data/lib/pindo/module/xcode/xcodehelper.rb +73 -73
- data/lib/pindo/version.rb +1 -1
- metadata +30 -3
@@ -27,7 +27,7 @@ module Pindo
|
|
27
27
|
|
28
28
|
if project_unity_version.nil? || project_unity_version.empty?
|
29
29
|
raise "Project Unity version is nil or empty"
|
30
|
-
end
|
30
|
+
end
|
31
31
|
|
32
32
|
unity_major_version = project_unity_version.split('.')[0..1].join('.')
|
33
33
|
paths = case RUBY_PLATFORM
|
@@ -66,16 +66,16 @@ module Pindo
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
if unity_versions.empty?
|
71
71
|
raise Informative, "未找到任何Unity版本"
|
72
72
|
end
|
73
73
|
|
74
|
-
|
74
|
+
|
75
75
|
select_unity_versions = unity_versions.select { |v| v[:version] == project_unity_version } || []
|
76
76
|
if !select_unity_versions.nil? && !select_unity_versions.empty? && select_unity_versions.length >= 1
|
77
77
|
return select_unity_versions.first[:path]
|
78
|
-
end
|
78
|
+
end
|
79
79
|
|
80
80
|
unity_versions.sort_by! { |v| v[:major_version] }
|
81
81
|
select_unity_versions = unity_versions.select { |v| v[:major_version] == unity_major_version } if unity_major_version
|
@@ -89,7 +89,7 @@ module Pindo
|
|
89
89
|
else
|
90
90
|
return select_unity_versions.first[:path]
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
end
|
94
94
|
|
95
95
|
private
|
@@ -99,17 +99,17 @@ module Pindo
|
|
99
99
|
# macOS路径格式(变体): /Applications/Unity/Hub/Editor/2021.3.45f1c1/Unity.app/Contents/MacOS/Unity
|
100
100
|
# Windows路径格式: C:/Program Files/Unity/Hub/Editor/2021.3.45f1/Editor/Unity.exe
|
101
101
|
# Windows路径格式(变体): C:/Program Files/Unity/Hub/Editor/2021.3.45f1c1/Editor/Unity.exe
|
102
|
-
|
102
|
+
|
103
103
|
# 尝试匹配 macOS 路径格式
|
104
104
|
if match = path.match(/Editor\/([\d.]+[a-zA-Z]\d+(?:c\d+)?)\//)
|
105
105
|
return match[1]
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
108
|
# 尝试匹配 Windows 路径格式
|
109
109
|
if match = path.match(/([\d.]+[a-zA-Z]\d+(?:c\d+)?)\/Editor\//)
|
110
110
|
return match[1]
|
111
111
|
end
|
112
|
-
|
112
|
+
|
113
113
|
nil
|
114
114
|
end
|
115
115
|
|
@@ -119,7 +119,7 @@ module Pindo
|
|
119
119
|
if unity_exe_full_path.nil?
|
120
120
|
raise Informative, "Unity path not found!"
|
121
121
|
end
|
122
|
-
|
122
|
+
|
123
123
|
cmd_args = [
|
124
124
|
unity_exe_full_path,
|
125
125
|
"-batchmode",
|
@@ -138,7 +138,7 @@ module Pindo
|
|
138
138
|
|
139
139
|
puts "Unity command: #{cmd_args.join(' ')}"
|
140
140
|
stdout, stderr, status = Open3.capture3(*cmd_args)
|
141
|
-
|
141
|
+
|
142
142
|
{
|
143
143
|
success: status.success?,
|
144
144
|
stdout: stdout,
|
@@ -147,14 +147,14 @@ module Pindo
|
|
147
147
|
}
|
148
148
|
end
|
149
149
|
|
150
|
-
|
150
|
+
|
151
151
|
def build_project(unity_exe_full_path:nil, project_path:nil, platform: nil, isLibrary: false)
|
152
152
|
|
153
153
|
additional_args = {}
|
154
154
|
additional_args[:platform] = platform if platform
|
155
155
|
additional_args[:buildtype] = 'library' if isLibrary
|
156
156
|
result = execute_unity_command(unity_exe_full_path, project_path, additional_args)
|
157
|
-
|
157
|
+
|
158
158
|
if result[:success]
|
159
159
|
puts "Unity build completed successfully"
|
160
160
|
puts "Using Unity version: #{result[:unity_version]}"
|
@@ -191,12 +191,12 @@ module Pindo
|
|
191
191
|
project_settings_path = File.join(project_path, "ProjectSettings")
|
192
192
|
assets_path = File.join(project_path, "Assets")
|
193
193
|
packages_path = File.join(project_path, "Packages")
|
194
|
-
|
195
|
-
File.directory?(project_settings_path) &&
|
196
|
-
File.directory?(assets_path) &&
|
194
|
+
|
195
|
+
File.directory?(project_settings_path) &&
|
196
|
+
File.directory?(assets_path) &&
|
197
197
|
File.directory?(packages_path) &&
|
198
198
|
File.exist?(File.join(project_settings_path, "ProjectSettings.asset"))
|
199
199
|
end
|
200
200
|
end
|
201
201
|
end
|
202
|
-
end
|
202
|
+
end
|
@@ -90,15 +90,15 @@ module Pindo
|
|
90
90
|
|
91
91
|
proj_name_array_append.each do |new_string|
|
92
92
|
if !new_string.nil? && !new_string.empty?
|
93
|
-
if proj_name_array.size > 0
|
93
|
+
if proj_name_array.size > 0
|
94
94
|
new_fromat_string = new_string.gsub(/[\s_]/, "")
|
95
95
|
unless proj_name_array.any? { |s| s.gsub(/[\s_]/, "") == new_fromat_string }
|
96
96
|
# 如果不存在相同字符串,插入到第一位
|
97
97
|
proj_name_array.push(new_string)
|
98
98
|
end
|
99
99
|
else
|
100
|
-
proj_name_array.push(new_string)
|
101
|
-
end
|
100
|
+
proj_name_array.push(new_string)
|
101
|
+
end
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
@@ -146,7 +146,9 @@ module Pindo
|
|
146
146
|
|
147
147
|
def start_upload(app_info_obj:nil, ipa_file_upload:nil, description:nil)
|
148
148
|
|
149
|
-
if !ipa_file_upload.nil? &&
|
149
|
+
if !ipa_file_upload.nil? &&
|
150
|
+
File.extname(ipa_file_upload).eql?(".app") &&
|
151
|
+
File.extname(ipa_file_upload).eql?(".apk")
|
150
152
|
mac_app_path = ipa_file_upload
|
151
153
|
ipa_base_dir = File.dirname(ipa_file_upload)
|
152
154
|
ipa_base_name = File.basename(ipa_file_upload, File.extname(ipa_file_upload))
|
@@ -170,7 +172,7 @@ module Pindo
|
|
170
172
|
unless !ipa_file_upload.nil? && File.exist?(ipa_file_upload)
|
171
173
|
return
|
172
174
|
end
|
173
|
-
|
175
|
+
|
174
176
|
args_ipa_file_dir = File.expand_path(File::dirname(ipa_file_upload))
|
175
177
|
ipa_file_upload=File.join(args_ipa_file_dir, File.basename(ipa_file_upload))
|
176
178
|
current_project_dir = Dir.pwd
|
@@ -266,7 +268,7 @@ module Pindo
|
|
266
268
|
end
|
267
269
|
|
268
270
|
def send_apptest_msg(appId:nil, appVersionId:nil, chatEnv: nil, receiveType:nil)
|
269
|
-
|
271
|
+
|
270
272
|
Funlog.instance.fancyinfo_start("正在发送飞书消息...")
|
271
273
|
result = @pgyer_client.post_message(appId:appId, appVersionId:appVersionId, chatEnv: chatEnv, receiveType:receiveType)
|
272
274
|
|
@@ -277,7 +279,7 @@ module Pindo
|
|
277
279
|
Funlog.instance.fancyinfo_error("未发送飞书测试信息!")
|
278
280
|
return false
|
279
281
|
end
|
280
|
-
|
282
|
+
|
281
283
|
end
|
282
284
|
|
283
285
|
def send_apptest_wechat_msg(msg_data:nil, wechat_url:nil)
|
@@ -407,7 +409,7 @@ module Pindo
|
|
407
409
|
app_info_list = Pindoconfig.instance.get_pgyerapps_info_list()
|
408
410
|
app_info_obj = app_info_list&.find do |app_info_item|
|
409
411
|
app_info_item_name = app_info_item["appName"].to_s.downcase.strip.gsub(/[\s\-_]/, '')
|
410
|
-
app_info_item_name.eql?(key_proj_name)
|
412
|
+
app_info_item_name.eql?(key_proj_name)
|
411
413
|
end
|
412
414
|
|
413
415
|
Funlog.instance.fancyinfo_success("拉取app信息列表完成,app信息获取成功!")
|
@@ -524,7 +526,7 @@ module Pindo
|
|
524
526
|
description = nil
|
525
527
|
if !current_project_dir.nil? && is_git_directory?(local_repo_dir: current_project_dir)
|
526
528
|
current_git_root_path = git_root_directory(local_repo_dir: current_project_dir)
|
527
|
-
|
529
|
+
|
528
530
|
# dev 打包情况的备注
|
529
531
|
cliff_toml_path = File.join(current_git_root_path, "cliff.toml")
|
530
532
|
if File.exist?(cliff_toml_path)
|
@@ -534,12 +536,13 @@ module Pindo
|
|
534
536
|
if git_cliff_installed
|
535
537
|
temp_dir = Dir.pwd
|
536
538
|
Dir.chdir(current_git_root_path)
|
539
|
+
`git-cliff -c #{cliff_toml_path} --latest -o -`
|
537
540
|
description = `git-cliff -c #{cliff_toml_path} --latest -o -`.strip
|
538
541
|
Dir.chdir(temp_dir)
|
539
542
|
end
|
540
543
|
rescue StandardError => e
|
541
544
|
end
|
542
|
-
end
|
545
|
+
end
|
543
546
|
end
|
544
547
|
return description
|
545
548
|
end
|
@@ -563,7 +566,7 @@ module Pindo
|
|
563
566
|
Funlog.instance.fancyinfo_start("pgyer备注已经修改!")
|
564
567
|
end
|
565
568
|
|
566
|
-
|
569
|
+
|
567
570
|
|
568
571
|
puts "备注信息修改成功!!"
|
569
572
|
|
@@ -22,14 +22,14 @@ module Pindo
|
|
22
22
|
end
|
23
23
|
return false
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def add_files_proj_with_dir(new_proj_obj:nil, new_target:nil, new_group:nil)
|
27
27
|
|
28
|
-
if File.exist?(new_group.real_path)
|
29
|
-
|
28
|
+
if File.exist?(new_group.real_path)
|
29
|
+
|
30
30
|
Dir.foreach(new_group.real_path) do |entry|
|
31
31
|
filePath = File.join(new_group.real_path, entry)
|
32
|
-
|
32
|
+
|
33
33
|
# puts filePath
|
34
34
|
if entry.to_s.start_with?(".") then
|
35
35
|
|
@@ -56,18 +56,18 @@ module Pindo
|
|
56
56
|
new_target.add_file_references([fileReference])
|
57
57
|
# elsif filePath.to_s.end_with?("pbobjc.m", "pbobjc.mm") then
|
58
58
|
# new_target.add_file_references([fileReference], '-fno-objc-arc')
|
59
|
-
|
59
|
+
|
60
60
|
elsif filePath.to_s.end_with?(".pch") then
|
61
61
|
|
62
62
|
elsif filePath.to_s.end_with?(".entitlements") then
|
63
63
|
|
64
64
|
elsif filePath.to_s.end_with?("Info.plist") && entry == "Info.plist" then
|
65
|
-
|
65
|
+
|
66
66
|
elsif filePath.to_s.end_with?(".h") then
|
67
67
|
# new_target.headers_build_phase.add_file_reference(fileReference)
|
68
68
|
elsif filePath.to_s.end_with?(".framework") || filePath.to_s.end_with?(".a") then
|
69
69
|
new_target.frameworks_build_phases.add_file_reference(fileReference)
|
70
|
-
elsif
|
70
|
+
elsif
|
71
71
|
new_target.add_resources([fileReference])
|
72
72
|
end
|
73
73
|
# 目录情况下, 递归添加
|
@@ -84,7 +84,7 @@ module Pindo
|
|
84
84
|
|
85
85
|
|
86
86
|
def config_target(new_proj_obj:nil, new_target:nil, config:nil, bundle_id:nil, is_extention:false, setting_array:nil)
|
87
|
-
|
87
|
+
|
88
88
|
new_proj_obj.root_object.attributes['TargetAttributes'] = new_proj_obj.root_object.attributes['TargetAttributes'] || {}
|
89
89
|
target_atts_obj = new_proj_obj.root_object.attributes['TargetAttributes']
|
90
90
|
target_atts_obj[new_target.uuid] = target_atts_obj[new_target.uuid] || {}
|
@@ -108,7 +108,7 @@ module Pindo
|
|
108
108
|
target_systemcapabilities['com.apple.Push'] = {}
|
109
109
|
target_systemcapabilities['com.apple.Push']['enabled'] = 0
|
110
110
|
end
|
111
|
-
|
111
|
+
|
112
112
|
if setting_array.to_s.include?("app_group")
|
113
113
|
target_systemcapabilities['com.apple.Group'] = {}
|
114
114
|
target_systemcapabilities['com.apple.Group']['enabled'] = 1
|
@@ -130,7 +130,7 @@ module Pindo
|
|
130
130
|
if is_extention
|
131
131
|
config.build_settings['INFOPLIST_FILE'] = new_target.name + "/Info.plist"
|
132
132
|
config.build_settings['SKIP_INSTALL'] = "YES"
|
133
|
-
|
133
|
+
|
134
134
|
if new_target.name.include?("iMessage")
|
135
135
|
|
136
136
|
config.build_settings['LD_RUNPATH_SEARCH_PATHS'] = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"
|
@@ -148,7 +148,7 @@ module Pindo
|
|
148
148
|
end
|
149
149
|
|
150
150
|
else
|
151
|
-
|
151
|
+
|
152
152
|
config.build_settings['ASSETCATALOG_COMPILER_APPICON_NAME'] = "AppIcon"
|
153
153
|
config.build_settings['INFOPLIST_FILE'] = "AppEntry/Info.plist"
|
154
154
|
config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = "$(inherited)"
|
@@ -160,62 +160,62 @@ module Pindo
|
|
160
160
|
config.build_settings['PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR'] = "NO";
|
161
161
|
|
162
162
|
macros = config.build_settings['GCC_PREPROCESSOR_DEFINITIONS']
|
163
|
-
if macros.nil? || macros == ""
|
163
|
+
if macros.nil? || macros == ""
|
164
164
|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = "$(inherited)"
|
165
165
|
end
|
166
|
-
|
166
|
+
|
167
167
|
end
|
168
168
|
|
169
169
|
end
|
170
170
|
|
171
171
|
def copy_to_newproject(new_proj_path:nil, new_proj_name:nil, old_proj_path:nil, old_proj_name:nil)
|
172
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)
|
173
|
+
if File.exist?(File.join(old_proj_path, "U3DLib"))
|
174
|
+
FileUtils.cp_r(File.join(old_proj_path, "U3DLib"), new_proj_path)
|
175
175
|
end
|
176
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)
|
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
179
|
end
|
180
180
|
|
181
|
-
if File.exist?(File.join(old_proj_path, "AppLogic"))
|
182
|
-
FileUtils.cp_r(File.join(old_proj_path, "AppLogic"), new_proj_path)
|
181
|
+
if File.exist?(File.join(old_proj_path, "AppLogic"))
|
182
|
+
FileUtils.cp_r(File.join(old_proj_path, "AppLogic"), new_proj_path)
|
183
183
|
end
|
184
184
|
|
185
|
-
if File.exist?(File.join(old_proj_path, "AppUI"))
|
186
|
-
FileUtils.cp_r(File.join(old_proj_path, "AppUI"), new_proj_path)
|
185
|
+
if File.exist?(File.join(old_proj_path, "AppUI"))
|
186
|
+
FileUtils.cp_r(File.join(old_proj_path, "AppUI"), new_proj_path)
|
187
187
|
end
|
188
188
|
|
189
|
-
if File.exist?(File.join(old_proj_path, "PResources"))
|
190
|
-
FileUtils.cp_r(File.join(old_proj_path, "PResources"), new_proj_path)
|
189
|
+
if File.exist?(File.join(old_proj_path, "PResources"))
|
190
|
+
FileUtils.cp_r(File.join(old_proj_path, "PResources"), new_proj_path)
|
191
191
|
end
|
192
192
|
|
193
|
-
if File.exist?(File.join(old_proj_path, "Resources"))
|
194
|
-
FileUtils.cp_r(File.join(old_proj_path, "Resources"), new_proj_path)
|
193
|
+
if File.exist?(File.join(old_proj_path, "Resources"))
|
194
|
+
FileUtils.cp_r(File.join(old_proj_path, "Resources"), new_proj_path)
|
195
195
|
end
|
196
196
|
|
197
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
|
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
200
|
FileUtils.mv(File.join(new_proj_path, old_proj_name + "NotificationContent"), File.join(new_proj_path, new_proj_name + "NotificationContent"))
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
204
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
|
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
207
|
FileUtils.mv(File.join(new_proj_path, old_proj_name + "NotificationService"), File.join(new_proj_path, new_proj_name + "NotificationService"))
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
211
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
|
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
214
|
FileUtils.mv(File.join(new_proj_path, old_proj_name + "Keyboard"), File.join(new_proj_path, new_proj_name + "Keyboard"))
|
215
215
|
old_entitlements_plist = File.join(new_proj_path, new_proj_name + "Keyboard", old_proj_name + "Keyboard.entitlements")
|
216
216
|
new_entitlements_plist = File.join(new_proj_path, new_proj_name + "Keyboard", new_proj_name + "Keyboard.entitlements")
|
217
217
|
if File.exist?(old_entitlements_plist) && old_entitlements_plist != new_entitlements_plist
|
218
|
-
FileUtils.mv(old_entitlements_plist, new_entitlements_plist)
|
218
|
+
FileUtils.mv(old_entitlements_plist, new_entitlements_plist)
|
219
219
|
# entitlements_plist_dict = Xcodeproj::Plist.read_from_path(new_entitlements_plist)
|
220
220
|
# entitlements_plist_dict['com.apple.security.application-groups'] = [@group_id]
|
221
221
|
# Xcodeproj::Plist.write_to_path(entitlements_plist_dict, new_entitlements_plist)
|
@@ -224,59 +224,59 @@ module Pindo
|
|
224
224
|
end
|
225
225
|
|
226
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
|
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
229
|
FileUtils.mv(File.join(new_proj_path, old_proj_name + "iMessage"), File.join(new_proj_path, new_proj_name + "iMessage"))
|
230
230
|
end
|
231
231
|
old_entitlements_plist = File.join(new_proj_path, new_proj_name + "iMessage", old_proj_name + "iMessage.entitlements")
|
232
232
|
new_entitlements_plist = File.join(new_proj_path, new_proj_name + "iMessage", new_proj_name + "iMessage.entitlements")
|
233
233
|
if File.exist?(old_entitlements_plist) && old_entitlements_plist != new_entitlements_plist
|
234
|
-
FileUtils.mv(old_entitlements_plist, new_entitlements_plist)
|
234
|
+
FileUtils.mv(old_entitlements_plist, new_entitlements_plist)
|
235
235
|
end
|
236
236
|
end
|
237
237
|
|
238
238
|
|
239
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
|
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
242
|
FileUtils.mv(File.join(new_proj_path, old_proj_name + "Extension"), File.join(new_proj_path, new_proj_name + "Extension"))
|
243
243
|
end
|
244
244
|
old_entitlements_plist = File.join(new_proj_path, new_proj_name + "Extension", old_proj_name + "Extension.entitlements")
|
245
245
|
new_entitlements_plist = File.join(new_proj_path, new_proj_name + "Extension", new_proj_name + "Extension.entitlements")
|
246
246
|
if File.exist?(old_entitlements_plist) && old_entitlements_plist != new_entitlements_plist
|
247
|
-
FileUtils.mv(old_entitlements_plist, new_entitlements_plist)
|
247
|
+
FileUtils.mv(old_entitlements_plist, new_entitlements_plist)
|
248
248
|
end
|
249
249
|
end
|
250
250
|
|
251
251
|
|
252
252
|
if File.exist?(File.join(old_proj_path, "fastlane"))
|
253
|
-
FileUtils.cp_r(File.join(old_proj_path, "fastlane"), new_proj_path)
|
253
|
+
FileUtils.cp_r(File.join(old_proj_path, "fastlane"), new_proj_path)
|
254
254
|
end
|
255
255
|
|
256
256
|
if File.exist?(File.join(old_proj_path, "Script"))
|
257
|
-
FileUtils.cp_r(File.join(old_proj_path, "Script"), new_proj_path)
|
257
|
+
FileUtils.cp_r(File.join(old_proj_path, "Script"), new_proj_path)
|
258
258
|
end
|
259
259
|
|
260
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)
|
261
|
+
FileUtils.cp_r(File.join(old_proj_path, "config.json"), new_proj_path)
|
262
262
|
end
|
263
263
|
|
264
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)
|
265
|
+
FileUtils.cp_r(File.join(old_proj_path, "VBDL.json"), new_proj_path)
|
266
266
|
end
|
267
267
|
|
268
268
|
old_entitlements_plist = File.join(old_proj_path, old_proj_name + ".entitlements")
|
269
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)
|
270
|
+
if File.exist?(old_entitlements_plist)
|
271
|
+
FileUtils.cp_r(old_entitlements_plist, new_entitlements_plist)
|
272
272
|
end
|
273
273
|
|
274
274
|
|
275
|
-
FileUtils.cp_r(File.join(old_proj_path, "Podfile"), new_proj_path)
|
275
|
+
FileUtils.cp_r(File.join(old_proj_path, "Podfile"), new_proj_path)
|
276
276
|
text = File.read(File.join(new_proj_path, "Podfile"))
|
277
277
|
new_contents = text.gsub(/target.*#{old_proj_name}/, "target \'#{new_proj_name}")
|
278
278
|
File.open(File.join(new_proj_path, "Podfile"), "w") {|file| file.puts new_contents }
|
279
|
-
|
279
|
+
|
280
280
|
if File.exist?(File.join(old_proj_path, "config.json"))
|
281
281
|
FileUtils.cp_r(File.join(old_proj_path, "config.json"), new_proj_path)
|
282
282
|
end
|
@@ -304,7 +304,7 @@ module Pindo
|
|
304
304
|
elsif target.name.to_s.end_with?("Keyboard") then
|
305
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
306
|
elsif target.name.to_s.end_with?("iMessage") then
|
307
|
-
|
307
|
+
|
308
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
309
|
if File.exist?(File.join(new_proj_path, target.display_name, "Assets.xcassets"))
|
310
310
|
config.build_settings['ASSETCATALOG_COMPILER_APPICON_NAME'] = "iMessage App Icon"
|
@@ -326,15 +326,15 @@ module Pindo
|
|
326
326
|
|
327
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
328
|
|
329
|
-
old_proj_target = old_proj_obj.targets.first
|
330
|
-
new_proj_target = new_proj_obj.targets.first
|
329
|
+
old_proj_target = old_proj_obj.targets.first
|
330
|
+
new_proj_target = new_proj_obj.targets.first
|
331
331
|
|
332
332
|
if File.exist?(File.join(new_proj_path, "AppEntry/PrefixHeader.pch"))
|
333
333
|
new_proj_target.build_configuration_list.set_setting('GCC_PREFIX_HEADER', "$(SRCROOT)/AppEntry/PrefixHeader.pch")
|
334
334
|
end
|
335
|
-
|
336
|
-
launch_storyboard_path = File.join(new_proj_path, "AppEntry", 'LaunchScreen.storyboard')
|
337
|
-
if File.exist?(launch_storyboard_path)
|
335
|
+
|
336
|
+
launch_storyboard_path = File.join(new_proj_path, "AppEntry", 'LaunchScreen.storyboard')
|
337
|
+
if File.exist?(launch_storyboard_path)
|
338
338
|
new_proj_target.build_configuration_list.set_setting('ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME', "")
|
339
339
|
info_plist_path = File.join(new_proj_path, "AppEntry", "Info.plist")
|
340
340
|
info_plist_dict = Xcodeproj::Plist.read_from_path(info_plist_path)
|
@@ -344,19 +344,19 @@ module Pindo
|
|
344
344
|
else
|
345
345
|
launch_path = File.join(new_proj_path, "AppEntry", 'Assets.xcassets', 'LaunchImage.launchimage')
|
346
346
|
new_proj_target.build_configuration_list.set_setting('ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME', "LaunchImage")
|
347
|
-
if File.exist?(launch_path)
|
347
|
+
if File.exist?(launch_path)
|
348
348
|
new_proj_target.build_configuration_list.set_setting('ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME', "LaunchImage")
|
349
349
|
end
|
350
350
|
end
|
351
|
-
|
351
|
+
|
352
352
|
new_proj_obj.save
|
353
353
|
end
|
354
354
|
|
355
355
|
|
356
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
357
|
|
358
|
-
old_proj_target = old_proj_obj.targets.first
|
359
|
-
new_proj_target = new_proj_obj.targets.first
|
358
|
+
old_proj_target = old_proj_obj.targets.first
|
359
|
+
new_proj_target = new_proj_obj.targets.first
|
360
360
|
|
361
361
|
old_proj_obj.groups.each do |group|
|
362
362
|
|
@@ -373,19 +373,19 @@ module Pindo
|
|
373
373
|
puts "group.display_name +++ #{group.display_name}"
|
374
374
|
new_target = get_target_by_name(proj_obj:new_proj_obj,name:new_group_name)
|
375
375
|
end
|
376
|
-
new_group = new_proj_obj.main_group.find_subpath(new_group_name, true)
|
376
|
+
new_group = new_proj_obj.main_group.find_subpath(new_group_name, true)
|
377
377
|
new_group.set_source_tree(group.source_tree)
|
378
378
|
puts group.source_tree
|
379
|
-
new_group.set_path(File.join('./', new_group_name))
|
379
|
+
new_group.set_path(File.join('./', new_group_name))
|
380
380
|
add_files_proj_with_dir(new_proj_obj:new_proj_obj, new_target:new_target, new_group:new_group)
|
381
381
|
|
382
|
-
|
382
|
+
|
383
383
|
end
|
384
384
|
end
|
385
385
|
|
386
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")
|
387
|
+
if File.exist?(new_entitlements_plist)
|
388
|
+
new_proj_obj.main_group.new_reference(new_proj_name + ".entitlements")
|
389
389
|
end
|
390
390
|
|
391
391
|
old_proj_obj.targets.each do |target|
|
@@ -402,7 +402,7 @@ module Pindo
|
|
402
402
|
ref = group.find_file_by_path(file.path)
|
403
403
|
if ref.nil?
|
404
404
|
ref = group.new_file(file.path, :sdk_root)
|
405
|
-
end
|
405
|
+
end
|
406
406
|
ref.source_tree = file.source_tree
|
407
407
|
new_target.frameworks_build_phase.add_file_reference(ref, true)
|
408
408
|
end
|
@@ -414,9 +414,9 @@ module Pindo
|
|
414
414
|
|
415
415
|
# end
|
416
416
|
|
417
|
-
old_group = old_proj_obj.main_group.find_subpath("PResources", false)
|
417
|
+
old_group = old_proj_obj.main_group.find_subpath("PResources", false)
|
418
418
|
unless old_group.nil?
|
419
|
-
new_group = new_proj_obj.main_group.find_subpath("PResources", false)
|
419
|
+
new_group = new_proj_obj.main_group.find_subpath("PResources", false)
|
420
420
|
old_group.files.each do |file|
|
421
421
|
ref = new_group.find_file_by_path(file.path)
|
422
422
|
unless ref.nil?
|
@@ -425,13 +425,13 @@ module Pindo
|
|
425
425
|
else
|
426
426
|
new_target.resources_build_phase.remove_file_reference(ref)
|
427
427
|
end
|
428
|
-
end
|
428
|
+
end
|
429
429
|
end
|
430
430
|
end
|
431
|
-
|
432
|
-
old_group = old_proj_obj.main_group.find_subpath("Resources", false)
|
431
|
+
|
432
|
+
old_group = old_proj_obj.main_group.find_subpath("Resources", false)
|
433
433
|
unless old_group.nil?
|
434
|
-
new_group = new_proj_obj.main_group.find_subpath("Resources", false)
|
434
|
+
new_group = new_proj_obj.main_group.find_subpath("Resources", false)
|
435
435
|
old_group.files.each do |file|
|
436
436
|
ref = new_group.find_file_by_path(file.path)
|
437
437
|
unless ref.nil?
|
@@ -440,7 +440,7 @@ module Pindo
|
|
440
440
|
else
|
441
441
|
new_target.resources_build_phase.remove_file_reference(ref)
|
442
442
|
end
|
443
|
-
end
|
443
|
+
end
|
444
444
|
end
|
445
445
|
end
|
446
446
|
|
@@ -451,11 +451,11 @@ module Pindo
|
|
451
451
|
new_target.build_configuration_list.set_setting('CODE_SIGN_ENTITLEMENTS', File.join(new_target_name, new_target_name + ".entitlements"))
|
452
452
|
end
|
453
453
|
else
|
454
|
-
|
454
|
+
|
455
455
|
if File.exist?(File.join(new_proj_path, new_target_name + ".entitlements"))
|
456
456
|
new_target.build_configuration_list.set_setting('CODE_SIGN_ENTITLEMENTS', File.join(new_target_name + ".entitlements"))
|
457
457
|
end
|
458
|
-
end
|
458
|
+
end
|
459
459
|
|
460
460
|
end
|
461
461
|
end
|
@@ -473,14 +473,14 @@ module Pindo
|
|
473
473
|
|
474
474
|
|
475
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
|
-
|
476
|
+
|
477
477
|
ios_deployment_targe = "11.0"
|
478
478
|
if @config_json && @config_json['project_info'] && @config_json['project_info']['ios_deployment_targe']
|
479
479
|
ios_deployment_targe = @config_json['project_info']['ios_deployment_targe']
|
480
480
|
end
|
481
481
|
|
482
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
|
483
|
+
old_proj_target = old_proj_obj.targets.first
|
484
484
|
|
485
485
|
notification_content_target_name = new_proj_name + "NotificationContent"
|
486
486
|
notification_content_target = nil
|