public static string BuildOBB() { try { var tmpfoler = "/tmp/packs"; GeneralUtils.DeleteDirectory(tmpfoler, true); // mko: cleaning up build folder Directory.CreateDirectory(tmpfoler); var version = "1.0"; try { var parts = PlayerSettings.bundleVersion.Split('.'); version = parts[0] + "." + parts[1]; } catch { } // moko: changed to do a debug dump of all builder job info first var date = System.DateTime.Now.ToString("dd/MM/yy HH:mm"); string header = "*******************************************************************************\n"; header += "Building to " + tmpfoler + " @" + date; Debug.Log(header); Debug.Log("Build Setting Parameters:\n" + BuildSettings.ToString()); Debug.Log("Environment Setting Parameters:\n" + EnvironmentUtils.GetEnvirnomentDetails()); var cl = EnvironmentUtils.Get("BUILD_CL", "0"); PlayerSettings.bundleVersion = version + "." + cl; // step1 build all the bundles (extended bundles) var options = Bundler.BundleOptions.Force | Bundler.BundleOptions.Extended | Bundler.BundleOptions.SkipBase; var packs = Bundler.BuildAll(BuildSettings.BundlerConfigFolder, options); var tarPath = Path.Combine(tmpfoler, "packs.tar"); var packPath = BuildSettings.BuildFolder; var gzipPath = tarPath + ".gz"; var filesPath = Path.Combine(packPath, "files.json"); FileUtil.DeleteFileOrDirectory(filesPath); // calculate the files var files = new Hashtable(); foreach (var packFile in Directory.GetFiles(packPath, "*", SearchOption.AllDirectories)) { var relativeName = packFile.Substring(packPath.Length + 1); var finfo = new FileInfo(packFile); files[relativeName] = finfo.Length; } // write to the files.json var fileData = new Hashtable(); fileData["packs"] = packs; fileData["files"] = files; File.WriteAllBytes(filesPath, EB.Encoding.GetBytes(EB.JSON.Stringify(fileData))); // turn into gz, tar archive using (var gzFile = new FileStream(gzipPath, FileMode.Create, FileAccess.ReadWrite)) { using (var gzStream = new Ionic.Zlib.GZipStream(gzFile, Ionic.Zlib.CompressionMode.Compress, Ionic.Zlib.CompressionLevel.BestCompression)) { var writer = new tar_cs.TarWriter(gzStream); foreach (var packFile in Directory.GetFiles(packPath, "*", SearchOption.AllDirectories)) { var relativeName = packFile.Substring(packPath.Length + 1); //Debug.Log("file: " + relativeName); using (var f = new FileStream(packFile, FileMode.Open, FileAccess.Read)) { writer.Write(f, f.Length, relativeName, string.Empty, string.Empty, 511, System.DateTime.UtcNow); } } writer.Close(); } } //var url = S3Utils.Put(gzipPath, Path.Combine(cl,cl+".obb") ); //return url; return(gzipPath); } catch (System.Exception ex) { Debug.Log("BuildOBB Failed: exception: " + ex.ToString()); throw ex; } }
public static void BuildIPA(string distributionList) { try { BuildSettings.IsDevelopmentBuild = _debug; BuildUtils.CleanData(); var folder = BuildSettings.BaseBuildFolder; var platformFolder = BuildSettings.BuildFolder; // moko: changed to do a debug dump of all builder job info first var date = System.DateTime.Now.ToString("dd/MM/yy HH:mm"); string header = "*******************************************************************************\n"; header += "Building to " + folder + " @" + date; EB.Debug.Log(header); EB.Debug.Log("Build Setting Parameters:\n" + BuildSettings.ToString()); EB.Debug.Log("Envirnoment Setting Parameters:\n" + EnvironmentUtils.GetEnvirnomentDetails()); EB.Editor.PostProcess.Signer = _cert.Trim('\''); // clean up old ipa files CommandLineUtils.Run("/bin/rm", "-f *.ipa"); // cleanup GeneralUtils.DeleteDirectory(platformFolder, true); // mko: cleaning up build folder GeneralUtils.DeleteDirectory("iPad", true); // mko: cleaning up build folder Directory.CreateDirectory(folder); Directory.CreateDirectory(platformFolder); Directory.CreateDirectory("iPad"); // always check for null. EditorUserBuildSettings.explicitNullChecks = true; var version = "1.0"; try { var parts = PlayerSettings.bundleVersion.Split('.'); version = parts[0] + "." + parts[1]; } catch { } // moko: prepend #define instead of replace in case there is some specific settings stored in playerSetting string defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS); if (_debug) { PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, "USE_DEBUG;" + defines); } var cl = EnvironmentUtils.Get("BUILD_CL", "0"); var desc = "iOS Univeral " + date + " CL: " + cl + "\n"; var notes = (ArrayList)EB.JSON.Parse(EnvironmentUtils.Get("BUILD_NOTES", "[]")); PlayerSettings.bundleVersion = version + "." + cl; PlayerSettings.applicationIdentifier = BuildSettings.BundleIdentifier; PlayerSettings.use32BitDisplayBuffer = true; WriteVersionFile(version + "." + cl); if (!_debug) { PlayerSettings.bundleVersion = BuildSettings.Version; } EB.Debug.Log("Desc: " + desc); // build bundles DisplayProgressBar("Building", "Building Bundles", 0.0f); BuildUtils.CleanData(); if (BuildSettings.DevBundleMode != EB.Assets.DevBundleType.NoBundles) { Bundler.BuildAll(BuildSettings.BundlerConfigFolder, BuildSettings.BundlerOptions | Bundler.BundleOptions.Extended); } else { Bundler.BuildAll(BuildSettings.BundlerConfigFolder, Bundler.BundleOptions.Extended | Bundler.BundleOptions.Force); } // build the player DisplayProgressBar("Building", "Building Player", 0.0f); iOSUtils.BuildiOSPlayer(_profile, _debug, (_debug ? BuildOptions.Development : BuildOptions.None)); DisplayProgressBar("Building", "Building IPA", 0.0f); var ipaFile = Path.Combine(folder, cl + ".ipa"); FileUtil.DeleteFileOrDirectory(ipaFile); iOSUtils.CompileiOSPlayer(_profile, _cert, ipaFile, _debug); // upload to s3 var ipaUrl = S3Utils.Put(ipaFile, string.Format("{0}-{1}-{2}.ipa", PlayerSettings.applicationIdentifier, PlayerSettings.bundleVersion, cl)); var dsymUrl = string.Empty; // upload symbols var zipName = Path.GetFileNameWithoutExtension(ipaFile) + ".dSYM.zip"; var zipDir = Path.GetDirectoryName(ipaFile); var zipFile = Path.Combine(zipDir, zipName); if (File.Exists(zipFile)) { EB.Debug.Log("Adding symbols file"); dsymUrl = S3Utils.Put(zipFile, Path.GetFileName(zipFile)); } var size = new FileInfo(ipaFile).Length; var data = new Hashtable(); data["cl"] = cl; data["size"] = size / (1024.0f * 1024.0f); data["title"] = desc; data["ipaUrl"] = ipaUrl; data["dSymUrl"] = dsymUrl; data["notes"] = notes; Email(distributionList, BuildSettings.ProjectName + " - iOS Submission Build: " + version + "@" + cl, File.ReadAllText("Assets/Editor/EB.Core.Editor/Build/Email/submissionbuild.txt"), data); // build extended packs //BuildContentPacksWithOptions(true); Done(); } catch (System.Exception e) { EB.Debug.Log("Build Failed: exception: " + e.ToString()); Failed(e); } ClearProgressBar(); }
public static void BuildAPK(string distributionList) { try { var folder = BuildSettings.BaseBuildFolder; var platformFolder = BuildSettings.BuildFolder; // moko: changed to do a debug dump of all builder job info first var date = System.DateTime.Now.ToString("dd/MM/yy HH:mm"); string header = "*******************************************************************************\n"; header += "Building to " + folder + " @" + date; Debug.Log(header); Debug.Log("Build Setting Parameters:\n" + BuildSettings.ToString()); Debug.Log("Environment Setting Parameters:\n" + EnvironmentUtils.GetEnvirnomentDetails()); // cleanup GeneralUtils.DeleteDirectory(platformFolder, true); // mko: cleaning up build folder GeneralUtils.DeleteDirectory("Android", true); // mko: cleaning up build folder Directory.CreateDirectory(folder); Directory.CreateDirectory(platformFolder); var version = "1.0"; try { var parts = PlayerSettings.bundleVersion.Split('.'); version = parts[0] + "." + parts[1]; } catch { } // moko: prepend #define instead of replace in case there is some specific settings stored in playerSetting string defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android); if (_debug) { PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, "USE_DEBUG;" + defines); } else { if (_useobb) { PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, "USE_OBB;" + defines); } } var cl = EnvironmentUtils.Get("BUILD_CL", "0"); var desc = "Android " + date + " CL: " + cl + "\n"; var notes = (ArrayList)EB.JSON.Parse(EnvironmentUtils.Get("BUILD_NOTES", "[]")); PlayerSettings.bundleVersion = version + "." + cl; PlayerSettings.applicationIdentifier = BuildSettings.BundleIdentifier; PlayerSettings.use32BitDisplayBuffer = false; WriteVersionFile(version + "." + cl); Debug.Log("Desc: " + desc); // disable scenes that are the tracks var settings = new List <EditorBuildSettingsScene>(); foreach (var setting in EditorBuildSettings.scenes) { if (setting.path.Contains("tracks")) { setting.enabled = !_useobb; } if (_debug == false && setting.path.Contains("selector")) { setting.enabled = false; } settings.Add(setting); } EditorBuildSettings.scenes = settings.ToArray(); // build bundles DisplayProgressBar("Building", "Building Bundles", 0.0f); Bundler.BundleOptions bundleOptions = Bundler.BundleOptions.Force | Bundler.BundleOptions.SkipOgg; if (_debug || (_useobb == false)) { bundleOptions |= Bundler.BundleOptions.Extended; } Bundler.BuildAll(BuildSettings.BundlerConfigFolder, bundleOptions); // build the player var apkPath = Path.Combine(folder, cl + ".apk"); PlayerSettings.Android.bundleVersionCode = int.Parse(cl); if (!_debug) { PlayerSettings.bundleVersion = BuildSettings.Version; } else { PlayerSettings.Android.bundleVersionCode = 1; } Debug.Log("Building to " + apkPath); AndroidUtils.BuildPlayer(apkPath, BuildOptions.None); if (!File.Exists(apkPath)) { throw new System.Exception("Failed to build apk!"); } // upload to s3 //string url = S3Utils.Put( apkPath, string.Format("{0}-{1}-{2}.apk", PlayerSettings.bundleIdentifier, PlayerSettings.bundleVersion, cl) ); string url = apkPath; // send email var data = new Hashtable(); data["cl"] = cl; data["title"] = desc; data["url"] = url; data["notes"] = notes; data["obb"] = ""; if (!_debug && _useobb) { data["obb"] = BuildOBB(); UploadApkFiles(apkPath, WWWUtils.Environment.API); } Email(distributionList, BuildSettings.ProjectName + " - Android Build: " + PlayerSettings.bundleVersion + (_debug ? " DEBUG" : " SUBMISSION"), File.ReadAllText("Assets/Editor/EB.Core.Editor/Build/Email/androidbuild.txt"), data); Done(); } catch (System.Exception e) { Debug.Log("Build Failed: exception: " + e.ToString()); Failed(e); } ClearProgressBar(); }
public static void BuildTestFlight(string distributionList) { try { BuildSettings.IsDevelopmentBuild = _debug; BuildUtils.CleanData(); var folder = BuildSettings.BaseBuildFolder; var platformFolder = BuildSettings.BuildFolder; // moko: changed to do a debug dump of all builder job info first var date = System.DateTime.Now.ToString("dd/MM/yy HH:mm"); string header = "*******************************************************************************\n"; header += "Building to " + folder + " @" + date; EB.Debug.Log(header); EB.Debug.Log("Build Setting Parameters:\n" + BuildSettings.ToString()); EB.Debug.Log("Envirnoment Setting Parameters:\n" + EnvironmentUtils.GetEnvirnomentDetails()); EB.Editor.PostProcess.Signer = _cert.Trim('\''); // clean up old ipa files CommandLineUtils.Run("/bin/rm", "-f *.ipa"); CommandLineUtils.Run("/bin/rm", "-f *.dSYM.zip"); // cleanup GeneralUtils.DeleteDirectory(platformFolder, true); // mko: cleaning up build folder GeneralUtils.DeleteDirectory("iPad", true); // mko: cleaning up build folder Directory.CreateDirectory(folder); Directory.CreateDirectory(platformFolder); Directory.CreateDirectory("iPad"); // always check for null. EditorUserBuildSettings.explicitNullChecks = true; var version = "1.0"; try { var parts = PlayerSettings.bundleVersion.Split('.'); version = parts[0] + "." + parts[1]; } catch { } var cl = EnvironmentUtils.Get("BUILD_CL", "0"); var desc = "iOS Univeral " + date + " CL: " + cl + "\n"; var notes = (ArrayList)EB.JSON.Parse(EnvironmentUtils.Get("BUILD_NOTES", "[]")); // clean up the notes foreach (var note in notes) { var user = EB.Dot.String("user", note, string.Empty); var task = EB.Dot.String("desc", note, string.Empty); var time = EB.Dot.Integer("date", note, 0); desc += string.Format("\n- ({0}@{1}): {2}", user, EB.Time.FromPosixTime(time), task); } PlayerSettings.bundleVersion = version + "." + cl; PlayerSettings.applicationIdentifier = BuildSettings.BundleIdentifier; PlayerSettings.use32BitDisplayBuffer = true; WriteVersionFile(PlayerSettings.bundleVersion); // Bill wanted this hardcoded for the ios7 submission - alim 9/10/13 if (!_debug) { PlayerSettings.bundleVersion = BuildSettings.Version; } EB.Debug.Log("Desc: " + desc); // build bundles DisplayProgressBar("Building", "Building Bundles", 0.0f); BuildUtils.CleanData(); if (BuildSettings.DevBundleMode != EB.Assets.DevBundleType.NoBundles) { Bundler.BuildAll(BuildSettings.BundlerConfigFolder, BuildSettings.BundlerOptions | Bundler.BundleOptions.Extended); } else { Bundler.BuildAll(BuildSettings.BundlerConfigFolder, Bundler.BundleOptions.Extended | Bundler.BundleOptions.Force); } // build the player DisplayProgressBar("Building", "Building Player", 0.0f); iOSUtils.BuildiOSPlayer(_profile, _debug, (_debug ? BuildOptions.Development : BuildOptions.None)); DisplayProgressBar("Building", "Building IPA", 0.0f); var ipaFile = Path.Combine(folder, cl + "-adhoc.ipa"); FileUtil.DeleteFileOrDirectory(ipaFile); iOSUtils.CompileiOSPlayer(_profile, _cert, ipaFile, _debug); string savedIpaDir = Path.Combine(Directory.GetCurrentDirectory(), "ipa_backup"); Debug.Log("Copying IPA to " + (new DirectoryInfo(savedIpaDir)).FullName); try { Directory.CreateDirectory(savedIpaDir); string destPath = Path.Combine(savedIpaDir, "last-adhoc.ipa"); if (File.Exists(destPath)) { File.Delete(destPath); } FileUtil.CopyFileOrDirectory(ipaFile, destPath); } catch (System.Exception e) { Debug.Log("Failed to copy most recent build to " + savedIpaDir + " e: " + e.ToString()); } DisplayProgressBar("Building", "Uploading IPA", 0.0f); bool notify = true; if (CommandLineUtils.GetBatchModeCommandArgs().ContainsKey("autoBuilder")) { notify = false; } var result = TestFlightUtil.UploadBuild(ipaFile, desc, distributionList, notify); EB.Debug.Log("TF Upload: " + result); // build extended packs //BuildContentPacksWithOptions(true); Done(); } catch (System.Exception e) { EB.Debug.Log("Build Failed: exception: " + e.ToString()); Failed(e); } ClearProgressBar(); }