Exemple #1
0
def modifyTrackID(file_recorder):
    curDir = FileUtils.getScriptDirectory()
    filepath = os.path.join(
        curDir,
        "../../frameworks/runtime-src/proj.ios_mac/ios/AppController.mm")
    file_recorder.record_file(filepath)

    target_str = r'trackingAppKey = @\"%s\"' % m_jsonObj["track_id"]
    Sed.replaceContent(r'trackingAppKey = @\".*\"', target_str, filepath)
Exemple #2
0
def getExportOptionsPlist():
    optionsDic = {
        Archive_Type_Key_AdHoc: "certificate/AdHocExportOptionsPlist.plist",
        Archive_Type_Key_AppStore:
        "certificate/AppStoreExportOptionsPlist.plist",
    }

    plistName = optionsDic[m_archiveType]
    curDir = FileUtils.getScriptDirectory()
    return os.path.join(curDir, plistName)
Exemple #3
0
def modifyCocosMacros(file_recorder):
    curDir = FileUtils.getScriptDirectory()
    filepath = os.path.join(
        curDir, "../../frameworks/cocos2d-x/cocos/platform/CCPlatformMacros.h")
    file_recorder.record_file(filepath)

    cur_time_str = datetime.datetime.fromtimestamp(
        time.time()).strftime('%Y%m%d_%H%M%S')
    md5Hash = hashlib.md5(m_jsonObj["pkg_name"] + cur_time_str)
    md5Hashed = md5Hash.hexdigest()

    Sed.replaceContent("#define UINQUEID MYUINQUEID",
                       "#define UINQUEID " + md5Hashed, filepath)
Exemple #4
0
def modifyGetuiId(file_recorder):
    curDir = FileUtils.getScriptDirectory()
    filepath = os.path.join(
        curDir,
        "../../frameworks/runtime-src/proj.ios_mac/ios/AppController.mm")
    # file_recorder.record_file(filepath)

    target_str = r'getuiAppId = @\"%s\"' % m_jsonObj["getui_appId"]
    Sed.replaceContent(r'getuiAppId = @\".*\"', target_str, filepath)
    target_str = r'getuiAppKey = @\"%s\"' % m_jsonObj["getui_appKey"]
    Sed.replaceContent(r'getuiAppKey = @\".*\"', target_str, filepath)
    target_str = r'getuiAppSecret = @\"%s\"' % m_jsonObj["getui_appSecret"]
    Sed.replaceContent(r'getuiAppSecret = @\".*\"', target_str, filepath)
Exemple #5
0
def addH5PaySupport(file_recorder):
    curDir = FileUtils.getScriptDirectory()

    # 修改代码
    codePath = os.path.join(
        curDir,
        "../../frameworks/runtime-src/proj.ios_mac/ios/sdks/SdkManager.mm")
    file_recorder.record_file(codePath)

    f = open(codePath)
    content = f.read()
    f.close()
    content = content.replace('//#import "JXPApi.h"', '#import "JXPApi.h"')
    content = content.replace('// [JXPApi PApiRequestURL',
                              '[JXPApi PApiRequestURL')
    f = open(codePath, 'w')
    f.write(content)
    f.close()

    # 修改 xcode 工程
    projPath = getProjectConfigPath()
    file_recorder.record_file(projPath)

    sys.path.append(os.path.join(os.path.dirname(__file__), 'obscure'))
    from modify_pbxproj import XcodeProject
    pbx_obj = XcodeProject.Load(projPath)
    h5Folder = os.path.join(
        curDir, "../../frameworks/runtime-src/proj.ios_mac/ios/sdks/h5")

    iosGroup = pbx_obj.get_or_create_group('ios')
    sdkGroup = pbx_obj.get_or_create_group('sdks', parent=iosGroup)
    h5Group = pbx_obj.get_or_create_group('h5', parent=sdkGroup)

    for f in os.listdir(h5Folder):
        fullPath = os.path.join(h5Folder, f)
        name, ext = os.path.splitext(fullPath)
        if ext == '.h' or ext == '.a':
            pbx_obj.add_file_if_doesnt_exist(fullPath,
                                             parent=h5Group,
                                             target='%s-mobile' %
                                             m_newProjName)

    if pbx_obj.modified:
        pbx_obj.save()
Exemple #6
0
# -*- coding: UTF-8 -*-
#!/usr/bin/python
#coding:utf-8
import os
import sys

sys.path.append('../')
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from python_libs.FileUtils import FileUtils

if __name__ == "__main__":
    pythonDir = FileUtils.getAbsolutePath("..")
    pythonPath = os.path.join(pythonDir, "main.py")

    configDir = FileUtils.getScriptDirectory()
    configPath = os.path.join(configDir, "config.json")
    cmd = "python " + pythonPath + " " + configPath

    os.system(cmd)