Files
UnrealEngineUWP/Engine/Source/Programs/BuildAgent/Workspace/PruneCacheMode.cs
Ben Marsh d6d7c939e5 Copying //UE4/Dev-Build to Dev-Main (//UE4/Dev-Main)
#rb none

[CL 12726184 by Ben Marsh in Main branch]
2020-04-10 11:30:32 -04:00

28 lines
1.0 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using BuildAgent.Workspace.Common;
using Tools.DotNETCommon;
namespace BuildAgent.Workspace
{
[ProgramMode("PruneCache", "Attempts to remove dead data out of the cache based on existing contents files generated from populating or syncing the cache.")]
class PruneCacheMode : WorkspaceMode
{
[CommandLine("-ClientAndStream=")]
[Description("Specifies client and stream pairs, in the format Client:Stream, to use when determining what to prune.")]
List<string> ClientAndStreamParams = new List<string>();
protected override void Execute(Repository Repo)
{
Stopwatch Timer = Stopwatch.StartNew();
IEnumerable<string> ClientNames = ParseClientAndStreams(ClientAndStreamParams).Select(ClientAndStream => ClientAndStream.Key).Distinct();
Repo.RemoveDeadFilesFromCache(ClientNames);
Log.TraceInformation("Pruning took {0}s", Timer.Elapsed.TotalSeconds);
}
}
}