Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Scripts/BenchmarkBuild/BenchmarkSingleCompileTask.cs
andrew grant 499f555538 Restore 21213169
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]
2022-07-22 00:56:39 -04:00

83 lines
2.0 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using AutomationTool;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EpicGames.Core;
using UnrealBuildTool;
using UnrealBuildBase;
namespace AutomationTool.Benchmark
{
class BenchmarkSingleCompileTask : BenchmarkBuildTask
{
FileReference SourceFile = null;
public BenchmarkSingleCompileTask(FileReference InProjectFile, string InTarget, UnrealTargetPlatform InPlatform, XGETaskOptions InXgeOption)
: base(InProjectFile, InTarget, InPlatform, InXgeOption, "", 0)
{
string ModuleName = InProjectFile == null ? "Unreal" : InProjectFile.GetFileNameWithoutAnyExtensions();
TaskName = string.Format("{0} Incremental {1} {2}", ModuleName, InTarget, InPlatform);
string ProjectName = null;
// Try to find a source file in the project
if (InProjectFile != null)
{
ProjectName = InProjectFile.GetFileNameWithoutAnyExtensions();
DirectoryReference SourceDir = DirectoryReference.Combine(InProjectFile.Directory, "Source", ProjectName);
if (DirectoryReference.Exists(SourceDir))
{
var Files = DirectoryReference.EnumerateFiles(SourceDir, "*.cpp", System.IO.SearchOption.AllDirectories);
SourceFile = Files.FirstOrDefault();
}
}
// if we didn't, use an engine one
if (SourceFile == null)
{
if (InProjectFile == null)
{
ProjectName = "UnrealEngine";
}
SourceFile = FileReference.Combine(Unreal.EngineDirectory, "Source/Runtime/Engine/Private/UnrealEngine.cpp");
}
Log.TraceVerbose("Will compile {0} for single-file compilation test for {1}", SourceFile, ProjectName);
}
protected override bool PerformPrequisites()
{
if (!base.PerformPrequisites())
{
return false;
}
FileInfo Fi = SourceFile.ToFileInfo();
bool ReadOnly = Fi.IsReadOnly;
if (ReadOnly)
{
Fi.IsReadOnly = false;
}
Fi.LastWriteTime = DateTime.Now;
if (ReadOnly)
{
Fi.IsReadOnly = true;
}
return true;
}
}
}