From 595df075ed3cf882ee8bb2f0a62ea797ec543386 Mon Sep 17 00:00:00 2001 From: gaoxin Date: Mon, 31 May 2021 20:24:15 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=B7=A5=E5=85=B7=E3=80=91=E6=89=93?= =?UTF-8?q?=E5=8C=85=E5=B7=A5=E5=85=B7=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Editor/AutoPack.cs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Assets/Editor/AutoPack.cs b/Assets/Editor/AutoPack.cs index 16eb83ccd1..3e0e15ab07 100644 --- a/Assets/Editor/AutoPack.cs +++ b/Assets/Editor/AutoPack.cs @@ -253,8 +253,11 @@ public class AutoPack : EditorWindow Debug.Log(PackConfig[index][0] + ":母包工程资源替换完成"); // 替换build-id + + EditorUtility.DisplayProgressBar("重写AndroidManifest", "", 1f); RewriteManifest(fromPath + "/src/main/AndroidManifest.xml", toPath + "/src/main/AndroidManifest.xml"); Debug.Log(PackConfig[index][0] + ":母包Manifest修改完成"); + EditorUtility.ClearProgressBar(); } private static void RewriteManifest(string f, string t) { @@ -310,18 +313,39 @@ public class AutoPack : EditorWindow // 替换配置文件 private static void ReplaceConfigAndVersion(int index) { + EditorUtility.DisplayProgressBar("替换配置文件", "", 1f); string toPath = _MomPackPath + PackConfig[index][2] + "/src/main/assets/Android/"; string fromPath = _MomPackPath + PackConfig[index][2] + "/Config/"; File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true); File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true); Debug.Log(PackConfig[index][0]+":配置文件替换完成"); + EditorUtility.ClearProgressBar(); } // 开始生成apk private static void StartGradleBuild(int index) { - GameEditor.Util.ProcessUtil.ProcessCommand(_MomPackPath + PackConfig[index][2], "gradlew assembleDebug"); + EditorUtility.DisplayProgressBar("正在生成APK", "", 1f); + string apkPath = _MomPackPath + PackConfig[index][2] + "/APK/"; + if (!Directory.Exists(apkPath)) + { + Directory.CreateDirectory(apkPath); + } + string time = DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss"); + if (!Directory.Exists(apkPath + time)) + { + Directory.CreateDirectory(apkPath + time); + } + GameEditor.Util.ProcessUtil.ProcessCommand(_MomPackPath + PackConfig[index][2], "gradlew assembleRelease>" + apkPath + time +"/_log.txt"); + + EditorUtility.DisplayProgressBar("正在导出APK", "", 1f); + string apkFilePath = _MomPackPath + PackConfig[index][2] + "/build/outputs/apk/release/" + PackConfig[index][2] + "-release.apk"; + if (File.Exists(apkFilePath)) + { + File.Copy(apkFilePath, apkPath + time + "/" + PackConfig[index][2] + ".apk"); + } Debug.Log(PackConfig[index][0] + ":打包完成"); + EditorUtility.ClearProgressBar(); } //private static void ExportXcode(string _sceneName)