예제 #1
0
def main():
    parser = gen_parser()
    args = parser.parse_args()

    copyFile = args.FileOrDir

    if os.path.isdir(args.FileOrDir):
        if args.SubName is None:
            sys.stderr.write("main find file in dir,but no SubName\n\n")
            sys.exit(1)

        file = find_file(args.FileOrDir, args.SubName)
        if file == "":
            sys.stderr.write("main not find file %s in %s \n\n" %
                             (args.SubName, args.FileOrDir))
            sys.exit(1)
        else:
            copyFile = file

    if not os.path.isfile(copyFile):
        sys.stderr.write("main not file %s\n\n" % copyFile)
        sys.exit(1)

    if os.path.isfile(args.TargetDir):
        sys.stderr.write("main Target Dir is file %s\n\n" % args.TargetDir)
        sys.exit(1)

    isOK, error = copy_file(args.TargetDir, copyFile)
    if not isOK:
        sys.stderr.write("main copy file error : %s \n\n" % error)
        sys.exit(1)
예제 #2
0
def main():
    parser = gen_parser()
    args = parser.parse_args()

    if not os.path.isdir(args.TargetDir):
        sys.stderr.write("main NoExist TargetDir: %s \n\n" % args.TargetDir)
        sys.exit(1)

    if args.BuildTarget.lower() == "android":
        fileExt = ".apk"
    elif args.BuildTarget.lower() == "ios":
        fileExt = ".ipa"
    else:
        sys.stderr.write("main error BuildTarget: %s \n\n" % args.BuildTarget)
        sys.exit(1)

    packagePath = find_file(args.TargetDir, fileExt)
    if packagePath == "":
        sys.stderr.write("main not package file in dir: %s \n\n" %
                         args.TargetDir)
        sys.exit(1)

    tokenCmd = "--token=" + args.Token
    changelog = "--changelog=" + args.Note
    command = ["fir", "publish", tokenCmd, packagePath, changelog]
    print("Final Command:", command, "\n\n")

    isOK, error = do_command(command)

    if not isOK:
        sys.stderr.write("main Upload Fir error: %s \n\n" % error)
        sys.exit(1)
예제 #3
0
def main():
    parser = gen_parser()
    args = parser.parse_args()

    if not os.path.isdir(args.BuildDir):
        sys.stderr.write("main not a dir: %s \n\n" % args.BuildDir)
        sys.exit(1)

    ipaPath = find_file(args.BuildDir, ".ipa")
    if ipaPath == "":
        sys.stderr.write("main no ipa in dir: %s \n\n" % args.BuildDir)
        sys.exit(1)

    version = get_split_part(ipaPath, 1)
    if version == "":
        sys.stderr.write("main not a ipa: %s \n\n" % ipaPath)
        sys.exit(1)

    savePath = args.SaveTemplate % version

    # Xcode新版本插件会打包符号文件到输出目录,不用压缩了
    if os.path.isfile(savePath):
        sys.exit(0)

    symPath = args.SymRoot
    if not os.path.isdir(args.SymRoot):
        sys.stderr.write("main SymRoot is not dir: %s \n\n" % args.SymRoot)
        sys.exit(1)

    else:
        endStr = ".app.dSYM"
        if not args.SymRoot.endswith(endStr):
            findDir = find_dir(args.SymRoot, endStr)
            if findDir == "":
                sys.stderr.write("main no dSYM in dir: %s \n\n" % args.SymRoot)
                sys.exit(1)
            else:
                symPath = findDir

    command = ["ditto", "-c", "-k", "--keepParent", "-rsrc", symPath, savePath]

    print("Final Command:", command, "\n\n")
    isOK, error = do_command(command)

    if not isOK:
        sys.stderr.write("main zip dSYM error: %s \n\n" % error)
        sys.exit(1)
예제 #4
0
def main():
    parser = gen_parser()
    args = parser.parse_args()

    if not os.path.isdir(args.SymDir):
        sys.stderr.write("main NoExist SymDir: %s \n\n" % args.SymDir)
        sys.exit(1)

    symZip = find_file(args.SymDir, ".symbols.zip")
    if symZip == "":
        sys.stderr.write("main NoExist SymFile in Dir: %s \n\n" % args.SymDir)
        sys.exit(1)

    version = get_split_part(symZip, 1)
    if version == "":
        sys.stderr.write("main not a symFile: %s \n\n" % symZip)
        sys.exit(1)

    extractRoot = args.SymDir + "/temp"
    remove_dir(extractRoot)

    zip = zipfile.ZipFile(symZip, 'r')

    extractFiles = ["libunity.sym.so", "libil2cpp.sym"]
    for name in zip.namelist():
        for extractFile in extractFiles:
            if name.endswith(extractFile):
                zip.extract(name, extractRoot)

    zip.close()

    command = [
        "java", "-jar", args.BuglyToolFile, "-i", extractRoot, "-u", "-id",
        args.AppID, "-key", args.AppKey, "-version", version
    ]

    print("Final Command:", command, "\n\n")
    isOK, error = do_command(command)

    # 清理临时解压文件夹和bugly生成的符号文件
    remove_dir(extractRoot)
    remove_file_container_str(args.SymDir, "buglySymbol_")

    if not isOK:
        sys.stderr.write("main upload bugly error: %s \n\n" % error)
        sys.exit(1)
예제 #5
0
def main():
    parser = gen_parser()
    args = parser.parse_args()

    if not os.path.isdir(args.SymDir):
        sys.stderr.write("main NoExist SymDir: %s \n\n" % args.SymDir)
        sys.exit(1)

    symZip = find_file(args.SymDir, "dSYM.zip")
    if symZip == "":
        sys.stderr.write("main NoExist SymFile in Dir: %s \n\n" % args.SymDir)
        sys.exit(1)

    # jenkins中ipa文件名第1位是版本号, 名字_版号_GitTag_BuildID
    version = get_split_part(symZip, 1)
    if version == "":
        sys.stderr.write("main not a symFile: %s \n\n" % symZip)
        sys.exit(1)

    extractRoot = args.SymDir + "/temp"
    remove_dir(extractRoot)

    zip = zipfile.ZipFile(symZip, 'r')
    zip.extractall(extractRoot)
    zip.close()

    command = [
        "java", "-jar", args.BuglyToolFile, "-i", extractRoot, "-u", "-id",
        args.AppID, "-key", args.AppKey, "-version", version
    ]

    print("Final Command:", command, "\n\n")
    isOK, error = do_command(command)

    # 清理临时解压文件夹和bugly生成的符号文件
    remove_dir(extractRoot)
    remove_file_container_str(args.SymDir, "buglySymbol_")

    if not isOK:
        sys.stderr.write("main upload bugly error: %s \n\n" % error)
        sys.exit(1)