2020-10-22 19:19:16 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "Modules/ModuleInterface.h"
|
2020-11-24 18:42:39 -04:00
|
|
|
#include "Features/IModularFeatures.h"
|
2020-10-22 19:19:16 -04:00
|
|
|
#include "Async/Async.h"
|
|
|
|
|
|
|
|
|
|
struct FDistributedBuildTaskResult
|
|
|
|
|
{
|
|
|
|
|
int32 ReturnCode;
|
|
|
|
|
bool bCompleted;
|
|
|
|
|
};
|
|
|
|
|
|
2024-02-08 17:29:49 -05:00
|
|
|
struct FDistributedBuildStats
|
|
|
|
|
{
|
|
|
|
|
uint32 MaxRemoteAgents = 0;
|
|
|
|
|
uint32 MaxActiveAgentCores = 0;
|
|
|
|
|
};
|
|
|
|
|
|
2020-10-22 19:19:16 -04:00
|
|
|
struct FTaskCommandData
|
|
|
|
|
{
|
|
|
|
|
FString Command;
|
2021-08-20 15:50:49 -04:00
|
|
|
FString WorkingDirectory;
|
2020-10-22 19:19:16 -04:00
|
|
|
FString InputFileName;
|
2021-05-26 17:31:47 -04:00
|
|
|
FString OutputFileName;
|
2021-08-20 15:50:49 -04:00
|
|
|
FString ExtraCommandArgs;
|
2024-09-17 15:08:58 -04:00
|
|
|
FString Description; // Optional string describing the task. Shows up in UBA trace files for each job.
|
2021-05-26 17:31:47 -04:00
|
|
|
uint32 DispatcherPID = 0;
|
2020-10-22 19:19:16 -04:00
|
|
|
TArray<FString> Dependencies;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct FTask
|
|
|
|
|
{
|
|
|
|
|
uint32 ID;
|
|
|
|
|
FTaskCommandData CommandData;
|
|
|
|
|
TPromise<FDistributedBuildTaskResult> Promise;
|
|
|
|
|
|
|
|
|
|
FTask(uint32 ID, const FTaskCommandData& CommandData, TPromise<FDistributedBuildTaskResult>&& Promise)
|
|
|
|
|
: ID(ID)
|
|
|
|
|
, CommandData(CommandData)
|
|
|
|
|
, Promise(MoveTemp(Promise))
|
|
|
|
|
{}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct FTaskResponse
|
|
|
|
|
{
|
|
|
|
|
uint32 ID;
|
|
|
|
|
int32 ReturnCode;
|
|
|
|
|
};
|
|
|
|
|
|
2020-11-24 18:42:39 -04:00
|
|
|
class IDistributedBuildController : public IModuleInterface, public IModularFeature
|
2020-10-22 19:19:16 -04:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual bool SupportsDynamicReloading() override { return false; }
|
2021-05-26 17:31:47 -04:00
|
|
|
|
|
|
|
|
virtual bool RequiresRelativePaths() { return false; }
|
2020-10-22 19:19:16 -04:00
|
|
|
|
2021-03-05 19:27:14 -04:00
|
|
|
virtual void InitializeController() = 0;
|
|
|
|
|
|
2020-10-22 19:19:16 -04:00
|
|
|
// Returns true if the controller may be used.
|
|
|
|
|
virtual bool IsSupported() = 0;
|
|
|
|
|
|
2021-04-08 14:32:07 -04:00
|
|
|
// Returns the name of the controller. Used for logging purposes.
|
2020-10-22 19:19:16 -04:00
|
|
|
virtual const FString GetName() = 0;
|
|
|
|
|
|
2022-08-10 15:23:20 -04:00
|
|
|
virtual FString RemapPath(const FString& SourcePath) const { return SourcePath; }
|
|
|
|
|
|
2020-10-22 19:19:16 -04:00
|
|
|
virtual void Tick(float DeltaSeconds){}
|
|
|
|
|
|
|
|
|
|
// Returns a new file path to be used for writing input data to.
|
|
|
|
|
virtual FString CreateUniqueFilePath() = 0;
|
|
|
|
|
|
2024-02-08 17:29:49 -05:00
|
|
|
// Returns the distributed build statistics since the last call and resets its internal values. Returns false if there are no statistics provided.
|
|
|
|
|
virtual bool PollStats(FDistributedBuildStats& OutStats) { return false; }
|
|
|
|
|
|
2020-10-22 19:19:16 -04:00
|
|
|
// Launches a task. Returns a future which can be waited on for the results.
|
|
|
|
|
virtual TFuture<FDistributedBuildTaskResult> EnqueueTask(const FTaskCommandData& CommandData) = 0;
|
2020-11-24 18:42:39 -04:00
|
|
|
|
|
|
|
|
static const FName& GetModularFeatureType()
|
|
|
|
|
{
|
|
|
|
|
static FName FeatureTypeName = FName(TEXT("DistributedBuildController"));
|
|
|
|
|
return FeatureTypeName;
|
|
|
|
|
}
|
2020-10-22 19:19:16 -04:00
|
|
|
};
|