package_test.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import package_utils
  2. import file_utils
  3. import xml_utils
  4. import config_utils
  5. import os
  6. import os.path
  7. import json
  8. def packTest():
  9. '''
  10. 测试代码
  11. '''
  12. game = 'qyj2'
  13. sdk = 'jm'
  14. subChannel = 'jm'
  15. channelPath = file_utils.getChannelPath('', game, sdk)
  16. print('channel_path :%s', channelPath)
  17. configPath = os.path.join(channelPath, 'config.json')
  18. jsonText = file_utils.read_file(configPath)
  19. config = json.loads(jsonText)
  20. config_utils.replaceArgs(config)
  21. config = getItemConfig(config, subChannel)
  22. if config is None:
  23. return 1
  24. package_utils.decomplie(game, sdk, subChannel, config)
  25. package_utils.remove_no_support_attr(game, sdk, subChannel, config)
  26. package_utils.merge_drawable_res(game, sdk, subChannel, config)
  27. package_utils.remove_same_values_res(game, sdk, subChannel, config)
  28. package_utils.copy_res(game, sdk, subChannel, config)
  29. package_utils.merge_manifest_res(game, sdk, subChannel, config)
  30. package_utils.change_placeholders(game, sdk, subChannel, config)
  31. package_utils.add_meta_data(game, sdk, subChannel, config)
  32. package_utils.copy_app_res(game, sdk, subChannel, config)
  33. package_utils.change_package_name(game, sdk, subChannel, config)
  34. package_utils.change_app_name(game, sdk, subChannel, config)
  35. package_utils.change_app_icon(game, sdk, subChannel, config)
  36. package_utils.add_launcher(game, sdk, subChannel, config)
  37. package_utils.pack_jar(game, sdk, subChannel, config)
  38. package_utils.do_sdk_post_script(game, sdk, config)
  39. package_utils.do_game_post_script(game, sdk, config)
  40. package_utils.generateNewRFile(game, sdk, subChannel, config)
  41. package_utils.split_dex(game, sdk, subChannel, config)
  42. package_utils.recomplie(game, sdk, subChannel, config)
  43. package_utils.alignApk(game, sdk, subChannel, config)
  44. package_utils.apk_signer_apk(game, sdk, subChannel, config)
  45. package_utils.clearTemp(game, sdk, subChannel, config)
  46. def getCmd(cmd):
  47. p = os.popen(cmd)
  48. content = p.read()
  49. # print(content)
  50. return content
  51. def getItemConfig(config, subChannel):
  52. if type(config) == dict:
  53. if subChannel is None or config['subChannel'] == subChannel:
  54. return config
  55. elif type(config) == list:
  56. for itemConfig in config:
  57. if subChannel is None or itemConfig['subChannel'] == subChannel:
  58. return subChannel
  59. return None
  60. packTest()