You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Improvements to BenchmarkBuild script. - Added -editor-startup and -editor-game options to measure startup and startup time with -game - Renamed -pie to -editor-pie to match other editor options- - Allow different editor tests to use different sets of maps via -editor-startup=map2+map2, -editor-pie=map1+map2 etc - Added AllEditor option to run all editor benchmarking - Added -coldddc-noshared DDC option - BenchmarkBuild now defaults to cleaning each targets after benchmarking its build time to save disk space (disable with -nopostclean) - Moved Editor benchmark tests into separate files and reduced some duplicated code - Updated help info Other - Fixed UAT GetProjectProperties returning inaccurate values if called twice with different platforms - Doubled number of UBT logs that can be generated from a single UAT script - Allow scripts to call UnrealBuild.CleanWithUBT to perform cleanup - Simplified a lot of code #rb na #ROBOMERGE-AUTHOR: andrew.grant #ROBOMERGE-SOURCE: CL 21213895 via CL 21213903 via CL 21213910 via CL 21214414 via CL 21214472 #ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824) [CL 21214930 by andrew grant in ue5-main branch]
153 lines
3.8 KiB
C#
153 lines
3.8 KiB
C#
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
using AutomationTool;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using EpicGames.Core;
|
|
using UnrealBuildTool;
|
|
using UnrealBuildBase;
|
|
|
|
namespace AutomationTool.Benchmark
|
|
{
|
|
|
|
/// <summary>
|
|
/// Task that builds a target
|
|
/// </summary>
|
|
class BenchmarkBuildTask : BenchmarkTaskBase
|
|
{
|
|
private BuildTarget Command;
|
|
private UBTBuildOptions BuildOptions;
|
|
private FileReference ProjectFile;
|
|
private UnrealTargetPlatform TargetPlatform;
|
|
|
|
public static bool SupportsAcceleration
|
|
{
|
|
get
|
|
{
|
|
return BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64 ||
|
|
(BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac);
|
|
}
|
|
}
|
|
|
|
public static string AccelerationName
|
|
{
|
|
get
|
|
{
|
|
if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64)
|
|
{
|
|
return "XGE";
|
|
}
|
|
else if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac)
|
|
{
|
|
return "FASTBuild";
|
|
}
|
|
else
|
|
{
|
|
return "none";
|
|
}
|
|
}
|
|
}
|
|
|
|
public BenchmarkBuildTask(FileReference InProjectFile, string InTarget, UnrealTargetPlatform InPlatform, XGETaskOptions InXgeOption, string InUBTArgs="", int CoreCount=0, UBTBuildOptions InOptions = UBTBuildOptions.None)
|
|
{
|
|
bool IsVanillaUnreal = InProjectFile == null;
|
|
|
|
string ModuleName = IsVanillaUnreal ? "Unreal" : InProjectFile.GetFileNameWithoutAnyExtensions();
|
|
|
|
TaskName = string.Format("{0} Build {1} {2}", ModuleName, InTarget, InPlatform);
|
|
|
|
BuildOptions = InOptions;
|
|
ProjectFile = InProjectFile;
|
|
TargetPlatform = InPlatform;
|
|
|
|
Command = new BuildTarget();
|
|
Command.ProjectName = IsVanillaUnreal ? null : ModuleName;
|
|
Command.Platforms = TargetPlatform.ToString();
|
|
Command.Targets = InTarget;
|
|
Command.NoTools = true;
|
|
Command.UBTArgs = InUBTArgs;
|
|
|
|
bool WithAccel = InXgeOption == XGETaskOptions.WithXGE;
|
|
|
|
if (!WithAccel || !SupportsAcceleration)
|
|
{
|
|
string Arg = string.Format("No{0}", AccelerationName);
|
|
|
|
Command.UBTArgs += " -" + Arg;
|
|
//TaskModifiers.Add(Arg);
|
|
Command.Params = new[] { Arg }; // need to also pass it to this
|
|
|
|
if (CoreCount > 0)
|
|
{
|
|
TaskModifiers.Add(string.Format("{0}c", CoreCount));
|
|
|
|
Command.UBTArgs += string.Format(" -MaxParallelActions={0}", CoreCount);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TaskModifiers.Add(AccelerationName);
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(InUBTArgs))
|
|
{
|
|
TaskModifiers.Add(InUBTArgs);
|
|
}
|
|
}
|
|
|
|
protected bool CleanBuildTarget()
|
|
{
|
|
var BuildCommand = new UnrealBuild(null);
|
|
var BuildTarget = Command.ProjectTargetFromTargetName(
|
|
Command.Targets,
|
|
ProjectFile,
|
|
new [] { TargetPlatform },
|
|
new [] { UnrealTargetConfiguration.Development }
|
|
);
|
|
BuildCommand.CleanWithUBT(BuildTarget.TargetName, TargetPlatform, UnrealTargetConfiguration.Development, ProjectFile);
|
|
return true;
|
|
}
|
|
|
|
protected override bool PerformPrequisites()
|
|
{
|
|
if (!base.PerformPrequisites())
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if (BuildOptions.HasFlag(UBTBuildOptions.PreClean))
|
|
{
|
|
return CleanBuildTarget();
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
protected override bool PerformTask()
|
|
{
|
|
ExitCode Result = Command.Execute();
|
|
|
|
return Result == ExitCode.Success;
|
|
}
|
|
}
|
|
|
|
class BenchmarkCleanBuildTask : BenchmarkBuildTask
|
|
{
|
|
public BenchmarkCleanBuildTask(FileReference InProjectFile, string InTarget, UnrealTargetPlatform InPlatform)
|
|
: base(InProjectFile, InTarget, InPlatform, XGETaskOptions.None, "", 0, UBTBuildOptions.None)
|
|
{
|
|
string ModuleName = InProjectFile == null ? "Unreal" : InProjectFile.GetFileNameWithoutAnyExtensions();
|
|
TaskName = string.Format("{0} Clean {1} {2}", ModuleName, InTarget, InPlatform);
|
|
}
|
|
|
|
protected override bool PerformTask()
|
|
{
|
|
return CleanBuildTarget();
|
|
}
|
|
}
|
|
}
|
|
|