Files
UnrealEngineUWP/Engine/Source/Developer/DesktopPlatform/Public/TargetReceipt.h
Zousar Shaker 5f008b55ed Add build worker discovery mechanism using target receipt files.
#rb matt.peters

[CL 16917716 by Zousar Shaker in ue5-main branch]
2021-07-21 19:06:57 -04:00

117 lines
3.1 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Modules/BuildVersion.h"
/**
* Record of a file that was created as part of the build process
*/
struct FBuildProduct
{
/** Path to the file. */
FString Path;
/** Type of the build product. */
FString Type;
};
/**
* Information about a file which is required by the target at runtime, and must be moved around with it.
*/
struct FRuntimeDependency
{
/** The file that should be staged. Should use $(EngineDir) and $(ProjectDir) variables as a root, so that the target can be relocated to different machines. */
FString Path;
/** How to stage this file. */
FString Type;
};
/**
* Arbitrary property name/value which metadata from the build scripts can be passed on to downstream tasks
*/
struct FReceiptProperty
{
/** Property name */
FString Name;
/** Value of the property */
FString Value;
};
/**
* Stores information about a compiled target. Mirror of the TargetReceipt class generated by UBT.
*/
struct DESKTOPPLATFORM_API FTargetReceipt
{
/** Path to the project file for this target */
FString ProjectFile;
/** The project directory */
FString ProjectDir;
/** The name of this target */
FString TargetName;
/** Which platform the target is compiled for */
FString Platform;
/** Which platform the target is compiled for */
FString Architecture;
/** Which configuration this target is compiled in */
EBuildConfiguration Configuration;
/** The type of the target */
EBuildTargetType TargetType;
/** The version information for this target */
FBuildVersion Version;
/** The exectuable to launch for this target */
FString Launch;
/** The build products which are part of this target */
TArray<FBuildProduct> BuildProducts;
/** All the runtime dependencies that this target relies on */
TArray<FRuntimeDependency> RuntimeDependencies;
/** All plugins that were either enabled or disabled via the target rules. */
TMap<FString, bool> PluginNameToEnabledState;
/** Additional build properties passed through from the module rules */
TArray<FReceiptProperty> AdditionalProperties;
/**
* Read a target receipt from disk
*
* @param FileName The file to read from
* @param bExpandVariables Whether variables should be expanded in paths or not
* @return True if the file was read successfully
*/
bool Read(const FString& FileName, bool bExpandVariables = true);
/**
* Gets the default path for a target receipt
*
* @param BaseDir Base directory for the target being built; either the project directory or engine directory.
* @param TargetName The target being built
* @param Platform The target platform
* @param Configuration The target configuration
* @param BuildArchitecture The architecture being built
* @return Path to the receipt for this target
*/
static FString GetDefaultPath(const TCHAR* BaseDir, const TCHAR* TargetName, const TCHAR* Platform, EBuildConfiguration Configuration, const TCHAR* BuildArchitecture);
private:
/**
* Expands the $(EngineDir) and $(ProjectDir) variables within a string
*
* @param Path Path to expand variables within
*/
void ExpandVariables(FString& Path);
};