2020-02-18 17:19:54 -05:00
|
|
|
|
// 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;
|
2020-12-21 23:07:37 -04:00
|
|
|
|
using EpicGames.Core;
|
2020-02-18 17:19:54 -05:00
|
|
|
|
using UnrealBuildTool;
|
|
|
|
|
|
|
|
|
|
|
|
namespace AutomationTool.Benchmark
|
|
|
|
|
|
{
|
|
|
|
|
|
class BenchmarkSingleCompileTask : BenchmarkBuildTask
|
|
|
|
|
|
{
|
|
|
|
|
|
BenchmarkBuildTask PreTask;
|
|
|
|
|
|
|
|
|
|
|
|
FileReference SourceFile;
|
|
|
|
|
|
|
2020-03-09 17:03:55 -04:00
|
|
|
|
public BenchmarkSingleCompileTask(FileReference InProjectFile, string InTarget, UnrealTargetPlatform InPlatform, FileReference InSourceFile, BuildOptions InOptions)
|
|
|
|
|
|
: base(InProjectFile, InTarget, InPlatform, InOptions)
|
2020-02-18 17:19:54 -05:00
|
|
|
|
{
|
2020-03-09 17:03:55 -04:00
|
|
|
|
PreTask = new BenchmarkBuildTask(InProjectFile, InTarget, InPlatform, InOptions);
|
2020-02-18 17:19:54 -05:00
|
|
|
|
SourceFile = InSourceFile;
|
2020-02-21 13:09:10 -05:00
|
|
|
|
TaskModifiers.Add("singlecompile");
|
2020-02-18 17:19:54 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override bool PerformPrequisites()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!base.PerformPrequisites())
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PreTask.Run();
|
|
|
|
|
|
|
|
|
|
|
|
FileInfo Fi = SourceFile.ToFileInfo();
|
|
|
|
|
|
|
|
|
|
|
|
bool ReadOnly = Fi.IsReadOnly;
|
|
|
|
|
|
|
|
|
|
|
|
if (ReadOnly)
|
|
|
|
|
|
{
|
|
|
|
|
|
Fi.IsReadOnly = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Fi.LastWriteTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
if (ReadOnly)
|
|
|
|
|
|
{
|
|
|
|
|
|
Fi.IsReadOnly = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return !PreTask.Failed;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|