// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
namespace EpicGames.BuildGraph
{
///
/// Which changelist to show a UGS badge for
///
public enum BgLabelChange
{
///
/// The current changelist being built
///
Current,
///
/// The last code changelist
///
Code,
}
///
/// Defines a label within a graph. Labels are similar to badges, and give the combined status of one or more job steps. Unlike badges, they
/// separate the requirements for its status and optional nodes to be included in its status, allowing this to be handled externally.
///
public class BgLabelDef
{
///
/// Name of this badge
///
public string? DashboardName { get; set; }
///
/// Category for this label
///
public string? DashboardCategory { get; set; }
///
/// Name of the badge in UGS
///
public string? UgsBadge { get; set; }
///
/// Path to the project folder in UGS
///
public string? UgsProject { get; set; }
///
/// Which change to show the badge for
///
public BgLabelChange Change { get; set; }
///
/// Set of nodes that must be run for this label to be shown.
///
public HashSet RequiredNodes { get; } = new HashSet();
///
/// Set of nodes that will be included in this label if present.
///
public HashSet IncludedNodes { get; } = new HashSet();
///
/// Constructor
///
public BgLabelDef()
{
}
///
/// Constructor
///
/// Name of this label
/// Type of this label
/// The UGS badge name
/// Project to display this badge for
/// The change to show this badge on in UGS
public BgLabelDef(string? inDashboardName = null, string? inDashboardCategory = null, string? inUgsBadge = null, string? inUgsProject = null, BgLabelChange inChange = BgLabelChange.Current)
{
DashboardName = inDashboardName;
DashboardCategory = inDashboardCategory;
UgsBadge = inUgsBadge;
UgsProject = inUgsProject;
Change = inChange;
}
///
/// Get the name of this label
///
/// The name of this label
public override string ToString()
{
if (!String.IsNullOrEmpty(DashboardName))
{
return String.Format("{0}/{1}", DashboardCategory, DashboardName);
}
else
{
return UgsBadge ?? "Unknown";
}
}
}
}