|
@@ -68,6 +68,10 @@ def pack(game, sdk, config):
|
|
|
return ret
|
|
|
# 复制app res资源
|
|
|
ret = copyAppRes(game, sdk, subChannel, config)
|
|
|
+ if ret:
|
|
|
+ return ret
|
|
|
+ # 合并语言文件
|
|
|
+ ret = mergeLanguage(game, sdk, subChannel, config)
|
|
|
if ret:
|
|
|
return ret
|
|
|
# 增加配置文件
|
|
@@ -323,6 +327,62 @@ def copyAppRes(game, sdk, subChannel, config):
|
|
|
if ret:
|
|
|
return ret
|
|
|
return 0
|
|
|
+
|
|
|
+def mergeLanguage(game, sdk, subChannel, config):
|
|
|
+ '''
|
|
|
+ 合并语言文件
|
|
|
+ '''
|
|
|
+ print('merge language...')
|
|
|
+ channelPath = file_utils.getSubChannelPath(game, sdk, subChannel)
|
|
|
+ mergePath = file_utils.getFullPath(channelPath, 'merge')
|
|
|
+ decompliePath = file_utils.getDecompliePath(game, sdk, subChannel, config['cache'])
|
|
|
+
|
|
|
+ if not os.path.exists(mergePath):
|
|
|
+ print('%s not exists!' % mergePath)
|
|
|
+ return 1
|
|
|
+
|
|
|
+ if not os.path.isdir(mergePath):
|
|
|
+ print('%s not a dir!' % mergePath)
|
|
|
+ return 1
|
|
|
+
|
|
|
+ for fileName in os.listdir(mergePath):
|
|
|
+ mergeJson(mergePath, decompliePath, fileName)
|
|
|
+ return 0
|
|
|
+
|
|
|
+def mergeJson(srcDir, changeDir, fileName):
|
|
|
+ srcFile = os.path.join(srcDir, fileName)
|
|
|
+ if os.path.isdir(srcFile):
|
|
|
+ for fileName2 in os.listdir(srcFile):
|
|
|
+ changeDir2 = os.path.join(changeDir, fileName)
|
|
|
+ mergeJson(srcFile, changeDir2, fileName2)
|
|
|
+ else:
|
|
|
+ changeFile = os.path.join(changeDir, fileName)
|
|
|
+ if not os.path.exists(changeFile):
|
|
|
+ print('%s not exists!' % changeFile)
|
|
|
+ return 1
|
|
|
+ jsonText1 = file_utils.readFile(srcFile)
|
|
|
+ jsonText2 = file_utils.readFile(changeFile)
|
|
|
+ print('*************src config*************')
|
|
|
+ print(jsonText1)
|
|
|
+ print('************************************')
|
|
|
+ print('*************target config*************')
|
|
|
+ print(jsonText2)
|
|
|
+ print('************************************')
|
|
|
+
|
|
|
+ json1 = json.loads(jsonText1)
|
|
|
+ json2 = json.loads(jsonText2)
|
|
|
+
|
|
|
+ for item in json1:
|
|
|
+ if item in json2:
|
|
|
+ json2[item] = json1[item]
|
|
|
+
|
|
|
+ jsonStr = json.dumps(json2, ensure_ascii=False)
|
|
|
+ print('*************merge config*************')
|
|
|
+ print(jsonStr)
|
|
|
+ print('************************************')
|
|
|
+ print('>> %s' % changeFile)
|
|
|
+ file_utils.createFile(changeFile, jsonStr)
|
|
|
+ return 0
|
|
|
|
|
|
def copyAppResWithType(decompliePath, channelPath, typeName):
|
|
|
decomplieResPath = os.path.join(decompliePath, 'res')
|