public static void Run(ProjectParams Params) { Params.ValidateAndLog(); if (!Params.Run) { return; } Log("********** RUN COMMAND STARTED **********"); var LogFolderOutsideOfSandbox = GetLogFolderOutsideOfSandbox(); if (!GlobalCommandLine.Installed && ServerProcess == null) { // In the installed runs, this is the same folder as CmdEnv.LogFolder so delete only in not-installed DeleteDirectory(LogFolderOutsideOfSandbox); CreateDirectory(LogFolderOutsideOfSandbox); } var ServerLogFile = CombinePaths(LogFolderOutsideOfSandbox, "Server.log"); var ClientLogFile = CombinePaths(LogFolderOutsideOfSandbox, Params.EditorTest ? "Editor.log" : "Client.log"); try { RunInternal(Params, ServerLogFile, ClientLogFile); } catch { throw; } finally { CopyLogsBackToLogFolder(); } Log("********** RUN COMMAND COMPLETED **********"); }
public static void GetFile(ProjectParams Params) { Params.ValidateAndLog(); if (string.IsNullOrEmpty(Params.GetFile)) { return; } LogInformation("********** GETFILE COMMAND STARTED **********"); var FileName = Path.GetFileName(Params.GetFile); var LocalFile = CombinePaths(CmdEnv.EngineSavedFolder, FileName); var SC = CreateDeploymentContext(Params, false); if (SC.Count == 0) { throw new AutomationException("Failed to create deployment context"); } SC[0].StageTargetPlatform.GetTargetFile(Params.GetFile, LocalFile, Params); LogInformation("********** GETFILE COMMAND COMPLETED **********"); }
public static void Archive(ProjectParams Params) { Params.ValidateAndLog(); if (!Params.Archive) { return; } LogInformation("********** ARCHIVE COMMAND STARTED **********"); LogInformation("Archiving to {0}", Params.ArchiveDirectoryParam); if (!Params.NoClient) { var DeployContextList = CreateDeploymentContext(Params, false, false); foreach (var SC in DeployContextList) { CreateArchiveManifest(Params, SC); ApplyArchiveManifest(Params, SC); SC.StageTargetPlatform.ProcessArchivedProject(Params, SC); } } if (Params.DedicatedServer) { ProjectParams ServerParams = new ProjectParams(Params); ServerParams.Devices = new ParamList <string>(ServerParams.ServerDevice); var DeployContextList = CreateDeploymentContext(ServerParams, true, false); foreach (var SC in DeployContextList) { CreateArchiveManifest(Params, SC); ApplyArchiveManifest(Params, SC); SC.StageTargetPlatform.ProcessArchivedProject(Params, SC); } } LogInformation("********** ARCHIVE COMMAND COMPLETED **********"); }
public static void Cook(ProjectParams Params) { if ((!Params.Cook && !(Params.CookOnTheFly && !Params.SkipServer)) || Params.SkipCook) { return; } Params.ValidateAndLog(); Log("********** COOK COMMAND STARTED **********"); string UE4EditorExe = HostPlatform.Current.GetUE4ExePath(Params.UE4Exe); if (!FileExists(UE4EditorExe)) { throw new AutomationException("Missing " + UE4EditorExe + " executable. Needs to be built first."); } if (Params.CookOnTheFly && !Params.SkipServer) { if (Params.HasDLCName) { throw new AutomationException("Cook on the fly doesn't support cooking dlc"); } if (Params.ClientTargetPlatforms.Count > 0) { var LogFolderOutsideOfSandbox = GetLogFolderOutsideOfSandbox(); if (!GlobalCommandLine.Installed) { // In the installed runs, this is the same folder as CmdEnv.LogFolder so delete only in not-installed DeleteDirectory(LogFolderOutsideOfSandbox); CreateDirectory(LogFolderOutsideOfSandbox); } String COTFCommandLine = Params.RunCommandline; if (Params.IterativeCooking) { COTFCommandLine += " -iterate -iteratehash"; } if (Params.UseDebugParamForEditorExe) { COTFCommandLine += " -debug"; } var ServerLogFile = CombinePaths(LogFolderOutsideOfSandbox, "Server.log"); Platform ClientPlatformInst = Params.ClientTargetPlatformInstances[0]; string TargetCook = ClientPlatformInst.GetCookPlatform(false, false); // cook on he fly doesn't support server cook platform... ServerProcess = RunCookOnTheFlyServer(Params.RawProjectPath, Params.NoClient ? "" : ServerLogFile, TargetCook, COTFCommandLine); if (ServerProcess != null) { Log("Waiting a few seconds for the server to start..."); Thread.Sleep(5000); } } else { throw new AutomationException("Failed to run, client target platform not specified"); } } else { string NativizedPluginPath = ""; var PlatformsToCook = new HashSet <string>(); if (!Params.NoClient) { foreach (var ClientPlatform in Params.ClientTargetPlatforms) { // Use the data platform, sometimes we will copy another platform's data var DataPlatformDesc = Params.GetCookedDataPlatformForClientTarget(ClientPlatform); string PlatformToCook = Platform.Platforms[DataPlatformDesc].GetCookPlatform(false, Params.Client); PlatformsToCook.Add(PlatformToCook); NativizedPluginPath = AddBlueprintPluginPathArgument(Params, true, DataPlatformDesc.Type, PlatformToCook); } } if (Params.DedicatedServer) { foreach (var ServerPlatform in Params.ServerTargetPlatforms) { // Use the data platform, sometimes we will copy another platform's data var DataPlatformDesc = Params.GetCookedDataPlatformForServerTarget(ServerPlatform); string PlatformToCook = Platform.Platforms[DataPlatformDesc].GetCookPlatform(true, false); PlatformsToCook.Add(PlatformToCook); NativizedPluginPath = AddBlueprintPluginPathArgument(Params, false, DataPlatformDesc.Type, PlatformToCook); } } if (Params.Clean.HasValue && Params.Clean.Value && !Params.IterativeCooking) { Log("Cleaning cooked data."); CleanupCookedData(PlatformsToCook.ToList(), Params); } // cook the set of maps, or the run map, or nothing string[] Maps = null; if (Params.HasMapsToCook) { Maps = Params.MapsToCook.ToArray(); foreach (var M in Maps) { Log("HasMapsToCook " + M.ToString()); } foreach (var M in Params.MapsToCook) { Log("Params.HasMapsToCook " + M.ToString()); } } string[] Dirs = null; if (Params.HasDirectoriesToCook) { Dirs = Params.DirectoriesToCook.ToArray(); } string InternationalizationPreset = null; if (Params.HasInternationalizationPreset) { InternationalizationPreset = Params.InternationalizationPreset; } string[] CulturesToCook = null; if (Params.HasCulturesToCook) { CulturesToCook = Params.CulturesToCook.ToArray(); } try { var CommandletParams = IsBuildMachine ? "-buildmachine -fileopenlog" : "-fileopenlog"; if (Params.UnversionedCookedContent) { CommandletParams += " -unversioned"; } if (Params.FastCook) { CommandletParams += " -FastCook"; } if (Params.UseDebugParamForEditorExe) { CommandletParams += " -debug"; } if (Params.Manifests) { CommandletParams += " -manifests"; } if (Params.IterativeCooking) { CommandletParams += " -iterate -iterateshash"; } if (Params.IterateSharedCookedBuild) { SharedCookedBuild.CopySharedCookedBuild(Params); CommandletParams += " -iteratesharedcookedbuild"; } if (Params.CookMapsOnly) { CommandletParams += " -mapsonly"; } if (Params.CookAll) { CommandletParams += " -cookall"; } if (Params.HasCreateReleaseVersion) { CommandletParams += " -createreleaseversion=" + Params.CreateReleaseVersion; } if (Params.SkipCookingEditorContent) { CommandletParams += " -skipeditorcontent"; } if (Params.NumCookersToSpawn != 0) { CommandletParams += " -numcookerstospawn=" + Params.NumCookersToSpawn; } if (Params.CookPartialGC) { CommandletParams += " -partialgc"; } if (Params.HasMapIniSectionsToCook) { string MapIniSections = CombineCommandletParams(Params.MapIniSectionsToCook.ToArray()); CommandletParams += " -MapIniSection=" + MapIniSections; } if (Params.HasDLCName) { CommandletParams += " -dlcname=" + Params.DLCFile.GetFileNameWithoutExtension(); if (!Params.DLCIncludeEngineContent) { CommandletParams += " -errorOnEngineContentUse"; } } if (!String.IsNullOrEmpty(Params.CookOutputDir)) { CommandletParams += " -outputdir=" + CommandUtils.MakePathSafeToUseWithCommandLine(Params.CookOutputDir); } // don't include the based on release version unless we are cooking dlc or creating a new release version // in this case the based on release version is used in packaging if (Params.HasBasedOnReleaseVersion && (Params.HasDLCName || Params.HasCreateReleaseVersion)) { CommandletParams += " -basedonreleaseversion=" + Params.BasedOnReleaseVersion; } // if we are not going to pak but we specified compressed then compress in the cooker ;) // otherwise compress the pak files if (!Params.Pak && !Params.SkipPak && Params.Compressed) { CommandletParams += " -compressed"; } // we provide the option for users to run a conversion on certain (script) assets, translating them // into native source code... the cooker needs to if (Params.RunAssetNativization) { CommandletParams += " -NativizeAssets"; if (NativizedPluginPath.Length > 0) { CommandletParams += "=\"" + NativizedPluginPath + "\""; } } if (Params.HasAdditionalCookerOptions) { string FormatedAdditionalCookerParams = Params.AdditionalCookerOptions.TrimStart(new char[] { '\"', ' ' }).TrimEnd(new char[] { '\"', ' ' }); CommandletParams += " "; CommandletParams += FormatedAdditionalCookerParams; } if (!Params.NoClient) { var MapsList = Maps == null ? new List <string>() : Maps.ToList(); foreach (var ClientPlatform in Params.ClientTargetPlatforms) { var DataPlatformDesc = Params.GetCookedDataPlatformForClientTarget(ClientPlatform); CommandletParams += (Platform.Platforms[DataPlatformDesc].GetCookExtraCommandLine(Params)); MapsList.AddRange((Platform.Platforms[ClientPlatform].GetCookExtraMaps())); } Maps = MapsList.ToArray(); } CookCommandlet(Params.RawProjectPath, Params.UE4Exe, Maps, Dirs, InternationalizationPreset, CulturesToCook, CombineCommandletParams(PlatformsToCook.ToArray()), CommandletParams); SharedCookedBuild.WaitForCopy(); } catch (Exception Ex) { if (Params.IgnoreCookErrors) { LogWarning("Ignoring cook failure."); } else { // Delete cooked data (if any) as it may be incomplete / corrupted. Log("Cook failed. Deleting cooked data."); CleanupCookedData(PlatformsToCook.ToList(), Params); throw new AutomationException(ExitCode.Error_UnknownCookFailure, Ex, "Cook failed."); } } if (Params.HasDiffCookedContentPath) { try { DiffCookedContent(Params); } catch (Exception Ex) { // Delete cooked data (if any) as it may be incomplete / corrupted. Log("Cook failed. Deleting cooked data."); CleanupCookedData(PlatformsToCook.ToList(), Params); throw new AutomationException(ExitCode.Error_UnknownCookFailure, Ex, "Cook failed."); } } } Log("********** COOK COMMAND COMPLETED **********"); }
public static void Build(BuildCommand Command, ProjectParams Params, int WorkingCL = -1, ProjectBuildTargets TargetMask = ProjectBuildTargets.All) { Params.ValidateAndLog(); if (!Params.Build) { return; } Log("********** BUILD COMMAND STARTED **********"); var UE4Build = new UE4Build(Command); var Agenda = new UE4Build.BuildAgenda(); var CrashReportPlatforms = new HashSet <UnrealTargetPlatform>(); // Setup editor targets if (Params.HasEditorTargets && !Automation.IsEngineInstalled() && (TargetMask & ProjectBuildTargets.Editor) == ProjectBuildTargets.Editor) { // @todo Mac: proper platform detection UnrealTargetPlatform EditorPlatform = HostPlatform.Current.HostEditorPlatform; const UnrealTargetConfiguration EditorConfiguration = UnrealTargetConfiguration.Development; CrashReportPlatforms.Add(EditorPlatform); Agenda.AddTargets(Params.EditorTargets.ToArray(), EditorPlatform, EditorConfiguration, Params.CodeBasedUprojectPath); if (Params.EditorTargets.Contains("UnrealHeaderTool") == false) { Agenda.AddTargets(new string[] { "UnrealHeaderTool" }, EditorPlatform, EditorConfiguration); } if (Params.EditorTargets.Contains("ShaderCompileWorker") == false) { Agenda.AddTargets(new string[] { "ShaderCompileWorker" }, EditorPlatform, EditorConfiguration); } if (Params.Pak && Params.EditorTargets.Contains("UnrealPak") == false) { Agenda.AddTargets(new string[] { "UnrealPak" }, EditorPlatform, EditorConfiguration); } if (Params.FileServer && Params.EditorTargets.Contains("UnrealFileServer") == false) { Agenda.AddTargets(new string[] { "UnrealFileServer" }, EditorPlatform, EditorConfiguration); } } // Setup cooked targets if (Params.HasClientCookedTargets && (TargetMask & ProjectBuildTargets.ClientCooked) == ProjectBuildTargets.ClientCooked) { List <UnrealTargetPlatform> UniquePlatformTypes = Params.ClientTargetPlatforms.ConvertAll(x => x.Type).Distinct().ToList(); foreach (var BuildConfig in Params.ClientConfigsToBuild) { foreach (var ClientPlatformType in UniquePlatformTypes) { string AdditionalArgs = GetBlueprintPluginPathArgument(Params, true, ClientPlatformType); AdditionalArgs += " -remoteini=\"" + Params.RawProjectPath.Directory.FullName + "\""; if (Params.IsCodeBasedProject == false) { AdditionalArgs += " -project=\"" + Path.GetFullPath(Params.RawProjectPath.FullName) + "\""; } CrashReportPlatforms.Add(ClientPlatformType); Agenda.AddTargets(Params.ClientCookedTargets.ToArray(), ClientPlatformType, BuildConfig, Params.CodeBasedUprojectPath, InAddArgs: AdditionalArgs); } } } if (Params.HasServerCookedTargets && (TargetMask & ProjectBuildTargets.ServerCooked) == ProjectBuildTargets.ServerCooked) { List <UnrealTargetPlatform> UniquePlatformTypes = Params.ServerTargetPlatforms.ConvertAll(x => x.Type).Distinct().ToList(); foreach (var BuildConfig in Params.ServerConfigsToBuild) { foreach (var ServerPlatformType in UniquePlatformTypes) { string AdditionalArgs = GetBlueprintPluginPathArgument(Params, false, ServerPlatformType); AdditionalArgs += " -remoteini=\"" + Params.RawProjectPath.Directory.FullName + "\""; if (Params.IsCodeBasedProject == false) { AdditionalArgs += " -project=\"" + Path.GetFullPath(Params.RawProjectPath.FullName) + "\""; } CrashReportPlatforms.Add(ServerPlatformType); Agenda.AddTargets(Params.ServerCookedTargets.ToArray(), ServerPlatformType, BuildConfig, Params.CodeBasedUprojectPath, InAddArgs: AdditionalArgs); } } } if (!Params.NoBootstrapExe && !Automation.IsEngineInstalled() && (TargetMask & ProjectBuildTargets.Bootstrap) == ProjectBuildTargets.Bootstrap) { UnrealBuildTool.UnrealTargetPlatform[] BootstrapPackagedGamePlatforms = { UnrealBuildTool.UnrealTargetPlatform.Win32, UnrealBuildTool.UnrealTargetPlatform.Win64 }; foreach (UnrealBuildTool.UnrealTargetPlatform BootstrapPackagedGamePlatformType in BootstrapPackagedGamePlatforms) { if (Params.ClientTargetPlatforms.Contains(new TargetPlatformDescriptor(BootstrapPackagedGamePlatformType))) { Agenda.AddTarget("BootstrapPackagedGame", BootstrapPackagedGamePlatformType, UnrealBuildTool.UnrealTargetConfiguration.Shipping); } } } if (Params.CrashReporter && !Automation.IsEngineInstalled() && (TargetMask & ProjectBuildTargets.CrashReporter) == ProjectBuildTargets.CrashReporter) { foreach (var CrashReportPlatform in CrashReportPlatforms) { if (UnrealBuildTool.UnrealBuildTool.PlatformSupportsCrashReporter(CrashReportPlatform)) { Agenda.AddTarget("CrashReportClient", CrashReportPlatform, UnrealTargetConfiguration.Shipping); } } } if (Params.HasProgramTargets && (TargetMask & ProjectBuildTargets.Programs) == ProjectBuildTargets.Programs) { List <UnrealTargetPlatform> UniquePlatformTypes = Params.ClientTargetPlatforms.ConvertAll(x => x.Type).Distinct().ToList(); foreach (var BuildConfig in Params.ClientConfigsToBuild) { foreach (var ClientPlatformType in UniquePlatformTypes) { Agenda.AddTargets(Params.ProgramTargets.ToArray(), ClientPlatformType, BuildConfig, Params.CodeBasedUprojectPath); } } } UE4Build.Build(Agenda, InDeleteBuildProducts: Params.Clean, InUpdateVersionFiles: WorkingCL > 0); if (WorkingCL > 0) // only move UAT files if we intend to check in some build products { UE4Build.AddUATFilesToBuildProducts(); } UE4Build.CheckBuildProducts(UE4Build.BuildProductFiles); if (WorkingCL > 0) { // Sign everything we built CodeSign.SignMultipleIfEXEOrDLL(Command, UE4Build.BuildProductFiles); // Open files for add or edit UE4Build.AddBuildProductsToChangelist(WorkingCL, UE4Build.BuildProductFiles); } Log("********** BUILD COMMAND COMPLETED **********"); }
public static void Build(BuildCommand Command, ProjectParams Params, int WorkingCL = -1) { Params.ValidateAndLog(); if (!Params.Build) { return; } Log("********** BUILD COMMAND STARTED **********"); var UE4Build = new UE4Build(Command); var Agenda = new UE4Build.BuildAgenda(); var CrashReportPlatforms = new HashSet <UnrealTargetPlatform>(); // Setup editor targets if (Params.HasEditorTargets && !Params.Rocket) { // @todo Mac: proper platform detection UnrealTargetPlatform EditorPlatform = HostPlatform.Current.HostEditorPlatform; const UnrealTargetConfiguration EditorConfiguration = UnrealTargetConfiguration.Development; CrashReportPlatforms.Add(EditorPlatform); Agenda.AddTargets(Params.EditorTargets.ToArray(), EditorPlatform, EditorConfiguration, Params.CodeBasedUprojectPath); if (Params.EditorTargets.Contains("UnrealHeaderTool") == false) { Agenda.AddTargets(new string[] { "UnrealHeaderTool" }, EditorPlatform, EditorConfiguration); } if (Params.EditorTargets.Contains("ShaderCompileWorker") == false) { Agenda.AddTargets(new string[] { "ShaderCompileWorker" }, EditorPlatform, EditorConfiguration); } if (Params.Pak && Params.EditorTargets.Contains("UnrealPak") == false) { Agenda.AddTargets(new string[] { "UnrealPak" }, EditorPlatform, EditorConfiguration); } if (Params.FileServer && Params.EditorTargets.Contains("UnrealFileServer") == false) { Agenda.AddTargets(new string[] { "UnrealFileServer" }, EditorPlatform, EditorConfiguration); } } // Setup cooked targets if (Params.HasClientCookedTargets) { foreach (var BuildConfig in Params.ClientConfigsToBuild) { foreach (var ClientPlatform in Params.ClientTargetPlatforms) { CrashReportPlatforms.Add(ClientPlatform); Agenda.AddTargets(Params.ClientCookedTargets.ToArray(), ClientPlatform, BuildConfig, Params.CodeBasedUprojectPath, InAddArgs: " -remoteini=\"" + Path.GetDirectoryName(Params.RawProjectPath) + "\""); } } } if (Params.HasServerCookedTargets) { foreach (var BuildConfig in Params.ServerConfigsToBuild) { foreach (var ServerPlatform in Params.ServerTargetPlatforms) { CrashReportPlatforms.Add(ServerPlatform); Agenda.AddTargets(Params.ServerCookedTargets.ToArray(), ServerPlatform, BuildConfig, Params.CodeBasedUprojectPath, InAddArgs: " -remoteini=\"" + Path.GetDirectoryName(Params.RawProjectPath) + "\""); } } } if (Params.CrashReporter && !Params.Rocket) { var CrashReportClientTarget = new[] { "CrashReportClient" }; foreach (var CrashReportPlatform in CrashReportPlatforms) { if (UnrealBuildTool.UnrealBuildTool.PlatformSupportsCrashReporter(CrashReportPlatform)) { Agenda.AddTargets(CrashReportClientTarget, CrashReportPlatform, UnrealTargetConfiguration.Development); } } } if (Params.HasProgramTargets && !Params.Rocket) { foreach (var BuildConfig in Params.ClientConfigsToBuild) { foreach (var ClientPlatform in Params.ClientTargetPlatforms) { Agenda.AddTargets(Params.ProgramTargets.ToArray(), ClientPlatform, BuildConfig, Params.CodeBasedUprojectPath); } } } UE4Build.Build(Agenda, InDeleteBuildProducts: Params.Clean, InUpdateVersionFiles: WorkingCL > 0); if (WorkingCL > 0) // only move UAT files if we intend to check in some build products { UE4Build.AddUATFilesToBuildProducts(); } UE4Build.CheckBuildProducts(UE4Build.BuildProductFiles); if (WorkingCL > 0) { // Sign everything we built CodeSign.SignMultipleIfEXEOrDLL(Command, UE4Build.BuildProductFiles); // Open files for add or edit UE4Build.AddBuildProductsToChangelist(WorkingCL, UE4Build.BuildProductFiles); } Log("********** BUILD COMMAND COMPLETED **********"); }
public static void Build(BuildCommand Command, ProjectParams Params, int WorkingCL = -1, ProjectBuildTargets TargetMask = ProjectBuildTargets.All) { Params.ValidateAndLog(); if (!Params.Build) { return; } Log("********** BUILD COMMAND STARTED **********"); var UE4Build = new UE4Build(Command); var Agenda = new UE4Build.BuildAgenda(); var CrashReportPlatforms = new HashSet <UnrealTargetPlatform>(); // Setup editor targets if (Params.HasEditorTargets && !Automation.IsEngineInstalled() && (TargetMask & ProjectBuildTargets.Editor) == ProjectBuildTargets.Editor) { // @todo Mac: proper platform detection UnrealTargetPlatform EditorPlatform = HostPlatform.Current.HostEditorPlatform; const UnrealTargetConfiguration EditorConfiguration = UnrealTargetConfiguration.Development; CrashReportPlatforms.Add(EditorPlatform); Agenda.AddTargets(Params.EditorTargets.ToArray(), EditorPlatform, EditorConfiguration, Params.CodeBasedUprojectPath); if (Params.EditorTargets.Contains("UnrealHeaderTool") == false) { Agenda.AddTargets(new string[] { "UnrealHeaderTool" }, EditorPlatform, EditorConfiguration); } if (Params.EditorTargets.Contains("ShaderCompileWorker") == false) { Agenda.AddTargets(new string[] { "ShaderCompileWorker" }, EditorPlatform, EditorConfiguration); } if (Params.Pak && Params.EditorTargets.Contains("UnrealPak") == false) { Agenda.AddTargets(new string[] { "UnrealPak" }, EditorPlatform, EditorConfiguration); } if (Params.FileServer && Params.EditorTargets.Contains("UnrealFileServer") == false) { Agenda.AddTargets(new string[] { "UnrealFileServer" }, EditorPlatform, EditorConfiguration); } } string ScriptPluginArgs = ""; // if we're utilizing an auto-generated code plugin/module (a product of // the cook process), make sure to compile it along with the targets here if (Params.RunAssetNativization) { // Add every plugin: foreach (var CodePlugin in Params.BlueprintPluginPaths) { ScriptPluginArgs = "-PLUGIN \"" + CodePlugin + "\""; } } // Setup cooked targets if (Params.HasClientCookedTargets && (TargetMask & ProjectBuildTargets.ClientCooked) == ProjectBuildTargets.ClientCooked) { foreach (var BuildConfig in Params.ClientConfigsToBuild) { foreach (var ClientPlatform in Params.ClientTargetPlatforms) { CrashReportPlatforms.Add(ClientPlatform); Agenda.AddTargets(Params.ClientCookedTargets.ToArray(), ClientPlatform, BuildConfig, Params.CodeBasedUprojectPath, InAddArgs: ScriptPluginArgs + " -remoteini=\"" + Params.RawProjectPath.Directory.FullName + "\""); } } } if (Params.HasServerCookedTargets && (TargetMask & ProjectBuildTargets.ServerCooked) == ProjectBuildTargets.ServerCooked) { foreach (var BuildConfig in Params.ServerConfigsToBuild) { foreach (var ServerPlatform in Params.ServerTargetPlatforms) { CrashReportPlatforms.Add(ServerPlatform); Agenda.AddTargets(Params.ServerCookedTargets.ToArray(), ServerPlatform, BuildConfig, Params.CodeBasedUprojectPath, InAddArgs: ScriptPluginArgs + " -remoteini=\"" + Params.RawProjectPath.Directory.FullName + "\""); } } } if (!Params.NoBootstrapExe && !Automation.IsEngineInstalled() && (TargetMask & ProjectBuildTargets.Bootstrap) == ProjectBuildTargets.Bootstrap) { UnrealBuildTool.UnrealTargetPlatform[] BootstrapPackagedGamePlatforms = { UnrealBuildTool.UnrealTargetPlatform.Win32, UnrealBuildTool.UnrealTargetPlatform.Win64 }; foreach (UnrealBuildTool.UnrealTargetPlatform BootstrapPackagedGamePlatform in BootstrapPackagedGamePlatforms) { if (Params.ClientTargetPlatforms.Contains(BootstrapPackagedGamePlatform)) { Agenda.AddTarget("BootstrapPackagedGame", BootstrapPackagedGamePlatform, UnrealBuildTool.UnrealTargetConfiguration.Shipping); } } } if (Params.CrashReporter && !Automation.IsEngineInstalled() && (TargetMask & ProjectBuildTargets.CrashReporter) == ProjectBuildTargets.CrashReporter) { foreach (var CrashReportPlatform in CrashReportPlatforms) { if (UnrealBuildTool.UnrealBuildTool.PlatformSupportsCrashReporter(CrashReportPlatform)) { Agenda.AddTarget("CrashReportClient", CrashReportPlatform, UnrealTargetConfiguration.Shipping); } } } if (Params.HasProgramTargets && (TargetMask & ProjectBuildTargets.Programs) == ProjectBuildTargets.Programs) { foreach (var BuildConfig in Params.ClientConfigsToBuild) { foreach (var ClientPlatform in Params.ClientTargetPlatforms) { Agenda.AddTargets(Params.ProgramTargets.ToArray(), ClientPlatform, BuildConfig, Params.CodeBasedUprojectPath); } } } UE4Build.Build(Agenda, InDeleteBuildProducts: Params.Clean, InUpdateVersionFiles: WorkingCL > 0); if (WorkingCL > 0) // only move UAT files if we intend to check in some build products { UE4Build.AddUATFilesToBuildProducts(); } UE4Build.CheckBuildProducts(UE4Build.BuildProductFiles); if (WorkingCL > 0) { // Sign everything we built CodeSign.SignMultipleIfEXEOrDLL(Command, UE4Build.BuildProductFiles); // Open files for add or edit UE4Build.AddBuildProductsToChangelist(WorkingCL, UE4Build.BuildProductFiles); } Log("********** BUILD COMMAND COMPLETED **********"); }
public static void Build(BuildCommand Command, ProjectParams Params, int WorkingCL = -1, ProjectBuildTargets TargetMask = ProjectBuildTargets.All) { Params.ValidateAndLog(); if (!Params.Build) { return; } if (CommandUtils.IsEngineInstalled() && !Params.IsCodeBasedProject) { return; } LogInformation("********** BUILD COMMAND STARTED **********"); var UE4Build = new UE4Build(Command); var Agenda = new UE4Build.BuildAgenda(); var CrashReportPlatforms = new HashSet <UnrealTargetPlatform>(); // Setup editor targets if (Params.HasEditorTargets && (!Params.SkipBuildEditor) && (TargetMask & ProjectBuildTargets.Editor) == ProjectBuildTargets.Editor) { // @todo Mac: proper platform detection UnrealTargetPlatform EditorPlatform = HostPlatform.Current.HostEditorPlatform; const UnrealTargetConfiguration EditorConfiguration = UnrealTargetConfiguration.Development; Agenda.AddTargets(Params.EditorTargets.ToArray(), EditorPlatform, EditorConfiguration, Params.CodeBasedUprojectPath); if (!CommandUtils.IsEngineInstalled()) { CrashReportPlatforms.Add(EditorPlatform); if (Params.EditorTargets.Contains("UnrealHeaderTool") == false) { Agenda.AddTargets(new string[] { "UnrealHeaderTool" }, EditorPlatform, EditorConfiguration); } if (Params.EditorTargets.Contains("ShaderCompileWorker") == false) { Agenda.AddTargets(new string[] { "ShaderCompileWorker" }, EditorPlatform, EditorConfiguration); } if (Params.FileServer && Params.EditorTargets.Contains("UnrealFileServer") == false) { Agenda.AddTargets(new string[] { "UnrealFileServer" }, EditorPlatform, EditorConfiguration); } } } // allow all involved platforms to hook into the agenda HashSet <UnrealTargetPlatform> UniquePlatforms = new HashSet <UnrealTargetPlatform>(); UniquePlatforms.UnionWith(Params.ClientTargetPlatforms.Select(x => x.Type)); UniquePlatforms.UnionWith(Params.ServerTargetPlatforms.Select(x => x.Type)); foreach (UnrealTargetPlatform TargetPlatform in UniquePlatforms) { Platform.GetPlatform(TargetPlatform).PreBuildAgenda(UE4Build, Agenda); } // Build any tools we need to stage if ((TargetMask & ProjectBuildTargets.UnrealPak) == ProjectBuildTargets.UnrealPak && !CommandUtils.IsEngineInstalled()) { if (Params.EditorTargets.Contains("UnrealPak") == false) { Agenda.AddTargets(new string[] { "UnrealPak" }, HostPlatform.Current.HostEditorPlatform, UnrealTargetConfiguration.Development, Params.CodeBasedUprojectPath); } } // Additional compile arguments string AdditionalArgs = ""; if (string.IsNullOrEmpty(Params.UbtArgs) == false) { string Arg = Params.UbtArgs; Arg = Arg.TrimStart(new char[] { '\"' }); Arg = Arg.TrimEnd(new char[] { '\"' }); AdditionalArgs += " " + Arg; } if (Params.MapFile) { AdditionalArgs += " -mapfile"; } if (Params.Deploy || Params.Package) { AdditionalArgs += " -skipdeploy"; // skip deploy step in UBT if we going to do it later anyway } if (Params.Distribution) { AdditionalArgs += " -distribution"; } // Config overrides (-ini) foreach (string ConfigOverrideParam in Params.ConfigOverrideParams) { AdditionalArgs += " -"; AdditionalArgs += ConfigOverrideParam; } // Setup cooked targets if (Params.HasClientCookedTargets && (!Params.SkipBuildClient) && (TargetMask & ProjectBuildTargets.ClientCooked) == ProjectBuildTargets.ClientCooked) { List <UnrealTargetPlatform> UniquePlatformTypes = Params.ClientTargetPlatforms.ConvertAll(x => x.Type).Distinct().ToList(); foreach (var BuildConfig in Params.ClientConfigsToBuild) { foreach (var ClientPlatformType in UniquePlatformTypes) { CrashReportPlatforms.Add(ClientPlatformType); Agenda.AddTargets(Params.ClientCookedTargets.ToArray(), ClientPlatformType, BuildConfig, Params.CodeBasedUprojectPath, InAddArgs: " -remoteini=\"" + Params.RawProjectPath.Directory.FullName + "\"" + AdditionalArgs); } } } if (Params.HasServerCookedTargets && (TargetMask & ProjectBuildTargets.ServerCooked) == ProjectBuildTargets.ServerCooked) { List <UnrealTargetPlatform> UniquePlatformTypes = Params.ServerTargetPlatforms.ConvertAll(x => x.Type).Distinct().ToList(); foreach (var BuildConfig in Params.ServerConfigsToBuild) { foreach (var ServerPlatformType in UniquePlatformTypes) { CrashReportPlatforms.Add(ServerPlatformType); Agenda.AddTargets(Params.ServerCookedTargets.ToArray(), ServerPlatformType, BuildConfig, Params.CodeBasedUprojectPath, InAddArgs: " -remoteini=\"" + Params.RawProjectPath.Directory.FullName + "\"" + AdditionalArgs); } } } if (!Params.NoBootstrapExe && !CommandUtils.IsEngineInstalled() && (TargetMask & ProjectBuildTargets.Bootstrap) == ProjectBuildTargets.Bootstrap) { UnrealBuildTool.UnrealTargetPlatform[] BootstrapPackagedGamePlatforms = { UnrealBuildTool.UnrealTargetPlatform.Win32, UnrealBuildTool.UnrealTargetPlatform.Win64 }; foreach (UnrealBuildTool.UnrealTargetPlatform BootstrapPackagedGamePlatformType in BootstrapPackagedGamePlatforms) { if (Params.ClientTargetPlatforms.Contains(new TargetPlatformDescriptor(BootstrapPackagedGamePlatformType))) { Agenda.AddTarget("BootstrapPackagedGame", BootstrapPackagedGamePlatformType, UnrealBuildTool.UnrealTargetConfiguration.Shipping); } } } if (Params.CrashReporter && !CommandUtils.IsEngineInstalled() && (TargetMask & ProjectBuildTargets.CrashReporter) == ProjectBuildTargets.CrashReporter) { foreach (var CrashReportPlatform in CrashReportPlatforms) { if (PlatformSupportsCrashReporter(CrashReportPlatform)) { Agenda.AddTarget("CrashReportClient", CrashReportPlatform, UnrealTargetConfiguration.Shipping, InAddArgs: " -remoteini=\"" + Params.RawProjectPath.Directory.FullName + "\""); } } } if (Params.HasProgramTargets && (TargetMask & ProjectBuildTargets.Programs) == ProjectBuildTargets.Programs) { List <UnrealTargetPlatform> UniquePlatformTypes = Params.ClientTargetPlatforms.ConvertAll(x => x.Type).Distinct().ToList(); foreach (var BuildConfig in Params.ClientConfigsToBuild) { foreach (var ClientPlatformType in UniquePlatformTypes) { Agenda.AddTargets(Params.ProgramTargets.ToArray(), ClientPlatformType, BuildConfig, Params.CodeBasedUprojectPath); } } } UE4Build.Build(Agenda, InDeleteBuildProducts: Params.Clean, InUpdateVersionFiles: WorkingCL > 0); if (WorkingCL > 0) // only move UAT files if we intend to check in some build products { UE4Build.AddUATFilesToBuildProducts(); } UE4Build.CheckBuildProducts(UE4Build.BuildProductFiles); if (WorkingCL > 0) { // Sign everything we built CodeSign.SignMultipleIfEXEOrDLL(Command, UE4Build.BuildProductFiles); // Open files for add or edit UE4Build.AddBuildProductsToChangelist(WorkingCL, UE4Build.BuildProductFiles); } LogInformation("********** BUILD COMMAND COMPLETED **********"); }
public static void Cook(ProjectParams Params) { if ((!Params.Cook && !(Params.CookOnTheFly && !Params.SkipServer)) || Params.SkipCook) { return; } Params.ValidateAndLog(); Log("********** COOK COMMAND STARTED **********"); string UE4EditorExe = HostPlatform.Current.GetUE4ExePath(Params.UE4Exe); if (!FileExists(UE4EditorExe)) { throw new AutomationException("Missing " + UE4EditorExe + " executable. Needs to be built first."); } if (Params.CookOnTheFly && !Params.SkipServer) { if (Params.HasDLCName) { throw new AutomationException("Cook on the fly doesn't support cooking dlc"); } if (Params.ClientTargetPlatforms.Count > 0) { var LogFolderOutsideOfSandbox = GetLogFolderOutsideOfSandbox(); if (!GlobalCommandLine.Installed) { // In the installed runs, this is the same folder as CmdEnv.LogFolder so delete only in not-installed DeleteDirectory(LogFolderOutsideOfSandbox); CreateDirectory(LogFolderOutsideOfSandbox); } var ServerLogFile = CombinePaths(LogFolderOutsideOfSandbox, "Server.log"); Platform ClientPlatformInst = Params.ClientTargetPlatformInstances[0]; string TargetCook = ClientPlatformInst.GetCookPlatform(false, Params.HasDedicatedServerAndClient, Params.CookFlavor); ServerProcess = RunCookOnTheFlyServer(Params.RawProjectPath, Params.NoClient ? "" : ServerLogFile, TargetCook, Params.RunCommandline); if (ServerProcess != null) { Log("Waiting a few seconds for the server to start..."); Thread.Sleep(5000); } } else { throw new AutomationException("Failed to run, client target platform not specified"); } } else { var PlatformsToCook = new HashSet <string>(); if (!Params.NoClient) { foreach (var ClientPlatform in Params.ClientTargetPlatforms) { // Use the data platform, sometimes we will copy another platform's data var DataPlatform = Params.GetCookedDataPlatformForClientTarget(ClientPlatform); PlatformsToCook.Add(Params.GetTargetPlatformInstance(DataPlatform).GetCookPlatform(false, Params.HasDedicatedServerAndClient, Params.CookFlavor)); } } if (Params.DedicatedServer) { foreach (var ServerPlatform in Params.ServerTargetPlatforms) { // Use the data platform, sometimes we will copy another platform's data var DataPlatform = Params.GetCookedDataPlatformForServerTarget(ServerPlatform); PlatformsToCook.Add(Params.GetTargetPlatformInstance(DataPlatform).GetCookPlatform(true, false, Params.CookFlavor)); } } if (Params.Clean.HasValue && Params.Clean.Value && !Params.IterativeCooking) { Log("Cleaning cooked data."); CleanupCookedData(PlatformsToCook.ToList(), Params); } // cook the set of maps, or the run map, or nothing string[] Maps = null; if (Params.HasMapsToCook) { Maps = Params.MapsToCook.ToArray(); foreach (var M in Maps) { Log("HasMapsToCook " + M.ToString()); } foreach (var M in Params.MapsToCook) { Log("Params.HasMapsToCook " + M.ToString()); } } string[] Dirs = null; if (Params.HasDirectoriesToCook) { Dirs = Params.DirectoriesToCook.ToArray(); } string InternationalizationPreset = null; if (Params.HasInternationalizationPreset) { InternationalizationPreset = Params.InternationalizationPreset; } string[] Cultures = null; if (Params.HasCulturesToCook) { Cultures = Params.CulturesToCook.ToArray(); } try { var CommandletParams = "-buildmachine -fileopenlog"; if (Params.UnversionedCookedContent) { CommandletParams += " -unversioned"; } if (Params.FastCook) { CommandletParams += " -FastCook"; } if (Params.UseDebugParamForEditorExe) { CommandletParams += " -debug"; } if (Params.Manifests) { CommandletParams += " -manifests"; } if (Params.IterativeCooking) { CommandletParams += " -iterate"; } if (Params.CookMapsOnly) { CommandletParams += " -mapsonly"; } if (Params.NewCook) { CommandletParams += " -newcook"; } if (Params.OldCook) { CommandletParams += " -oldcook"; } if (Params.CookAll) { CommandletParams += " -cookall"; } if (Params.CookMapsOnly) { CommandletParams += " -mapsonly"; } if (Params.HasCreateReleaseVersion) { CommandletParams += " -createreleaseversion=" + Params.CreateReleaseVersion; } if (Params.HasDLCName) { CommandletParams += " -dlcname=" + Params.DLCName; if (!Params.DLCIncludeEngineContent) { CommandletParams += " -errorOnEngineContentUse"; } } // don't include the based on release version unless we are cooking dlc or creating a new release version // in this case the based on release version is used in packaging if (Params.HasBasedOnReleaseVersion && (Params.HasDLCName || Params.HasCreateReleaseVersion)) { CommandletParams += " -basedonreleaseversion=" + Params.BasedOnReleaseVersion; } // if we are not going to pak but we specified compressed then compress in the cooker ;) // otherwise compress the pak files if (!Params.Pak && !Params.SkipPak && Params.Compressed) { CommandletParams += " -compressed"; } if (Params.HasAdditionalCookerOptions) { string FormatedAdditionalCookerParams = Params.AdditionalCookerOptions.TrimStart(new char[] { '\"', ' ' }).TrimEnd(new char[] { '\"', ' ' }); CommandletParams += " "; CommandletParams += FormatedAdditionalCookerParams; } if (!Params.NoClient) { var MapsList = Maps == null ? new List <string>() : Maps.ToList(); foreach (var ClientPlatform in Params.ClientTargetPlatforms) { var DataPlatform = Params.GetCookedDataPlatformForClientTarget(ClientPlatform); CommandletParams += (Params.GetTargetPlatformInstance(DataPlatform).GetCookExtraCommandLine(Params)); MapsList.AddRange((Params.GetTargetPlatformInstance(ClientPlatform).GetCookExtraMaps())); } Maps = MapsList.ToArray(); } CookCommandlet(Params.RawProjectPath, Params.UE4Exe, Maps, Dirs, InternationalizationPreset, Cultures, CombineCommandletParams(PlatformsToCook.ToArray()), CommandletParams); } catch (Exception Ex) { if (Params.IgnoreCookErrors) { LogWarning("Ignoring cook failure."); } else { // Delete cooked data (if any) as it may be incomplete / corrupted. Log("Cook failed. Deleting cooked data."); CleanupCookedData(PlatformsToCook.ToList(), Params); AutomationTool.ErrorReporter.Error("Cook failed.", (int)AutomationTool.ErrorCodes.Error_UnknownCookFailure); throw Ex; } } } Log("********** COOK COMMAND COMPLETED **********"); }
protected ProjectParams SetupParams() { Log("Setting up ProjectParams for {0}", ProjectPath); var Params = new ProjectParams ( Command: this, // Shared RawProjectPath: ProjectPath ); // @rocket hack: non-code projects cannot run in Debug if (Params.Rocket && !ProjectUtils.IsCodeBasedUProjectFile(ProjectPath)) { if (Params.ClientConfigsToBuild.Contains(UnrealTargetConfiguration.Debug)) { Log("Non-code projects cannot run in Debug game clients. Defaulting to Development."); Params.ClientConfigsToBuild.Remove(UnrealTargetConfiguration.Debug); Params.ClientConfigsToBuild.Add(UnrealTargetConfiguration.Development); } if (Params.ClientConfigsToBuild.Contains(UnrealTargetConfiguration.Debug)) { Log("Non-code projects cannot run in Debug game servers. Defaulting to Development."); Params.ServerConfigsToBuild.Remove(UnrealTargetConfiguration.Debug); Params.ServerConfigsToBuild.Add(UnrealTargetConfiguration.Development); } } var DirectoriesToCook = ParseParamValue("cookdir"); if (!String.IsNullOrEmpty(DirectoriesToCook)) { Params.DirectoriesToCook = new ParamList <string>(DirectoriesToCook.Split('+')); } var InternationalizationPreset = ParseParamValue("i18npreset"); if (!String.IsNullOrEmpty(InternationalizationPreset)) { Params.InternationalizationPreset = InternationalizationPreset; } var CulturesToCook = ParseParamValue("cookcultures"); if (!String.IsNullOrEmpty(CulturesToCook)) { Params.CulturesToCook = new ParamList <string>(CulturesToCook.Split('+')); } if (Params.DedicatedServer) { foreach (var ServerPlatformInstance in Params.ServerTargetPlatformInstances) { ServerPlatformInstance.PlatformSetupParams(ref Params); } } else { foreach (var ClientPlatformInstance in Params.ClientTargetPlatformInstances) { ClientPlatformInstance.PlatformSetupParams(ref Params); } } Params.ValidateAndLog(); return(Params); }
public static void Cook(ProjectParams Params) { if ((!Params.Cook && !(Params.CookOnTheFly && !Params.SkipServer)) || Params.SkipCook) { return; } Params.ValidateAndLog(); Log("********** COOK COMMAND STARTED **********"); string UE4EditorExe = HostPlatform.Current.GetUE4ExePath(Params.UE4Exe); if (!FileExists(UE4EditorExe)) { throw new AutomationException("Missing " + UE4EditorExe + " executable. Needs to be built first."); } if (Params.CookOnTheFly && !Params.SkipServer) { if (Params.ClientTargetPlatforms.Count > 0) { var LogFolderOutsideOfSandbox = GetLogFolderOutsideOfSandbox(); if (!GlobalCommandLine.Installed) { // In the installed runs, this is the same folder as CmdEnv.LogFolder so delete only in not-installed DeleteDirectory(LogFolderOutsideOfSandbox); CreateDirectory(LogFolderOutsideOfSandbox); } var ServerLogFile = CombinePaths(LogFolderOutsideOfSandbox, "Server.log"); Platform ClientPlatformInst = Params.ClientTargetPlatformInstances[0]; string TargetCook = ClientPlatformInst.GetCookPlatform(false, Params.HasDedicatedServerAndClient, Params.CookFlavor); ServerProcess = RunCookOnTheFlyServer(Params.RawProjectPath, Params.NoClient ? "" : ServerLogFile, TargetCook, Params.RunCommandline); if (ServerProcess != null) { Log("Waiting a few seconds for the server to start..."); Thread.Sleep(5000); } } else { throw new AutomationException("Failed to run, client target platform not specified"); } } else { var PlatformsToCook = new HashSet <string>(); if (!Params.NoClient) { foreach (var ClientPlatform in Params.ClientTargetPlatforms) { // Use the data platform, sometimes we will copy another platform's data var DataPlatform = Params.GetCookedDataPlatformForClientTarget(ClientPlatform); PlatformsToCook.Add(Params.GetTargetPlatformInstance(DataPlatform).GetCookPlatform(false, Params.HasDedicatedServerAndClient, Params.CookFlavor)); } } if (Params.DedicatedServer) { foreach (var ServerPlatform in Params.ServerTargetPlatforms) { // Use the data platform, sometimes we will copy another platform's data var DataPlatform = Params.GetCookedDataPlatformForServerTarget(ServerPlatform); PlatformsToCook.Add(Params.GetTargetPlatformInstance(DataPlatform).GetCookPlatform(true, false, Params.CookFlavor)); } } if (Params.Clean.HasValue && Params.Clean.Value && !Params.IterativeCooking) { Log("Cleaning cooked data."); CleanupCookedData(PlatformsToCook.ToList(), Params); } // cook the set of maps, or the run map, or nothing string[] Maps = null; if (Params.HasMapsToCook) { Maps = Params.MapsToCook.ToArray(); } string[] Dirs = null; if (Params.HasDirectoriesToCook) { Dirs = Params.DirectoriesToCook.ToArray(); } string InternationalizationPreset = null; if (Params.HasInternationalizationPreset) { InternationalizationPreset = Params.InternationalizationPreset; } string[] Cultures = null; if (Params.HasCulturesToCook) { Cultures = Params.CulturesToCook.ToArray(); } try { var CommandletParams = "-buildmachine -Unversioned -fileopenlog"; if (Params.UseDebugParamForEditorExe) { CommandletParams += " -debug"; } if (Params.Manifests) { CommandletParams += " -manifests"; } if (Params.IterativeCooking) { CommandletParams += " -iterate"; } CookCommandlet(Params.RawProjectPath, Params.UE4Exe, Maps, Dirs, InternationalizationPreset, Cultures, CombineCommandletParams(PlatformsToCook.ToArray()), CommandletParams); } catch (Exception Ex) { // Delete cooked data (if any) as it may be incomplete / corrupted. Log("Cook failed. Deleting cooked data."); CleanupCookedData(PlatformsToCook.ToList(), Params); AutomationTool.ErrorReporter.Error("Cook failed.", (int)AutomationTool.ErrorCodes.Error_UnknownCookFailure); throw Ex; } } Log("********** COOK COMMAND COMPLETED **********"); }
public static void Cook(ProjectParams Params) { if ((!Params.Cook && !(Params.CookOnTheFly && !Params.SkipServer)) || Params.SkipCook) { return; } Params.ValidateAndLog(); Log("********** COOK COMMAND STARTED **********"); string UE4EditorExe = HostPlatform.Current.GetUE4ExePath(Params.UE4Exe); if (!FileExists(UE4EditorExe)) { throw new AutomationException("Missing " + UE4EditorExe + " executable. Needs to be built first."); } if (Params.CookOnTheFly && !Params.SkipServer) { if (Params.HasDLCName) { throw new AutomationException("Cook on the fly doesn't support cooking dlc"); } if (Params.ClientTargetPlatforms.Count > 0) { var LogFolderOutsideOfSandbox = GetLogFolderOutsideOfSandbox(); if (!GlobalCommandLine.Installed) { // In the installed runs, this is the same folder as CmdEnv.LogFolder so delete only in not-installed DeleteDirectory(LogFolderOutsideOfSandbox); CreateDirectory(LogFolderOutsideOfSandbox); } String COTFCommandLine = Params.RunCommandline; if (Params.IterativeCooking) { COTFCommandLine += " -iterate"; } if (Params.UseDebugParamForEditorExe) { COTFCommandLine += " -debug"; } var ServerLogFile = CombinePaths(LogFolderOutsideOfSandbox, "Server.log"); Platform ClientPlatformInst = Params.ClientTargetPlatformInstances[0]; string TargetCook = ClientPlatformInst.GetCookPlatform(false, false, Params.CookFlavor); // cook ont he fly doesn't support server cook platform... ServerProcess = RunCookOnTheFlyServer(Params.RawProjectPath, Params.NoClient ? "" : ServerLogFile, TargetCook, COTFCommandLine); if (ServerProcess != null) { Log("Waiting a few seconds for the server to start..."); Thread.Sleep(5000); } } else { throw new AutomationException("Failed to run, client target platform not specified"); } } else { var PlatformsToCook = new HashSet <string>(); if (!Params.NoClient) { foreach (var ClientPlatform in Params.ClientTargetPlatforms) { // Use the data platform, sometimes we will copy another platform's data var DataPlatform = Params.GetCookedDataPlatformForClientTarget(ClientPlatform); PlatformsToCook.Add(Params.GetTargetPlatformInstance(DataPlatform).GetCookPlatform(false, Params.Client, Params.CookFlavor)); } } if (Params.DedicatedServer) { foreach (var ServerPlatform in Params.ServerTargetPlatforms) { // Use the data platform, sometimes we will copy another platform's data var DataPlatform = Params.GetCookedDataPlatformForServerTarget(ServerPlatform); PlatformsToCook.Add(Params.GetTargetPlatformInstance(DataPlatform).GetCookPlatform(true, false, Params.CookFlavor)); } } if (Params.Clean.HasValue && Params.Clean.Value && !Params.IterativeCooking) { Log("Cleaning cooked data."); CleanupCookedData(PlatformsToCook.ToList(), Params); } // cook the set of maps, or the run map, or nothing string[] Maps = null; if (Params.HasMapsToCook) { Maps = Params.MapsToCook.ToArray(); foreach (var M in Maps) { Log("HasMapsToCook " + M.ToString()); } foreach (var M in Params.MapsToCook) { Log("Params.HasMapsToCook " + M.ToString()); } } string[] Dirs = null; if (Params.HasDirectoriesToCook) { Dirs = Params.DirectoriesToCook.ToArray(); } string InternationalizationPreset = null; if (Params.HasInternationalizationPreset) { InternationalizationPreset = Params.InternationalizationPreset; } string[] CulturesToCook = null; if (Params.HasCulturesToCook) { CulturesToCook = Params.CulturesToCook.ToArray(); } try { var CommandletParams = IsBuildMachine ? "-buildmachine -fileopenlog" : "-fileopenlog"; if (Params.UnversionedCookedContent) { CommandletParams += " -unversioned"; } if (Params.FastCook) { CommandletParams += " -FastCook"; } if (Params.UseDebugParamForEditorExe) { CommandletParams += " -debug"; } if (Params.Manifests) { CommandletParams += " -manifests"; } if (Params.IterativeCooking) { CommandletParams += " -iterate"; } if (Params.CookMapsOnly) { CommandletParams += " -mapsonly"; } if (Params.NewCook) { CommandletParams += " -newcook"; } if (Params.OldCook) { CommandletParams += " -oldcook"; } if (Params.CookAll) { CommandletParams += " -cookall"; } if (Params.HasCreateReleaseVersion) { CommandletParams += " -createreleaseversion=" + Params.CreateReleaseVersion; } if (Params.SkipCookingEditorContent) { CommandletParams += " -skipeditorcontent"; } if (Params.NumCookersToSpawn != 0) { CommandletParams += " -numcookerstospawn=" + Params.NumCookersToSpawn; } if (Params.HasDLCName) { CommandletParams += " -dlcname=" + Params.DLCName; if (!Params.DLCIncludeEngineContent) { CommandletParams += " -errorOnEngineContentUse"; } } // don't include the based on release version unless we are cooking dlc or creating a new release version // in this case the based on release version is used in packaging if (Params.HasBasedOnReleaseVersion && (Params.HasDLCName || Params.HasCreateReleaseVersion)) { CommandletParams += " -basedonreleaseversion=" + Params.BasedOnReleaseVersion; } // if we are not going to pak but we specified compressed then compress in the cooker ;) // otherwise compress the pak files if (!Params.Pak && !Params.SkipPak && Params.Compressed) { CommandletParams += " -compressed"; } // we provide the option for users to run a conversion on certain (script) assets, translating them // into native source code... the cooker needs to if (Params.RunAssetNativization) { CommandletParams += " -NativizeAssets"; // Store plugin paths now, it's easiest to do so while PlatformsToCook is still available: string ProjectDir = Params.RawProjectPath.Directory.ToString(); foreach (var Platform in PlatformsToCook) { // If you change this target path you must also update logic in CookOnTheFlyServer.cpp. Passing a single directory around is cumbersome for testing, so I have hard coded it. // Similarly if you change the .uplugin name you must update DefaultPluginName in BlueprintNativeCodeGenModule.cpp string GeneratedPluginPath = CombinePaths(GetDirectoryName(ProjectDir), "Intermediate", Platform, "NativizedAssets/NativizedAssets.uplugin"); Params.BlueprintPluginPaths.Add(new FileReference(GeneratedPluginPath)); } } if (Params.HasAdditionalCookerOptions) { string FormatedAdditionalCookerParams = Params.AdditionalCookerOptions.TrimStart(new char[] { '\"', ' ' }).TrimEnd(new char[] { '\"', ' ' }); CommandletParams += " "; CommandletParams += FormatedAdditionalCookerParams; } if (!Params.NoClient) { var MapsList = Maps == null ? new List <string>() : Maps.ToList(); foreach (var ClientPlatform in Params.ClientTargetPlatforms) { var DataPlatform = Params.GetCookedDataPlatformForClientTarget(ClientPlatform); CommandletParams += (Params.GetTargetPlatformInstance(DataPlatform).GetCookExtraCommandLine(Params)); MapsList.AddRange((Params.GetTargetPlatformInstance(ClientPlatform).GetCookExtraMaps())); } Maps = MapsList.ToArray(); } CookCommandlet(Params.RawProjectPath, Params.UE4Exe, Maps, Dirs, InternationalizationPreset, CulturesToCook, CombineCommandletParams(PlatformsToCook.ToArray()), CommandletParams); } catch (Exception Ex) { if (Params.IgnoreCookErrors) { LogWarning("Ignoring cook failure."); } else { // Delete cooked data (if any) as it may be incomplete / corrupted. Log("Cook failed. Deleting cooked data."); CleanupCookedData(PlatformsToCook.ToList(), Params); throw new AutomationException(ExitCode.Error_UnknownCookFailure, Ex, "Cook failed."); } } if (Params.HasDiffCookedContentPath) { try { DiffCookedContent(Params); } catch (Exception Ex) { // Delete cooked data (if any) as it may be incomplete / corrupted. Log("Cook failed. Deleting cooked data."); CleanupCookedData(PlatformsToCook.ToList(), Params); throw new AutomationException(ExitCode.Error_UnknownCookFailure, Ex, "Cook failed."); } } } Log("********** COOK COMMAND COMPLETED **********"); }
protected ProjectParams SetupParams() { Log("Setting up ProjectParams for {0}", ProjectPath); var Params = new ProjectParams ( Command: this, // Shared RawProjectPath: ProjectPath ); // Initialize map var Map = ParseParamValue("map"); if (Map == null) { LogVerbose("-map command line param not found, trying to find DefaultMap in INI."); Map = GetDefaultMap(Params); } if (!String.IsNullOrEmpty(Map)) { if (ParseParam("allmaps")) { Log("Cooking all maps"); } else { Params.MapsToCook = new ParamList <string>(Map); } Params.MapToRun = GetFirstMap(Map); } // @rocket hack: non-code projects cannot run in Debug if (Params.Rocket && !ProjectUtils.IsCodeBasedUProjectFile(ProjectPath)) { if (Params.ClientConfigsToBuild.Contains(UnrealTargetConfiguration.Debug)) { Log("Non-code projects cannot run in Debug game clients. Defaulting to Development."); Params.ClientConfigsToBuild.Remove(UnrealTargetConfiguration.Debug); Params.ClientConfigsToBuild.Add(UnrealTargetConfiguration.Development); } if (Params.ClientConfigsToBuild.Contains(UnrealTargetConfiguration.Debug)) { Log("Non-code projects cannot run in Debug game servers. Defaulting to Development."); Params.ServerConfigsToBuild.Remove(UnrealTargetConfiguration.Debug); Params.ServerConfigsToBuild.Add(UnrealTargetConfiguration.Development); } } var DirectoriesToCook = ParseParamValue("cookdir"); if (!String.IsNullOrEmpty(DirectoriesToCook)) { Params.DirectoriesToCook = new ParamList <string>(DirectoriesToCook.Split('+')); } var CulturesToCook = ParseParamValue("cookcultures"); if (!String.IsNullOrEmpty(CulturesToCook)) { Params.CulturesToCook = new ParamList <string>(CulturesToCook.Split('+')); } if (Params.DedicatedServer) { foreach (var ServerPlatformInstance in Params.ServerTargetPlatformInstances) { ServerPlatformInstance.PlatformSetupParams(ref Params); } } else { foreach (var ClientPlatformInstance in Params.ClientTargetPlatformInstances) { ClientPlatformInstance.PlatformSetupParams(ref Params); } } Params.ValidateAndLog(); return(Params); }