public static void BuildIOS() { //打ab包 BundleEditor.NormalBuild(); BuildSetting buildSetting = GetIOSBuildSetting(); string suffix = SetIOSSetting(buildSetting); //清空生成的文件夹 DeleteDir(m_IOSPath); string name = m_AppName + "_IOS" + suffix + string.Format("_{0:yyyy_MM_dd_HH_mm}", DateTime.Now); string savePath = m_IOSPath + name; //生成可执行程序 BuildPipeline.BuildPlayer(FindEnableEditorrScenes(), savePath, EditorUserBuildSettings.activeBuildTarget, BuildOptions.None); DeleteDir(Application.streamingAssetsPath); WriteBuildName(name); }
public static void BuildAndroid() { //打ab包 BundleEditor.NormalBuild(); PlayerSettings.Android.keystorePass = "******"; PlayerSettings.Android.keyaliasPass = "******"; PlayerSettings.Android.keyaliasName = "android.keystore"; PlayerSettings.Android.keystoreName = Application.dataPath.Replace("/Assets", "") + "/realfram.keystore"; BuildSetting buildSetting = GetAndoridBuildSetting(); string suffix = SetAndroidSetting(buildSetting); //清空生成的文件夹 DeleteDir(m_AndroidPath); string savePath = m_AndroidPath + m_AppName + "_Andorid" + suffix + string.Format("_{0:yyyy_MM_dd_HH_mm}.apk", DateTime.Now); //生成可执行程序 BuildPipeline.BuildPlayer(FindEnableEditorrScenes(), savePath, EditorUserBuildSettings.activeBuildTarget, BuildOptions.None); DeleteDir(Application.streamingAssetsPath); }
/// <summary> /// 根据jenkins的参数读取到buildsetting里 /// </summary> /// <returns></returns> static BuildSetting GetPCBuildSetting() { string[] parameters = Environment.GetCommandLineArgs(); BuildSetting buildSetting = new BuildSetting(); foreach (string str in parameters) { if (str.StartsWith("Version")) { var tempParam = str.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); if (tempParam.Length == 2) { buildSetting.Version = tempParam[1].Trim(); } } else if (str.StartsWith("Build")) { var tempParam = str.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); if (tempParam.Length == 2) { buildSetting.Build = tempParam[1].Trim(); } } else if (str.StartsWith("Name")) { var tempParam = str.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); if (tempParam.Length == 2) { buildSetting.Name = tempParam[1].Trim(); } } else if (str.StartsWith("Debug")) { var tempParam = str.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); if (tempParam.Length == 2) { bool.TryParse(tempParam[1], out buildSetting.Debug); } } } return(buildSetting); }
static string SetIOSSetting(BuildSetting setting) { string suffix = "_"; if (!string.IsNullOrEmpty(setting.Version)) { PlayerSettings.bundleVersion = setting.Version; suffix += setting.Version; } if (!string.IsNullOrEmpty(setting.Build)) { PlayerSettings.iOS.buildNumber = setting.Build; suffix += "_" + setting.Build; } if (!string.IsNullOrEmpty(setting.Name)) { PlayerSettings.productName = setting.Name; //PlayerSettings.applicationIdentifier = "com.TTT." + setting.Name; } if (setting.MulRendering) { PlayerSettings.MTRendering = true; suffix += "_MTR"; } else { PlayerSettings.MTRendering = false; } if (setting.DynamicBatching) { suffix += "_Dynamic"; } else { } return(suffix); }
static BuildSetting GetAndoridBuildSetting() { string[] parameters = Environment.GetCommandLineArgs(); BuildSetting buildSetting = new BuildSetting(); foreach (string str in parameters) { if (str.StartsWith("Place")) { var tempParam = str.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); if (tempParam.Length == 2) { buildSetting.Place = (Place)Enum.Parse(typeof(Place), tempParam[1], true); } } else if (str.StartsWith("Version")) { var tempParam = str.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); if (tempParam.Length == 2) { buildSetting.Version = tempParam[1].Trim(); } } else if (str.StartsWith("Build")) { var tempParam = str.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); if (tempParam.Length == 2) { buildSetting.Build = tempParam[1].Trim(); } } else if (str.StartsWith("Name")) { var tempParam = str.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); if (tempParam.Length == 2) { buildSetting.Name = tempParam[1].Trim(); } } else if (str.StartsWith("Debug")) { var tempParam = str.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); if (tempParam.Length == 2) { bool.TryParse(tempParam[1], out buildSetting.Debug); } } else if (str.StartsWith("MulRendering")) { var tempParam = str.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); if (tempParam.Length == 2) { bool.TryParse(tempParam[1], out buildSetting.MulRendering); } } else if (str.StartsWith("IL2CPP")) { var tempParam = str.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); if (tempParam.Length == 2) { bool.TryParse(tempParam[1], out buildSetting.IL2CPP); } } } return(buildSetting); }