Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Scripts/WorldPartitionBuilder.Automation.cs
sebastien lussier aa04f904c1 Added HLOD & Minimap build scripts
Unified "-AutoSubmit" option
#rb jeanfrancois.dube

#ROBOMERGE-AUTHOR: sebastien.lussier
#ROBOMERGE-SOURCE: CL 20488942 via CL 20488950 via CL 20488969
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v954-20466795)

[CL 20490641 by sebastien lussier in ue5-main branch]
2022-06-03 14:48:01 -04:00

73 lines
2.7 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
{
[Help("Execute a World Partition builder")]
[Help("Builder=<Name>", "Name of the builder to run")]
[Help("CommandletArgs=<value>", "Arguments to provide to the builder commandlet")]
[Help("Submit", "If the files modified by the builder should be submitted at the end of the process")]
[Help("ShelveUser=<Name>", "If provided (along with -ShelveWorkspace, modified files will be shelved for the P4 User in the specified Workspace.")]
[Help("ShelveWorkspace=<Name>", "If provided (along with -ShelveUser, modified files will be shelved for the P4 User in the specified Workspace.")]
public class WorldPartitionBuilder : BuildCommand
{
public override void ExecuteBuild()
{
string Builder = ParseRequiredStringParam("Builder");
string CommandletArgs = ParseOptionalStringParam("CommandletArgs");
bool bSubmitResult = ParseParam("Submit");
string ShelveUser = ParseOptionalStringParam("ShelveUser");
string ShelveWorkspace = ParseOptionalStringParam("ShelveWorkspace");
bool bShelveResult = !String.IsNullOrEmpty(ShelveUser) && !String.IsNullOrEmpty(ShelveWorkspace);
if (!P4Enabled && (bSubmitResult || bShelveResult))
{
LogError("P4 required to submit or shelve build results");
return;
}
CommandletArgs = "-Builder=" + Builder + " " + CommandletArgs;
if (bSubmitResult)
{
CommandletArgs += " -AutoSubmit";
}
string EditorExe = "UnrealEditor-Cmd.exe";
EditorExe = AutomationTool.HostPlatform.Current.GetUnrealExePath(EditorExe);
FileReference ProjectPath = ParseProjectParam();
// Execute the commandlet - Will throw an exception on failures
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 ###");
}
}
}
}