def getNativeBuildParam(workPath , customerMark):
    buildParam = BUILD_PARAM
    customerConfig = customerConfigUtils.getCustomerConfig(customerMark)
    buildParam = addBuildParam(buildParam, 'title=' + customerConfig['apkName'])
    keyStorePath = os.path.abspath(os.path.join(workPath ,   KEY_STORE_PATH))
    buildParam = addBuildParam(buildParam, 'keystorePath='+ keyStorePath)
    return buildParam
Beispiel #2
0
def deleteOtherCustomersAsset(customerMark):
    customerConfig = customerConfigUtils.getCustomerConfig(customerMark)
    tree = os.path.join(WORKSPACE_ASSETS, 'CustomMade')
    for dirName in os.listdir(tree):
        realDir = os.path.join(tree, dirName)
        if os.path.isdir(realDir) and customerMark != dirName:
            if dirName != customerConfig['dependRes']:
                shutil.rmtree(realDir)
Beispiel #3
0
def deleteWorkSpaceOtherCustomerAssets(customerMark):
    customerConfig = customerConfigUtils.getCustomerConfig(customerMark)
    tree = os.path.join(WORKSPACE_ASSETS, 'CustomMade')
    for dirName in os.listdir(tree):
        realDir = os.path.join(tree, dirName)
        if os.path.isdir(realDir) and customerMark != dirName:
            if dirName != customerConfig['dependRes']:
                shutil.rmtree(realDir)

    tree2 = os.path.join(WORKSPACE_ASSETS, 'resources/CustomMade')
    if os.path.exists(tree2):
        for dirName in os.listdir(tree2):
            realDir = os.path.join(tree2, dirName)
            if os.path.isdir(realDir) and customerMark != dirName:
                if dirName != customerConfig['dependRes']:
                    shutil.rmtree(realDir)
def modifyHallHot(sourceUrl):
    sourceZip = sourceUrl + "/" + versionControlUtil.HOT_FOLDER_PREFIX + customerMark + "-zip/all.zip"
    urllib.urlretrieve(sourceZip, "all.zip")
    z = zipfile.ZipFile('all.zip', 'r')
    if os.path.exists("build/jsb-link"):
        shutil.rmtree("build/jsb-link")
    os.makedirs("build/jsb-link")
    z.extractall(r"build/jsb-link")
    z.close()
    #修改customer_config
    find = False
    for root, dirs, files in os.walk("build/jsb-link/res/import"):
        for file in files:
            path = os.path.join(root, file)
            if file.find(".json") != -1:
                dic = json.load(open(path))
                if isinstance(dic, dict) and dic.get('json') and isinstance(dic['json'], dict) and dic['json'].get('HTTP_BASE_URL')\
                and dic['json'].get('WEBSOCKET_BASE_URL') and dic['json'].get('DOWNLOAD_URL_YFB'):
                    customerConfig = customerConfigUtils.getCustomerConfig(
                        customerMark)
                    dic['json']['HTTP_BASE_URL'] = customerConfig[
                        'HTTP_BASE_URL']
                    dic['json']['WEBSOCKET_BASE_URL'] = customerConfig[
                        'WEBSOCKET_BASE_URL']
                    dic['json']['openinstallKey'] = customerConfig[
                        'openinstallKey']
                    dic['json']['DOWNLOAD_URL'] = customerConfig[
                        'DOWNLOAD_URL']
                    dic['json']['bigVersion'] = customerConfig['bigVersion']
                    dic['json']['stationMark'] = customerConfig['stationMark']
                    dic['json']['wechatID'] = customerConfig['wechatID']
                    with open(path, 'w') as f:
                        f.writelines(json.dumps(dic))
                    find = True
                    break
        if find:
            break
    os.remove('build/jsb-link/project-tmp.manifest')
    afterBuildUtils.dealHallHotAssets(customerMark)
     os.path.join(os.getcwd(), "deleteUnuseAssets"))
 workSpace = os.path.abspath(os.path.join(os.getcwd(), "../.."))
 sourceUrl = os.environ.get('sourceUrl')
 #切换到工作目录
 os.chdir(workSpace)
 #拉取CustomerUI
 if customerMark != None and sourceUrl == None:
     if os.path.exists("assets/resources/CustomerUI"):
         if os.path.exists(".git"):
             os.system("git clean -f -fdx assets/resources/CustomerUI")
         elif os.path.exists("../.git"):
             os.chdir("..")
             os.system(
                 "git clean -f -fdx FuGou/assets/resources/CustomerUI")
             os.chdir(workSpace)
     customerConfig = customerConfigUtils.getCustomerConfig(customerMark)
     if not customerConfig['skinGit'] or not customerConfig['skinGitBranch']:
         raise Exception("皮肤所用git没有配置,customerConfig['skinGit']")
     os.system("git clone " + customerConfig['skinGit'] +
               " assets/resources/CustomerUI " + "--branch " +
               customerConfig['skinGitBranch'])
 #更新子模块
 if os.environ.get("PACKAGE_BRANCH") != None and sourceUrl == None:
     list = []
     for root, dirs, files in os.walk(workSpace):
         # root 表示当前正在访问的文件夹路径
         # dirs 表示该文件夹下的子目录名list
         # files 表示该文件夹下的文件list
         # 遍历所有的文件夹
         for d in dirs:
             gitPath = os.path.join(root, d, ".git")
def dealiOSProject(dir, customerMark):
    customerConfigUtils.CUSTOMER_CONFIG_PATH = "../customer_config"
    customerConfig = customerConfigUtils.getCustomerConfig(customerMark)
    #先同步样例工程的Info.plist,niuniu1031-mobile.entitlements
    infofile = os.path.join(
        dir, 'frameworks/runtime-src/proj.ios_mac/ios/Info.plist')
    entitlementsFile = os.path.join(
        dir,
        'frameworks/runtime-src/proj.ios_mac/niuniu1031-mobile.entitlements')
    os.system(
        "rsync -t ~/originProj/huihuang/frameworks/runtime-src/proj.ios_mac/ios/Info.plist "
        + infofile)
    os.system(
        "rsync -t ~/originProj/huihuang/frameworks/runtime-src/proj.ios_mac/niuniu1031-mobile.entitlements "
        + entitlementsFile)
    with open(infofile, "r") as f:
        infoData = plistlib.readPlist(f)
    #0.修改appName
    infoData['CFBundleDisplayName'] = customerConfig['appName']
    #1.修改buldleID
    if not customerConfig.has_key('iosBundleID'):
        raise Exception('error when get iosBundleID from customer_config:' +
                        customerMark)
    pxfile = os.path.join(
        dir,
        'frameworks/runtime-src/proj.ios_mac/huihuang.xcodeproj/project.pbxproj'
    )
    with open(pxfile) as f:
        pxData = f.read()
    pxData = re.sub(
        r'PRODUCT_BUNDLE_IDENTIFIER = [^;]*\.GeTui;',
        'PRODUCT_BUNDLE_IDENTIFIER = ' + customerConfig['iosBundleID'] +
        '.GeTui;', pxData)
    pxData = re.sub(
        r'PRODUCT_BUNDLE_IDENTIFIER = [^;]*(?<!GeTui);',
        'PRODUCT_BUNDLE_IDENTIFIER = ' + customerConfig['iosBundleID'] + ';',
        pxData)
    with open(pxfile, 'w') as f:
        f.write(pxData)
    #2.修改OpenInstall,3个地方
    with open(entitlementsFile, "r") as f:
        entitleData = plistlib.readPlist(f)
    if not customerConfig.has_key('openinstallKey'):
        raise Exception('error when get openinstallKey from customer_config:' +
                        customerMark)
    entitleData['com.apple.developer.associated-domains'][
        0] = "applinks:" + customerConfig['openinstallKey'] + ".openinstall.io"
    for item in infoData['CFBundleURLTypes']:
        if item["CFBundleURLName"] == "openinstall":
            item['CFBundleURLSchemes'][0] = customerConfig['openinstallKey']
            break
    infoData['com.openinstall.APP_KEY'] = customerConfig['openinstallKey']
    with open(entitlementsFile, "w") as f:
        plistlib.writePlist(entitleData, f)
    #3.填写wechatID
    for item in infoData['CFBundleURLTypes']:
        if item["CFBundleURLName"] == "weixin":
            if customerConfig.has_key('wechatID'):
                item['CFBundleURLSchemes'][0] = customerConfig['wechatID']
            else:
                item['CFBundleURLSchemes'][0] = ""
            break
    with open(infofile, "w") as f:
        plistlib.writePlist(infoData, f)
    #4.修改个推id
    pushInfoFile = os.path.join(
        dir, 'frameworks/runtime-src/proj.ios_mac/pushNotification/Info.plist')
    with open(pushInfoFile, "r") as f:
        pushData = plistlib.readPlist(f)
    pushData['CFBundleIdentifier'] = customerConfig['iosBundleID'] + ".GeTui"
    with open(pushInfoFile, "w") as f:
        plistlib.writePlist(pushData, f)
    AppControllerFile = os.path.join(
        dir, 'frameworks/runtime-src/proj.ios_mac/AppController.h')
    controllerData = ''
    with io.open(AppControllerFile, 'r', encoding="utf-8") as f:
        for line in f.readlines():
            line = re.sub(r'(#define\s+kGtAppId\s+@")[^"]*',
                          r'\g<1>' + customerConfig["GETUI_APP_ID"], line)
            line = re.sub(r'(#define\s+kGtAppKey\s+@")[^"]*',
                          r'\g<1>' + customerConfig["GETUI_APP_KEY"], line)
            line = re.sub(r'(#define\s+kGtAppSecret\s+@")[^"]*',
                          r'\g<1>' + customerConfig["GETUI_APP_SECRET"], line)
            controllerData += line
    with io.open(AppControllerFile, 'w', encoding="utf-8") as f:
        f.write(controllerData)
def getCustomerDefaultVersion(customerMark):
    customerConfig = customerConfigUtils.getCustomerConfig(customerMark)
    bigVersion = customerConfig['bigVersion']
    return getDefaultVersion(bigVersion)
def getCustomerCurrentVersion(customerMark):
    customerConfig = customerConfigUtils.getCustomerConfig(customerMark)
    bigVersion = customerConfig['bigVersion']
    return getHotVersion(bigVersion)
Beispiel #9
0
def copyCustomerConfigFile(customerMark):
    customerConfigPath = 'assets/CustomMade/customer_config.json'
    customerConfig = customerConfigUtils.getCustomerConfig(customerMark)
    jsonFileUtils.saveJsonDataToFile(customerConfigPath, customerConfig)