【打包工具】修改生成Apk的包名

dev_chengFeng
gaoxin 2021-09-22 17:07:51 +08:00
parent 042df03091
commit 8d9ac3bb69
1 changed files with 10 additions and 4 deletions

View File

@ -442,7 +442,7 @@ public class AutoPack : EditorWindow
string apkFilePath = _MomPackPath + PackConfig[index].project + "/build/outputs/apk/release/" + PackConfig[index].project + "-release.apk";
if (File.Exists(apkFilePath))
{
File.Copy(apkFilePath, APKPath + "/" + PackConfig[index].name +"_"+ PackConfig[index].project + "_" + versionStr + "_" + PackTime + ".apk");
File.Copy(apkFilePath, APKPath + "/" + PackConfig[index].name +"_" + versionStr + "_" + PackTime + ".apk");
}
Debug.Log(PackConfig[index].name + ":打包完成");
EditorUtility.ClearProgressBar();
@ -454,6 +454,7 @@ public class AutoPack : EditorWindow
string[] lines = File.ReadAllLines(tpath);
string versionCode = "";
string versionName = "";
string applicationId = "";
foreach (string l in lines)
{
string lt = l.Trim();
@ -464,8 +465,13 @@ public class AutoPack : EditorWindow
{
versionName = lt.Split('\'')[1];
}
else if (lt.StartsWith("applicationId"))
{
applicationId = lt.Split('\'')[1];
}
}
return string.Format("{0}({1})", versionName, versionCode);
return string.Format("{0}_{1}({2})", applicationId, versionName, versionCode);
}
private static void GitUpdate(int index)
@ -484,8 +490,8 @@ public class AutoPack : EditorWindow
string[] commands = new string[]{
"echo git add ." + printlog,
"git add ." + printlog,
"echo git commit -m 'AutoPack" + PackConfig[index].name +"_"+ PackConfig[index].project + "_" + versionStr + "_" + PackTime + ".apk'" + printlog,
"git commit -m 'AutoPack" + PackConfig[index].name +"_"+ PackConfig[index].project + "_" + versionStr + "_" + PackTime + ".apk'" + printlog,
"echo git commit -m 'AutoPack" + PackConfig[index].name +"_" + versionStr + "_" + PackTime + ".apk'" + printlog,
"git commit -m 'AutoPack" + PackConfig[index].name +"_" + versionStr + "_" + PackTime + ".apk'" + printlog,
"git push",
};
ProcessUtil.ProcessCommand(_MomPackPath + PackConfig[index].project, commands);