You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Tidied up CSV reporting of values to be more spreadsheet friendly Allow -AllCompile to be used independently of -editor / -client #rb na #preflgiht https://horde.devtools.epicgames.com/job/6312a54fab25bb91f5a7e838 [CL 21776180 by andrew grant in ue5-main branch]
91 lines
2.1 KiB
C#
91 lines
2.1 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;
|
|
|
|
private string _TaskName;
|
|
public override string TaskName
|
|
{
|
|
get
|
|
{
|
|
return _TaskName;
|
|
}
|
|
}
|
|
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("Incr {0} {1}", 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;
|
|
}
|
|
}
|
|
}
|
|
|