public static void ExecuteAction(UMakeTarget t, BuildAction action) { UMake umake; if (!UMake.Get().TryGet(out umake)) { return; } string buildPath; UMakeTarget.Path targetPath; switch (action) { case BuildAction.PreActions: EditorApplication.delayCall += () => t.ExecutePreBuildActions(umake); break; case BuildAction.Build: buildPath = UMake.GetBuildPath(); EditorApplication.delayCall += () => t.Build(umake, buildPath); break; case BuildAction.PostActions: EditorApplication.delayCall += () => t.ExecutePostBuildActions(umake); break; case BuildAction.OpenFolder: targetPath = t.GetTargetPath(umake.version, UMake.GetBuildPath()); EditorUtility.RevealInFinder(targetPath.directoryPath); break; } }
public void Build(UMake umake, string buildPath) { if (string.IsNullOrEmpty(buildPath)) { return; } ExecutePreBuildActions(umake); Path targetPath = GetTargetPath(umake.version, UMake.GetBuildPath()); if (Directory.Exists(targetPath.directoryPath)) { Directory.Delete(targetPath.directoryPath, true); Directory.CreateDirectory(targetPath.directoryPath); } string[] levels = EditorBuildSettings.scenes.Where(s => s.enabled).Select(s => s.path).ToArray(); BuildPipeline.BuildPlayer(levels, targetPath.path, buildTarget, buildOptions); }
public override void Execute(UMake umake, UMakeTarget target) { try { string buildPath = UMake.GetBuildPath(); string steamBuildScript = buildScript; string sdkPath = steamSdkPath.Value; string username = steamUsername.Value; string password = steamPassword.Value; bool skipCopy = skipSteamContentCopy; if (UMakeCli.IsInCli) { UMakeCli.Args.TryGetValue("path", out buildPath); UMakeCli.Args.TryGetValue("script", out steamBuildScript); UMakeCli.Args.TryGetValue("steam-sdk", out sdkPath); UMakeCli.Args.TryGetValue("steam-username", out username); UMakeCli.Args.TryGetValue("steam-password", out password); string skipCopyStringValue; UMakeCli.Args.TryGetValue("skip-steam-content-copy", out skipCopyStringValue); bool.TryParse(skipCopyStringValue, out skipCopy); } if (!Directory.Exists(sdkPath)) { Debug.LogFormat("SteamSDK \"{0}\" not found.", sdkPath); return; } string steamCmdPath = Path.Combine(sdkPath, "tools/ContentBuilder/builder/steamcmd.exe");; if (!File.Exists(steamCmdPath)) { Debug.LogFormat("SteamCMD \"{0}\" not found.", steamCmdPath); return; } if (!skipCopy && !CopyContent(sdkPath, target, umake.version, buildPath)) { Debug.Log("Could not copy content to Steam folder."); return; } var uploaderProcess = new System.Diagnostics.Process(); uploaderProcess.StartInfo.FileName = steamCmdPath; uploaderProcess.StartInfo.WorkingDirectory = Path.GetDirectoryName(Path.GetDirectoryName(steamCmdPath)); uploaderProcess.StartInfo.Arguments = string.Format(steamCmdArgFormat, username, password, steamBuildScript); if (UMakeCli.IsInCli) { uploaderProcess.StartInfo.UseShellExecute = false; uploaderProcess.StartInfo.RedirectStandardOutput = true; uploaderProcess.OutputDataReceived += (sender, msg) => { if (msg != null) { Debug.Log(msg.Data); } }; } uploaderProcess.Start(); Debug.LogFormat("Executing SteamCMD \"{0}\"...", steamCmdPath); if (UMakeCli.IsInCli) { uploaderProcess.BeginOutputReadLine(); uploaderProcess.WaitForExit(); } uploaderProcess.Close(); } catch (System.Exception e) { Debug.Log("Upload to Steam failed."); Debug.LogException(e); } }