public override void ExecuteBuild() { SetupStaticBuildEnvironment(); bool bBuildSolutions = true; if (ParseParam("SkipBuildSolutions")) { bBuildSolutions = false; } bool bBuildLibraries = true; if (ParseParam("SkipBuild")) { bBuildLibraries = false; } bool bAutoCreateChangelist = true; if (ParseParam("SkipCreateChangelist")) { bAutoCreateChangelist = false; } bool bAutoSubmit = false; // bAutoCreateChangelist; if (ParseParam("SkipSubmit")) { bAutoSubmit = false; } // if we don't pass anything, we'll just merge by default string RobomergeCommand = ParseParamValue("Robomerge", "").ToLower(); if (!string.IsNullOrEmpty(RobomergeCommand)) { // for merge default action, add flag to make sure buildmachine commit isn't skipped if (RobomergeCommand == "merge") { RobomergeCommand = "#robomerge[all] #DisregardExcludedAuthors"; } // otherwise add hashtags else if (RobomergeCommand == "ignore") { RobomergeCommand = "#robomerge #ignore"; } else if (RobomergeCommand == "null") { RobomergeCommand = "#robomerge #null"; } // otherwise the submit will likely fail. else { throw new AutomationException("Invalid Robomerge param passed in {0}. Must be \"merge\", \"null\", or \"ignore\"", RobomergeCommand); } } // get the platforms we want to build for List <TargetPlatformData> TargetPlatforms = GetTargetPlatforms(); // get the platforms we want to build for List <WindowsCompiler> TargetWindowsCompilers = GetTargetWindowsCompilers(); // get the configurations we want to build for List <string> TargetConfigurations = GetTargetConfigurations(); if (bBuildSolutions) { // build target lib for all platforms foreach (TargetPlatformData TargetData in TargetPlatforms) { if (!PlatformSupportsTargetLib(TargetData)) { continue; } SetupBuildForTargetLibAndPlatform(TargetData, TargetConfigurations, TargetWindowsCompilers, false); } } HashSet <FileReference> FilesToReconcile = new HashSet <FileReference>(); if (bBuildLibraries) { // build target lib for all platforms foreach (TargetPlatformData TargetData in TargetPlatforms) { if (!PlatformSupportsTargetLib(TargetData)) { continue; } HashSet <FileReference> FilesToDelete = new HashSet <FileReference>(); foreach (string TargetConfiguration in TargetConfigurations) { // Delete output files before building them if (TargetData.Platform == UnrealTargetPlatform.Win64) { foreach (WindowsCompiler TargetCompiler in TargetWindowsCompilers) { FindOutputFiles(FilesToDelete, TargetData, TargetConfiguration, TargetCompiler); } } else { FindOutputFiles(FilesToDelete, TargetData, TargetConfiguration); } } foreach (FileReference FileToDelete in FilesToDelete) { FilesToReconcile.Add(FileToDelete); InternalUtils.SafeDeleteFile(FileToDelete.ToString()); } BuildTargetLibForPlatform(TargetData, TargetConfigurations, TargetWindowsCompilers); if (DoesPlatformUseMSBuild(TargetData)) { foreach (WindowsCompiler TargetWindowsCompiler in TargetWindowsCompilers) { CopyLibsToFinalDestination(TargetData, TargetConfigurations, TargetWindowsCompiler); } } else { CopyLibsToFinalDestination(TargetData, TargetConfigurations); } } } int P4ChangeList = InvalidChangeList; if (bAutoCreateChangelist) { string RobomergeLine = string.Empty; if (!string.IsNullOrEmpty(RobomergeCommand)) { RobomergeLine = Environment.NewLine + RobomergeCommand; } P4ChangeList = P4.CreateChange(P4Env.Client, "BuildHlslcc.Automation: Deploying hlslcc libs." + Environment.NewLine + "#rb none" + Environment.NewLine + "#lockdown Nick.Penwarden" + Environment.NewLine + "#tests none" + Environment.NewLine + "#jira none" + Environment.NewLine + "#okforgithub ignore" + RobomergeLine); } if (P4ChangeList != InvalidChangeList) { foreach (string TargetConfiguration in TargetConfigurations) { //Add any new files that p4 is not yet tracking. foreach (TargetPlatformData TargetData in TargetPlatforms) { if (!PlatformSupportsTargetLib(TargetData)) { continue; } if (TargetData.Platform == UnrealTargetPlatform.Win64) { foreach (WindowsCompiler TargetCompiler in TargetWindowsCompilers) { FindOutputFiles(FilesToReconcile, TargetData, TargetConfiguration, TargetCompiler); } } else { FindOutputFiles(FilesToReconcile, TargetData, TargetConfiguration); } } } foreach (FileReference FileToReconcile in FilesToReconcile) { P4.Reconcile(P4ChangeList, FileToReconcile.ToString()); } } if (bAutoSubmit && (P4ChangeList != InvalidChangeList)) { if (!P4.TryDeleteEmptyChange(P4ChangeList)) { LogInformation("Submitting changelist " + P4ChangeList.ToString()); int SubmittedChangeList = InvalidChangeList; P4.Submit(P4ChangeList, out SubmittedChangeList); } else { LogInformation("Nothing to submit!"); } } }
public override void ExecuteBuild() { bool bAutoCreateChangelist = true; if (ParseParam("SkipCreateChangelist")) { bAutoCreateChangelist = false; } bool bAutoSubmit = bAutoCreateChangelist; if (ParseParam("SkipSubmit")) { bAutoSubmit = false; } // if we don't pass anything, we'll just merge by default string RobomergeCommand = ParseParamValue("Robomerge", "").ToLower(); if (!string.IsNullOrEmpty(RobomergeCommand)) { // for merge default action, add flag to make sure buildmachine commit isn't skipped if (RobomergeCommand == "merge") { RobomergeCommand = "#robomerge[all] #DisregardExcludedAuthors"; } // otherwise add hashtags else if (RobomergeCommand == "ignore") { RobomergeCommand = "#robomerge #ignore"; } else if (RobomergeCommand == "null") { RobomergeCommand = "#robomerge #null"; } // otherwise the submit will likely fail. else { throw new AutomationException("Invalid Robomerge param passed in {0}. Must be \"merge\", \"null\", or \"ignore\"", RobomergeCommand); } } SetupBuildEnvironment(); TargetPlatform Platform = GetTargetPlatform(); TargetLib TargetLib = GetTargetLib(); List <string> TargetConfigurations = GetTargetConfigurations(); if (Platform.SeparateProjectPerConfig) { foreach (string TargetConfiguration in TargetConfigurations) { Platform.SetupTargetLib(TargetLib, TargetConfiguration); } } else { Platform.SetupTargetLib(TargetLib, null); } HashSet <FileReference> FilesToReconcile = new HashSet <FileReference>(); foreach (string TargetConfiguration in TargetConfigurations) { foreach (FileReference FileToDelete in Platform.EnumerateOutputFiles(TargetLib, TargetConfiguration).Distinct()) { FilesToReconcile.Add(FileToDelete); // Also clean the output files InternalUtils.SafeDeleteFile(FileToDelete.FullName); } } foreach (string TargetConfiguration in TargetConfigurations) { Platform.BuildTargetLib(TargetLib, TargetConfiguration); } Platform.CleanupTargetLib(TargetLib, null); const int InvalidChangeList = -1; int P4ChangeList = InvalidChangeList; if (bAutoCreateChangelist) { string LibDeploymentDesc = TargetLib.Name + " " + Platform.FriendlyName; var Builder = new StringBuilder(); Builder.AppendFormat("BuildCMakeLib.Automation: Deploying {0} libs.{1}", LibDeploymentDesc, Environment.NewLine); Builder.AppendLine("#rb none"); Builder.AppendLine("#lockdown Nick.Penwarden"); Builder.AppendLine("#tests none"); Builder.AppendLine("#jira none"); Builder.AppendLine("#okforgithub ignore"); if (!string.IsNullOrEmpty(RobomergeCommand)) { Builder.AppendLine(RobomergeCommand); } P4ChangeList = P4.CreateChange(P4Env.Client, Builder.ToString()); } if (P4ChangeList != InvalidChangeList) { foreach (FileReference FileToReconcile in FilesToReconcile) { P4.Reconcile(P4ChangeList, FileToReconcile.FullName); } if (bAutoSubmit) { if (!P4.TryDeleteEmptyChange(P4ChangeList)) { LogInformation("Submitting changelist " + P4ChangeList.ToString()); int SubmittedChangeList = InvalidChangeList; P4.Submit(P4ChangeList, out SubmittedChangeList); } else { LogInformation("Nothing to submit!"); } } } }