Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Scripts/WorldPartitionBuilder.Automation.cs
aurel cordonnier 34f55d3a4a Merge from Release-Engine-Test @ 17946149 to UE5/Main
This represents UE4/Main @17911760, Release-5.0 @17915875 and Dev-PerfTest @17914035

[CL 17949667 by aurel cordonnier in ue5-main branch]
2021-10-27 15:14:40 -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.GetUnrealExePath(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 ###");
}
}
}
}