1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- # -*- coding:utf-8 -*-
- import sys
- import os
- import traceback
- import json
- from V1 import merge_apk
- from V2 import merge_apk_v2
- def package():
- if len(sys.argv) < 2:
- print("参数数量不正确")
- exit(1)
- config = sys.argv[1]
- if not os.path.exists(config):
- print("配置文件不存在")
- exit(1)
- try:
- ret = read_config_use_new_script(config)
- if ret:
- ret = merge_apk_v2.startMerge(config)
- else:
- ret = merge_apk.startMerge(config)
- except:
- ret = False
- print(traceback.format_exc())
- if not ret:
- print("切包失败,请联系开发人员")
- exit(1)
- print("成功")
- exit(0)
- pass
- def read_config_use_new_script(json_file_path):
- with open(json_file_path, 'r') as f:
- params = json.load(f)
- if not 'useAapt2' in params['meta_config']:
- return None
- return params['meta_config']['useAapt2']
- if __name__ == "__main__":
- package()
|