Exemple #1
0
def createNewProj(file_recorder, tmp_files):
    srcDir = os.path.join(m_projectDir, "../%s.xcodeproj" % m_projectName)
    dstDir = os.path.join(m_projectDir, "../%s.xcodeproj" % m_newProjName)
    FileUtils.copyDirctory(srcDir, dstDir)

    tmp_files.append(dstDir)

    # # 拷贝配置文件
    # srcFile = os.path.join(m_projectDir, "WeiLeProjV3-mobile.entitlements")
    # Common.assertExit(os.path.isfile(srcFile), "文件 %s 不存在" % srcFile)
    # dstFile = os.path.join(m_projectDir, "%s-mobile.entitlements" % m_newProjName)
    # FileUtils.copyFile(srcFile, dstFile)
    # tmp_files.append(dstFile)

    # 修改工程名字
    projFilePath = getProjectConfigPath()
    Sed.replaceContent(m_projectName, m_newProjName, projFilePath)

    # 移除临时文件
    for item in os.listdir(dstDir):
        full_path = os.path.join(dstDir, item)
        if full_path == projFilePath:
            continue

        if os.path.isdir(full_path):
            FileUtils.removeDirectory(full_path)
        elif os.path.isfile(full_path):
            FileUtils.removeFile(full_path)
Exemple #2
0
def deleteGamesDir():
    gamesDir = os.path.join(m_appPath, "games")
    if not os.path.isdir(gamesDir):
        return

    gamesDirConfig = m_jsonObj[kGames]
    _, names = FileUtils.getDirectorysFromDirectory(gamesDir)
    for name in names:
        if not (name in gamesDirConfig):
            deletePath = os.path.join(gamesDir, name)
            FileUtils.removeDirectory(deletePath)
Exemple #3
0
        # 修改Bundle Id
        modifyBundleId()

        # 清理目标工程
        cleanTarget()

        # 更新exportOptionsPlist配置
        refreshExportOptionsPlist(file_recorder)

        # 编译工程
        buildTarget()

        # 打成ipa包
        createIPA()
    except:
        pass
    finally:
        # file_recorder.do_rollback()

        for item in tmp_files:
            if os.path.isfile(item):
                FileUtils.removeFile(item)
            elif os.path.isdir(item):
                FileUtils.removeDirectory(item)
            else:
                print("%s 不是文件/文件夹,删除失败" % item)

        # output the spend time
        end_time = time.time()
        print('\n总共用时: %.2f 秒\n' % (end_time - begin_time))