Example #1
0
        /// <summary>
        /// 删除硬链接目录
        /// </summary>
        /// <param name="linkPath"></param>
        public static void DeleteLink(string linkPath)
        {
            var os = Environment.OSVersion;

            if (os.ToString().Contains("Windows"))
            {
                KTool.ExecuteCommand(String.Format("rmdir \"{0}\"", linkPath));
            }
            else if (os.ToString().Contains("Unix"))
            {
                KTool.ExecuteCommand(String.Format("rm -Rf \"{0}\"", linkPath));
            }
            else
            {
                Debug.LogError(String.Format("[SymbolLinkFolder]Error on OS: {0}", os.ToString()));
            }
        }
Example #2
0
        public static void SymbolLinkFolder(string srcFolderPath, string targetPath)
        {
            var os = Environment.OSVersion;

            if (os.ToString().Contains("Windows"))
            {
                KTool.ExecuteCommand(String.Format("mklink /J \"{0}\" \"{1}\"", targetPath, srcFolderPath));
            }
            else if (os.ToString().Contains("Unix"))
            {
                var fullPath = Path.GetFullPath(targetPath);
                if (fullPath.EndsWith("/"))
                {
                    fullPath = fullPath.Substring(0, fullPath.Length - 1);
                    fullPath = Path.GetDirectoryName(fullPath);
                }
                KTool.ExecuteCommand(String.Format("ln -s {0} {1}", Path.GetFullPath(srcFolderPath), fullPath));
            }
            else
            {
                Debug.LogError(String.Format("[SymbolLinkFolder]Error on OS: {0}", os.ToString()));
            }
        }
Example #3
0
    void DrawBuildUI()
    {
        GUILayout.BeginHorizontal("HelpBox");
        EditorGUILayout.LabelField("== 生成安装包 ==");
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("打开安装包目录", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20)))
        {
            var path = AppConfig.ProductRelPath + "/Apps/" + KResourceModule.GetBuildPlatformName();
            OpenFolder(path, true);
        }
        if (GUILayout.Button("生成Version.txt", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20)))
        {
            string batPath = null;
            if (!File.Exists(AppConfig.VersionTextPath))
            {
                var platform = KResourceModule.GetBuildPlatformName();
                //执行bat
                batPath = $"{AppConfig.BuildScriptPath}/生成filelist-{platform}.bat";
                KTool.ExecuteCommand(batPath);
                //ps.执行py传的参数有些错误,所以通过cmd来执行py
                // var abPath = KResourceModule.EditorProductFullPath+"/Bundles/"+platform;
                // BuildTools.ExecutePyFile(pyPath + "/gen_filelist.py",$"{pyPath} {abPath} {platform}");
            }
            if (!File.Exists(AppConfig.VersionTextPath))
            {
                Log.LogError($"未找到{AppConfig.VersionTextPath},请查看报错信息或手动执行脚本{batPath}");
                return;
            }
            var dstPath = KResourceModule.AppDataPath + AppConfig.VersionTxtName;
            if (File.Exists(dstPath))
            {
                File.Delete(dstPath);
            }
            File.Copy(AppConfig.VersionTextPath, dstPath);
            Log.Info($"文件拷贝成功,{AppConfig.VersionTextPath}->{dstPath}");
        }
        if (GUILayout.Button("打包脚本目录", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20)))
        {
            OpenFolder(AppConfig.BuildScriptPath, true);
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("打PC版", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20)))
        {
            KAutoBuilder.PerformWinReleaseBuild();
        }

        if (GUILayout.Button("打PC版-Dev", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20)))
        {
            KAutoBuilder.PerformWinBuild();
        }
        if (GUILayout.Button("打PC版-IL2CPP", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20)))
        {
            KAutoBuilder.PerformWinIL2CPPBuild();
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("打Android版", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20)))
        {
            KAutoBuilder.PerformAndroidBuild();
        }
        if (GUILayout.Button("Android-IL2CPP", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20)))
        {
            KAutoBuilder.PerformAndroidIL2CPPBuild();
        }
        if (GUILayout.Button("打IOS版", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20)))
        {
            KAutoBuilder.PerformiOSBuild();
        }
        GUILayout.EndHorizontal();
    }
Example #4
0
    void DrawBuildUI()
    {
        GUILayout.BeginHorizontal("HelpBox");
        EditorGUILayout.LabelField("== 生成安装包 ==");
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("打开安装包目录", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20)))
        {
            var path = AppConfig.ProductRelPath + "/Apps/" + KResourceModule.GetBuildPlatformName();
            OpenFolder(path);
        }
        if (GUILayout.Button("下载更新调试", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20)))
        {
            if (!File.Exists(AppConfig.VersionTextPath))
            {
                var pyPath   = Path.GetDirectoryName(Path.GetFullPath(Application.dataPath + "/../../build_tools/"));
                var platform = KResourceModule.GetBuildPlatformName();
                //执行bat
                var path = $"{pyPath}/生成filelist-{platform}.bat";
                KTool.ExecuteCommand(path);
                //执行py传的参数有些错误
                // var abPath = KResourceModule.ProductPathWithoutFileProtocol+"/Bundles/"+platform;
                // BuildTools.ExecutePyFile(pyPath + "/gen_filelist.py",$"{pyPath} {abPath} {platform}");
            }
            if (!File.Exists(AppConfig.VersionTextPath))
            {
                Log.LogError($"未生成filelist,请再试一次或手动执行py脚本");
                return;
            }
            var dstPath = KResourceModule.AppDataPath + AppConfig.VersionTxtName;
            if (File.Exists(dstPath))
            {
                File.Delete(dstPath);
            }
            File.Copy(AppConfig.VersionTextPath, dstPath);
            Log.Info($"文件拷贝成功,{AppConfig.VersionTextPath}->{dstPath}");
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("打PC版", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20)))
        {
            KAutoBuilder.PerformWinReleaseBuild();
        }

        if (GUILayout.Button("打PC版-Dev", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20)))
        {
            KAutoBuilder.PerformWinBuild();
        }

        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("打Android版", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20)))
        {
            KAutoBuilder.PerformAndroidBuild();
        }

        if (GUILayout.Button("打IOS版", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20)))
        {
            KAutoBuilder.PerformiOSBuild();
        }

        GUILayout.EndHorizontal();


        GUILayout.BeginHorizontal();


        GUILayout.EndHorizontal();
    }