Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Scripts/WorldPartitionBuilder.Automation.cs
sebastien lussier 423743fd4a Horde HLOD build -
* Added option to shelve the build result to the workspace of a specific user (skipping the submit)
* Created a generic WorldPartitionBuilder BuildGraph command that will allow this kind of operation on any WP builder
* Added a P4.UpdateChange() overload that takes a client (workspace) argument
* Renamed the HLOD_Submit step to HLOD_Finalize, as it can either: gather files from multiple builders locally without submitting / submit the result / shelve the result
#rb richard.malo
#preflight 61376e1fd9c85a000127042c

#ROBOMERGE-AUTHOR: sebastien.lussier
#ROBOMERGE-SOURCE: CL 17444676 via CL 17446080
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v870-17433530)

[CL 17446098 by sebastien lussier in ue5-release-engine-test branch]
2021-09-07 12:25:39 -04:00

65 lines
2.0 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using AutomationTool;
using EpicGames.Core;
using System;
using System.Diagnostics;
using System.Threading;
namespace AutomationScripts.Automation
{
public class WorldPartitionBuilder : BuildCommand
{
public override void ExecuteBuild()
{
string Builder = ParseRequiredStringParam("Builder");
string CommandletArgs = ParseOptionalStringParam("CommandletArgs");
bool bSubmit = ParseParam("Submit");
string ShelveUser = ParseOptionalStringParam("ShelveUser");
string ShelveWorkspace = ParseOptionalStringParam("ShelveWorkspace");
bool bShelveResult = !String.IsNullOrEmpty(ShelveUser) && !String.IsNullOrEmpty(ShelveWorkspace);
if (!P4Enabled && (bSubmit || bShelveResult))
{
LogError("P4 required to submit or shelve build results");
return;
}
CommandletArgs = "-Builder=" + Builder + " " + CommandletArgs;
if (bSubmit)
{
CommandletArgs += " -Submit";
}
string EditorExe = "UnrealEditor-Cmd.exe";
EditorExe = AutomationTool.HostPlatform.Current.GetUE4ExePath(EditorExe);
FileReference ProjectPath = ParseProjectParam();
RunCommandlet(ProjectPath, EditorExe, "WorldPartitionBuilderCommandlet", CommandletArgs);
if (bShelveResult)
{
LogInformation("### Shelving build results ###");
// Create a new changelist and move all checked out files to it
LogInformation("Creating pending changelist to shelve builder changes");
int PendingCL = P4.CreateChange(P4Env.Client);
P4.LogP4("", $"reopen -c {PendingCL} //...", AllowSpew: true);
// Shelve changelist & revert changes
LogInformation("Shelving changes...");
P4.Shelve(PendingCL);
LogInformation("Reverting local changes...");
P4.Revert($"-w -c {PendingCL} //...");
// Assign shelve to the provided user+workspace
LogInformation($"Changing ownership of CL {PendingCL} to user {ShelveUser}, workspace {ShelveWorkspace}");
P4.UpdateChange(PendingCL, ShelveUser, ShelveWorkspace, null, true);
LogInformation("### Shelving completed ###");
}
}
}
}