// Copyright Epic Games, Inc. All Rights Reserved.
using System.Collections.Generic;
using System.Diagnostics;
namespace EpicGames.BuildGraph
{
///
/// Stores a list of nodes which can be executed on a single agent
///
[DebuggerDisplay("{Name}")]
[BgObject(typeof(BgAgentDefSerializer))]
public class BgAgentDef
{
///
/// Name of this agent. Used for display purposes in a build system.
///
public string Name { get; }
///
/// Array of valid agent types that these nodes may run on. When running in the build system, this determines the class of machine that should
/// be selected to run these nodes. The first defined agent type for this branch will be used.
///
public List PossibleTypes { get; } = new List();
///
/// List of nodes in this agent group.
///
public List Nodes { get; set; } = new List();
///
/// Diagnostics to output if executing this agent
///
public List Diagnostics { get; } = new List();
///
/// Constructor
///
/// Name of this agent group
public BgAgentDef(string name)
{
Name = name;
}
}
class BgAgentDefSerializer : BgObjectSerializer
{
///
public override BgAgentDef Deserialize(BgObjectDef obj)
{
BgAgentDef agent = new BgAgentDef(obj.Get(x => x.Name, ""));
obj.CopyTo(agent);
return agent;
}
}
}