示例#1
0
def ScanDir(sourceDir, channel, dir2):
    for file in os.listdir(sourceDir):
        sourceFile = os.path.join(sourceDir, file)
        if os.path.isdir(sourceFile):
            # python 里无法直接执行cd目录,想要用chdir改变当前的工作目录
            if common.isWindowsSystem():
                os.chdir(sourceFile + "/cmd_win")
                os.system("echo.| copy_cmd.bat")
            else:
                dirapp = dir2 + "/" + file + "/cmd_mac"
                if common.IsVMWare():
                    dirapp = "/Volumes/VMware\\ Shared\\ Folders/" + dir2 + "/" + file + "/cmd_mac"
                    # os.system("cd /Volumes/VMware\\ Shared\\ Folders")

                    # cmdPath="/Volumes/VMware Shared Folders/"+cmdPath

                    os.system("cd " + dirapp)
                else:
                    os.chdir(dirapp)

                os.system("sh " + "./copy_cmd")
                # os.system("sh "+dirapp+"/build_all_ios")

            print(file)
            # update_appname build_huawei

            if channel == "huawei":
                os.system("echo.| call build_huawei.bat")
            if channel == "gp":
                os.system("echo.| call build_gp.bat")
            if channel == "android":
                os.system("echo.| call build_all_android.bat")
            if channel == "ios":
                if common.isWindowsSystem():
                    os.system("echo.| build_all_ios.bat")
                    # else:
                    # os.system("build_all_ios")
                    # os.system("cd "+dirapp)
                    os.system("sh " + "./build_all_ios")

            if channel == "ios_copy_cmd":
                print("ios_copy_cmd")
def buildApk():
    if common.isWindowsSystem():
        # dir1 = "C:\Program Files\Android\Android Studio\gradle"
        dir2 = "C:/moon/gradle/gradle-4.10.1"
        flag = os.path.exists(dir2)
        if not flag:
            # shutil.copytree(dir1,dir2)
            dir2 = "E:/Program Files/Android/Android Studio/gradle/gradle-4.10.1"
            flag = os.path.exists(dir2)
            if not flag:
                # aliyun
                dir2 = "C:/Program Files/Unity/Hub/Editor/" + source.UNITY_VERSION + "/Editor/Data/PlaybackEngines/AndroidPlayer/Tools/gradle"

        os.system(dir2 + "/bin/gradle assembleRelease")
    else:
        dir2 = "/Users/moon/sourcecode/gradle/gradle-4.10.1/bin"
        flag = os.path.exists(dir2)
        if flag:
            # os.system("chmod 777 "+dir2+"/gradle")
            os.system(dir2 + "/gradle assembleRelease")
        else:
            os.system("gradle assembleRelease")
    common.SetCmdPath(cmdPath)
    gameName = common.getGameName()
    gameType = common.getGameType()

    print(gameType)
    print(gameName)

    isHD = False
    if count > 2:
        argvHD = sys.argv[2]
        if argvHD == "hd":
            isHD = True
    strFile = "app.itmsp"
    if isHD:
        strFile = "app_pad.itmsp"

    if common.isWindowsSystem():
        strCmd = " "
    else:
        if ipa_build.IsXcode10():
            strCmd = "/Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/itms/bin/iTMSTransporter -m upload -u " + source.APPSTORE_USER + " -p " + source.APPSTORE_PASSWORD + "  -v eXtreme -f " + common.GetProjectConfigApp(
            ) + "/appstore/ios/" + strFile
        else:
            #xcode 11: 手动更新Transporter组件(java)方法: https://www.lagou.com/lgeduarticle/94642.html
            strCmd = "/Applications/Transporter.app/Contents/itms/bin/iTMSTransporter -m upload -u " + source.APPSTORE_USER + " -p " + source.APPSTORE_PASSWORD + "  -v eXtreme -f " + common.GetProjectConfigApp(
            ) + "/appstore/ios/" + strFile
    os.system(strCmd)

    print("appstore_upload_ios sucess")