/// <summary> /// Execute all the tasks added to this executor. /// </summary> /// <param name="Job">Information about the current job</param> /// <param name="BuildProducts">Set of build products produced by this node.</param> /// <param name="TagNameToFileSet">Mapping from tag names to the set of files they include</param> /// <returns>Whether the task succeeded or not. Exiting with an exception will be caught and treated as a failure.</returns> public void Execute(JobContext Job, HashSet <FileReference> BuildProducts, Dictionary <string, HashSet <FileReference> > TagNameToFileSet) { // Create the agenda UE4Build.BuildAgenda Agenda = new UE4Build.BuildAgenda(); Agenda.Targets.AddRange(Targets); // Build everything Dictionary <UE4Build.BuildTarget, BuildManifest> TargetToManifest = new Dictionary <UE4Build.BuildTarget, BuildManifest>(); UE4Build Builder = new UE4Build(Job.OwnerCommand); bool bCanUseParallelExecutor = (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64 && bAllowParallelExecutor); // parallel executor is only available on Windows as of 2016-09-22 Builder.Build(Agenda, InDeleteBuildProducts: null, InUpdateVersionFiles: false, InForceNoXGE: !bAllowXGE, InUseParallelExecutor: bCanUseParallelExecutor, InTargetToManifest: TargetToManifest); UE4Build.CheckBuildProducts(Builder.BuildProductFiles); // Tag all the outputs foreach (KeyValuePair <UE4Build.BuildTarget, string> TargetTagName in TargetToTagName) { BuildManifest Manifest; if (!TargetToManifest.TryGetValue(TargetTagName.Key, out Manifest)) { throw new AutomationException("Missing manifest for target {0} {1} {2}", TargetTagName.Key.TargetName, TargetTagName.Key.Platform, TargetTagName.Key.Config); } foreach (string TagName in CustomTask.SplitDelimitedList(TargetTagName.Value)) { HashSet <FileReference> FileSet = CustomTask.FindOrAddTagSet(TagNameToFileSet, TagName); FileSet.UnionWith(Manifest.BuildProducts.Select(x => new FileReference(x))); } } // Add everything to the list of build products BuildProducts.UnionWith(Builder.BuildProductFiles.Select(x => new FileReference(x))); }
/// <summary> /// Execute the task. /// </summary> /// <param name="Job">Information about the current job</param> /// <param name="BuildProducts">Set of build products produced by this node.</param> /// <param name="TagNameToFileSet">Mapping from tag names to the set of files they include</param> /// <returns>True if the task succeeded</returns> public override bool Execute(JobContext Job, HashSet <FileReference> BuildProducts, Dictionary <string, HashSet <FileReference> > TagNameToFileSet) { // Create the agenda UE4Build.BuildAgenda Agenda = new UE4Build.BuildAgenda(); Agenda.Targets.AddRange(Targets); // Build everything Dictionary <UE4Build.BuildTarget, BuildManifest> TargetToManifest = new Dictionary <UE4Build.BuildTarget, BuildManifest>(); UE4Build Builder = new UE4Build(Job.OwnerCommand); Builder.Build(Agenda, InDeleteBuildProducts: false, InUpdateVersionFiles: false, InForceNoXGE: false, InUseParallelExecutor: true, InTargetToManifest: TargetToManifest); UE4Build.CheckBuildProducts(Builder.BuildProductFiles); // Tag all the outputs foreach (KeyValuePair <UE4Build.BuildTarget, string> TargetTagName in TargetToTagName) { BuildManifest Manifest; if (!TargetToManifest.TryGetValue(TargetTagName.Key, out Manifest)) { throw new AutomationException("Missing manifest for target {0} {1} {2}", TargetTagName.Key.TargetName, TargetTagName.Key.Platform, TargetTagName.Key.Config); } HashSet <FileReference> FileSet = FindOrAddTagSet(TagNameToFileSet, TargetTagName.Value); FileSet.UnionWith(Manifest.BuildProducts.Select(x => new FileReference(x))); FileSet.UnionWith(Manifest.LibraryBuildProducts.Select(x => new FileReference(x))); } // Add everything to the list of build products BuildProducts.UnionWith(Builder.BuildProductFiles.Select(x => new FileReference(x))); BuildProducts.UnionWith(Builder.LibraryBuildProductFiles.Select(x => new FileReference(x))); return(true); }
/// <summary> /// Execute the task and compile these targets. /// </summary> /// <param name="BuildProducts">Current list of build products for this node</param> /// <returns>True if the task succeeded</returns> public override bool Execute(List <string> BuildProducts) { UE4Build Builder = new UE4Build(null); UE4Build.BuildAgenda Agenda = new UE4Build.BuildAgenda(); Agenda.Targets.AddRange(Targets); Builder.Build(Agenda, InDeleteBuildProducts: false, InUpdateVersionFiles: false, InForceNoXGE: true, InForceUnity: true, InUseParallelExecutor: false); UE4Build.CheckBuildProducts(Builder.BuildProductFiles); BuildProducts.AddRange(Builder.BuildProductFiles); return(true); }
public override void ExecuteBuild() { Log("************************* BuildCommonTools"); // Get the list of platform names string[] PlatformNames = ParseParamValue("platforms", BuildHostPlatform.Current.Platform.ToString()).Split('+'); // Parse the platforms List <UnrealBuildTool.UnrealTargetPlatform> Platforms = new List <UnrealTargetPlatform>(); foreach (string PlatformName in PlatformNames) { UnrealBuildTool.UnrealTargetPlatform Platform; if (!UnrealBuildTool.UnrealTargetPlatform.TryParse(PlatformName, out Platform)) { throw new AutomationException("Unknown platform specified on command line - '{0}' - valid platforms are {1}", PlatformName, String.Join("/", Enum.GetNames(typeof(UnrealBuildTool.UnrealTargetPlatform)))); } Platforms.Add(Platform); } // Get the agenda UE4Build.BuildAgenda Agenda = MakeAgenda(Platforms.ToArray()); // Build everything. We don't want to touch version files for GitHub builds -- these are "programmer builds" and won't have a canonical build version UE4Build Builder = new UE4Build(this); Builder.Build(Agenda, InDeleteBuildProducts: true, InUpdateVersionFiles: false); // Add UAT and UBT to the build products Builder.AddUATFilesToBuildProducts(); Builder.AddUBTFilesToBuildProducts(); // Make sure all the build products exist UE4Build.CheckBuildProducts(Builder.BuildProductFiles); // Write the manifest if needed string ManifestPath = ParseParamValue("manifest"); if (ManifestPath != null) { UnrealBuildTool.FileManifest Manifest = new UnrealBuildTool.FileManifest(); foreach (string BuildProductFile in Builder.BuildProductFiles) { Manifest.AddFileName(BuildProductFile); } UnrealBuildTool.Utils.WriteClass(Manifest, ManifestPath, ""); } }
// Broken down steps used to run the process. #region RebuildHLOD Process Steps private void BuildNecessaryTargets() { LogInformation("Running Step:- RebuildHLOD::BuildNecessaryTargets"); UE4Build.BuildAgenda Agenda = new UE4Build.BuildAgenda(); Agenda.AddTarget("UnrealHeaderTool", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development); Agenda.AddTarget("ShaderCompileWorker", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development); Agenda.AddTarget(CommandletTargetName, UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development); try { UE4Build Builder = new UE4Build(this); Builder.Build(Agenda, InDeleteBuildProducts: true, InUpdateVersionFiles: true, InForceNoXGE: false, InChangelistNumberOverride: GetLatestCodeChange()); UE4Build.CheckBuildProducts(Builder.BuildProductFiles); } catch (AutomationException) { LogError("Rebuild HLOD for Maps has failed."); throw; } }
// Broken down steps used to run the process. #region RebuildLightMaps Process Steps private void BuildNecessaryTargets() { Log("Running Step:- RebuildLightMaps::BuildNecessaryTargets"); UE4Build.BuildAgenda Agenda = new UE4Build.BuildAgenda(); Agenda.AddTarget("ShaderCompileWorker", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development); Agenda.AddTarget("UnrealLightmass", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development); Agenda.AddTarget(CommandletTargetName, UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development); try { UE4Build Builder = new UE4Build(this); Builder.Build(Agenda, InDeleteBuildProducts: true, InUpdateVersionFiles: true, InForceNoXGE: false); UE4Build.CheckBuildProducts(Builder.BuildProductFiles); } catch (AutomationException Ex) { LogError("Rebuild Light Maps has failed."); throw Ex; } }
private static void BuildProduct(BuildCommand Command, UE4Build.BuildTarget Target) { if (Target == null) { throw new AutomationException("Target is required when calling UE4BuildUtils.BuildProduct"); } Log("Building {0}", Target.TargetName); if (Command == null) { Command = new UE4BuildUtilDummyBuildCommand(); } var UE4Build = new UE4Build(Command); var Agenda = new UE4Build.BuildAgenda(); Agenda.Targets.Add(Target); UE4Build.Build(Agenda, InDeleteBuildProducts: true, InUpdateVersionFiles: true); UE4Build.CheckBuildProducts(UE4Build.BuildProductFiles); }
/// <summary> /// Builds BuildPatchTool for the specified platform. /// </summary> /// <param name="Command"></param> /// <param name="InPlatform"></param> public static void BuildBuildPatchTool(BuildCommand Command, UnrealBuildTool.UnrealTargetPlatform InPlatform) { Log("Building BuildPatchTool"); if (Command == null) { Command = new UE4BuildUtilDummyBuildCommand(); } var UE4Build = new UE4Build(Command); var Agenda = new UE4Build.BuildAgenda(); Agenda.Targets.Add(new UE4Build.BuildTarget() { ProjectName = "", TargetName = "BuildPatchTool", Platform = InPlatform, Config = UnrealBuildTool.UnrealTargetConfiguration.Development, }); UE4Build.Build(Agenda, InDeleteBuildProducts: true, InUpdateVersionFiles: true); UE4Build.CheckBuildProducts(UE4Build.BuildProductFiles); }
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 override void ExecuteBuild() { int WorkingCL = -1; if (P4Enabled && AllowSubmit) { string CmdLine = ""; foreach (var Arg in Params) { CmdLine += Arg.ToString() + " "; } WorkingCL = P4.CreateChange(P4Env.Client, String.Format("MegaXGE build from changelist {0} - Params: {1}", P4Env.Changelist, CmdLine)); } LogInformation("************************* MegaXGE"); bool Clean = ParseParam("Clean"); string CleanToolLocation = CombinePaths(CmdEnv.LocalRoot, "Engine", "Build", "Batchfiles", "Clean.bat"); bool ShowProgress = ParseParam("Progress"); var UE4Build = new UE4Build(this); var Agenda = new UE4Build.BuildAgenda(); // we need to always build UHT when we use mega XGE var ProgramTargets = new string[] { "UnrealHeaderTool", }; Agenda.AddTargets(ProgramTargets, UnrealTargetPlatform.Win64, UnrealTargetConfiguration.Development); if (Clean) { LogSetProgress(ShowProgress, "Cleaning previous builds..."); foreach (var CurTarget in ProgramTargets) { string Args = String.Format("{0} {1} {2}", CurTarget, UnrealTargetPlatform.Win64.ToString(), UnrealTargetConfiguration.Development.ToString()); RunAndLog(CmdEnv, CleanToolLocation, Args); } } LogInformation("*************************"); for (int Arg = 1; Arg < 100; Arg++) { string Parm = String.Format("Target{0}", Arg); string Target = ParseParamValue(Parm, ""); if (String.IsNullOrEmpty(Target)) { break; } FileReference ProjectFile = null; string ProjectFileParam = ParseParamValue(String.Format("Project{0}", Arg), null); if (ProjectFileParam != null) { ProjectFile = new FileReference(ProjectFileParam); if (!FileReference.Exists(ProjectFile)) { throw new AutomationException("Project file '{0}' could not be found"); } } var Parts = Target.Split(' '); string JustTarget = Parts[0]; if (String.IsNullOrEmpty(JustTarget)) { throw new AutomationException("BUILD FAILED target option '{0}' not parsed.", Target); } var Targets = JustTarget.Split('|'); if (Targets.Length < 1) { throw new AutomationException("BUILD FAILED target option '{0}' not parsed.", Target); } var Platforms = new List <UnrealTargetPlatform>(); var Configurations = new List <UnrealTargetConfiguration>(); for (int Part = 1; Part < Parts.Length; Part++) { if (!String.IsNullOrEmpty(Parts[Part])) { var SubParts = Parts[Part].Split('|'); foreach (var SubPart in SubParts) { UnrealTargetPlatform Platform; if (UnrealTargetPlatform.TryParse(SubPart, out Platform)) { Platforms.Add(Platform); } else { switch (SubPart.ToUpperInvariant()) { case "DEBUG": Configurations.Add(UnrealTargetConfiguration.Debug); break; case "DEBUGGAME": Configurations.Add(UnrealTargetConfiguration.DebugGame); break; case "DEVELOPMENT": Configurations.Add(UnrealTargetConfiguration.Development); break; case "SHIPPING": Configurations.Add(UnrealTargetConfiguration.Shipping); break; case "TEST": Configurations.Add(UnrealTargetConfiguration.Test); break; default: throw new AutomationException("BUILD FAILED target option {0} not recognized.", SubPart); } } } } } if (Platforms.Count < 1) { Platforms.Add(UnrealTargetPlatform.Win64); } if (Configurations.Count < 1) { Configurations.Add(UnrealTargetConfiguration.Development); } foreach (var Platform in Platforms) { foreach (var CurTarget in Targets) { foreach (var Configuration in Configurations) { Agenda.AddTargets(new string[] { CurTarget }, Platform, Configuration, ProjectFile); LogInformation("Target {0} {1} {2}", CurTarget, Platform.ToString(), Configuration.ToString()); if (Clean) { string Args = String.Format("{0} {1} {2}", CurTarget, Platform.ToString(), Configuration.ToString()); RunAndLog(CmdEnv, CleanToolLocation, Args); } } } } } LogInformation("*************************"); UE4Build.Build(Agenda, InUpdateVersionFiles: IsBuildMachine, InUseParallelExecutor: ParseParam("useparallelexecutor"), InShowProgress: ShowProgress); // if (WorkingCL > 0) // only move UAT files if we intend to check in some build products // { // UE4Build.CopyUATFilesAndAddToBuildProducts(); // } UE4Build.CheckBuildProducts(UE4Build.BuildProductFiles); if (WorkingCL > 0) { // Sign everything we built CodeSign.SignMultipleIfEXEOrDLL(this, UE4Build.BuildProductFiles); // Open files for add or edit UE4Build.AddBuildProductsToChangelist(WorkingCL, UE4Build.BuildProductFiles); int SubmittedCL; P4.Submit(WorkingCL, out SubmittedCL, true, true); } PrintRunTime(); }
public override void ExecuteBuild() { Log("************************* BuildCommonTools"); // Get the list of platform names string[] PlatformNames = ParseParamValue("platforms", BuildHostPlatform.Current.Platform.ToString()).Split('+'); // Parse the platforms List <UnrealBuildTool.UnrealTargetPlatform> Platforms = new List <UnrealTargetPlatform>(); foreach (string PlatformName in PlatformNames) { UnrealBuildTool.UnrealTargetPlatform Platform; if (!UnrealBuildTool.UnrealTargetPlatform.TryParse(PlatformName, true, out Platform)) { throw new AutomationException("Unknown platform specified on command line - '{0}' - valid platforms are {1}", PlatformName, String.Join("/", Enum.GetNames(typeof(UnrealBuildTool.UnrealTargetPlatform)))); } Platforms.Add(Platform); } // Add all the platforms if specified if (ParseParam("allplatforms")) { foreach (UnrealTargetPlatform Platform in Enum.GetValues(typeof(UnrealTargetPlatform))) { if (!Platforms.Contains(Platform)) { Platforms.Add(Platform); } } } // Get the agenda List <string> ExtraBuildProducts = new List <string>(); UE4Build.BuildAgenda Agenda = MakeAgenda(Platforms.ToArray(), ExtraBuildProducts); // Build everything. We don't want to touch version files for GitHub builds -- these are "programmer builds" and won't have a canonical build version UE4Build Builder = new UE4Build(this); Builder.Build(Agenda, InUpdateVersionFiles: false); // Add UAT and UBT to the build products Builder.AddUATFilesToBuildProducts(); Builder.AddUBTFilesToBuildProducts(); // Add all the extra build products foreach (string ExtraBuildProduct in ExtraBuildProducts) { Builder.AddBuildProduct(ExtraBuildProduct); } // Make sure all the build products exist UE4Build.CheckBuildProducts(Builder.BuildProductFiles); // Write the manifest if needed string ManifestPath = ParseParamValue("manifest"); if (ManifestPath != null) { SortedSet <string> Files = new SortedSet <string>(); foreach (string BuildProductFile in Builder.BuildProductFiles) { Files.Add(BuildProductFile); } File.WriteAllLines(ManifestPath, Files.ToArray()); } }
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 override void ExecuteBuild() { // get the project var UProjectFileName = ParseParamValue("Project"); if (UProjectFileName == null) { throw new AutomationException("Project was not specified via the -project argument."); } // Get the list of targets var TargetList = ParseParamList("Target"); if (TargetList == null) { throw new AutomationException("Target was not specified via the -target argument."); } // get the list of platforms var PlatformList = ParseParamList("TargetPlatforms", "Win64"); List <UnrealTargetPlatform> TargetPlatforms = new List <UnrealTargetPlatform>(); foreach (string Platform in PlatformList) { TargetPlatforms.Add((UnrealTargetPlatform)Enum.Parse(typeof(UnrealTargetPlatform), Platform, true)); } // get the list configurations var ConfigList = ParseParamList("Config", "Development"); List <UnrealTargetConfiguration> ConfigsToBuild = new List <UnrealTargetConfiguration>(); foreach (string Config in ConfigList) { ConfigsToBuild.Add((UnrealTargetConfiguration)Enum.Parse(typeof(UnrealTargetConfiguration), Config, true)); } // parse any extra parameters bool bClean = ParseParam("Clean"); int WorkingCL = ParseParamInt("P4Change"); FileReference UProjectFileReference = new FileReference(UProjectFileName); // add the targets to the agenda // verify the targets and add them to the agenda var Properties = ProjectUtils.GetProjectProperties(UProjectFileReference); UE4Build.BuildAgenda Agenda = new UE4Build.BuildAgenda(); foreach (string Target in TargetList) { SingleTargetProperties TargetData; if (!Properties.Targets.TryGetValue((TargetRules.TargetType)Enum.Parse(typeof(TargetRules.TargetType), Target), out TargetData)) { throw new AutomationException("Project does not support specified target: {0}", Target); } foreach (UnrealTargetPlatform TargetPlatform in TargetPlatforms) { if (TargetData.Rules.SupportsPlatform(TargetPlatform)) { List <UnrealTargetConfiguration> SupportedConfigurations = new List <UnrealTargetConfiguration>(); TargetData.Rules.GetSupportedConfigurations(ref SupportedConfigurations, true); foreach (UnrealTargetConfiguration TargetConfig in ConfigsToBuild) { if (SupportedConfigurations.Contains(TargetConfig)) { Agenda.AddTarget(TargetData.TargetName, TargetPlatform, TargetConfig, UProjectFileReference); } else { Log("{0} doesn't support the {1} configuration. It will not be built.", TargetData.TargetName, TargetConfig); } } } else { Log("{0} doesn't support the {1} platform. It will not be built.", TargetData.TargetName, TargetPlatform); } } } // build it UE4Build Build = new UE4Build(this); Build.Build(Agenda, InDeleteBuildProducts: bClean, InUpdateVersionFiles: WorkingCL > 0); if (WorkingCL > 0) // only move UAT files if we intend to check in some build products { Build.AddUATFilesToBuildProducts(); } UE4Build.CheckBuildProducts(Build.BuildProductFiles); if (WorkingCL > 0) { // Sign everything we built CodeSign.SignMultipleIfEXEOrDLL(this, Build.BuildProductFiles); // Open files for add or edit UE4Build.AddBuildProductsToChangelist(WorkingCL, Build.BuildProductFiles); } }