sdk_script.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import file_utils
  2. import common_utils
  3. import os.path
  4. def execute(game, sdk, config):
  5. if not checkConfig(config):
  6. return 1
  7. subChannel = config['subChannel']
  8. createJmhyProperties(game, sdk, subChannel, config)
  9. common_utils.changeApplication(game, sdk, subChannel, config, 'com.ejyx.common.EJYXApplication')
  10. return 0
  11. def checkConfig(config):
  12. '''
  13. 检查配置
  14. '''
  15. if 'properties' not in config:
  16. print('properties not exists in config')
  17. return False
  18. properties = config['properties']
  19. if 'agent' not in properties or 'version' not in properties:
  20. print('agent or version not exists in properties')
  21. return False
  22. '''if 'appid' not in config or 'appkey' not in config:
  23. print('appid or appkey not exists in config')
  24. return False'''
  25. return True
  26. def createJmhyProperties(game, sdk, subChannel, config):
  27. '''
  28. 创建jmhy.properties
  29. '''
  30. print('创建 ejyx.properties ......')
  31. decompliePath = file_utils.getDecompliePath(game, sdk, subChannel, config['cache'])
  32. properties = os.path.join(decompliePath, 'assets', 'ejyx.properties')
  33. content = 'version = 1.1\n'
  34. content = '%s%s = %s\n' % (content, 'agent', config['channel_id'])
  35. file_utils.createFile(properties, content)
  36. return 0