Browse Source

增加删除资源接口

yhz 6 years ago
parent
commit
b7732a6d66
2 changed files with 20 additions and 8 deletions
  1. 17 8
      package_utils_record.py
  2. 3 0
      package_web_record.py

+ 17 - 8
package_utils_record.py

@@ -29,10 +29,11 @@ def pack(game, sdk, config):
     ret = decomplie(game, sdk, subChannel, config)
     if ret:
         return ret
-    # 删除旧代码
-    '''ret = removeOldCode(game, sdk, subChannel, config)
-    if ret:
-        return ret'''
+    if 'deleteList' in config:
+        # 删除旧资源
+        ret = removeOldRes(game, sdk, subChannel, config)
+        if ret:
+            return ret
     # 删除一些不支持的属性
     ret = removeNoSupportAttr(game, sdk, subChannel, config)
     if ret:
@@ -136,10 +137,6 @@ def pack(game, sdk, config):
     ret = apksignerApk(game, sdk, subChannel, config)
     if ret:
         return ret
-    # 添加渠道信息
-    '''ret = addChannel(game, sdk, subChannel, config)
-    if ret:
-        return ret'''
     # 清理产生的中间文件
     if config['clearCache']:
         clearTemp(game, sdk, subChannel, config)
@@ -162,6 +159,18 @@ def decomplie(game, sdk, subChannel, config):
 
     return file_utils.execJarCmd(apktoolPath, 'd -f "%s" -o "%s"' % (gamePath, decompliePath))
 
+def removeOldRes(game, sdk, subChannel, config):
+    '''
+    删除旧资源
+    '''
+    print('delete res ...')
+    decompliePath = file_utils.getDecompliePath(game, sdk, subChannel, config['cache'])
+    for subPath in config['deleteList']:
+        resPath = os.path.join(decompliePath, subPath)
+        os.remove(resPath)
+        print('delete ' + resPath)
+    return 0
+
 def removeOldCode(game, sdk, subChannel, config):
     '''
     删除旧代码

+ 3 - 0
package_web_record.py

@@ -69,6 +69,9 @@ def package(config, sdk):
     if 'recordConfig' in config:
         setRecordConfig(jsonConfig, config['recordConfig'])
 
+    if 'deleteList' in config:
+        jsonConfig['deleteList'] = config['deleteList']
+
     # 获取sdk相关配置
     getSdkConfig(sdk, jsonConfig, config)