Files
UnrealEngineUWP/Engine/Source/Programs/Shared/EpicGames.BuildGraph/BgAggregateSpec.cs
Ben Marsh a59ef99c07 BuildGraph: New mechanism for declaring graphs using C# code (WIP).
Nodes can now be implemented by arbitary C# methods. Graph structure is specified through expression trees implemented using Bg* types, which are not substituted with values until execution time. Doing so allows determination of node and option dependencies for a particular target, allowing us to generate dynamic UI for presenting relevant settings to the user.

Includes partial implementation of Installed Build script as an example implementation.

#preflight 61bb85d46c2686e86322eec9

[CL 18477305 by Ben Marsh in ue5-main branch]
2021-12-16 13:55:22 -05:00

55 lines
1.5 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using EpicGames.BuildGraph.Expressions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EpicGames.BuildGraph
{
/// <summary>
/// Specification for an aggregate target in the graph
/// </summary>
public class BgAggregateSpec
{
/// <summary>
/// Name of the aggregate
/// </summary>
public BgString Name { get; }
/// <summary>
/// Outputs required for the aggregate
/// </summary>
public BgList<BgFileSet> RequiredOutputs { get; set; }
/// <summary>
/// Internal constructor. Use <see cref="BgGraphSpec.AddAggregate(BgString, BgList{BgFileSet})"/> to create an aggregate.
/// </summary>
internal BgAggregateSpec(BgString Name, BgList<BgFileSet> RequiredOutputs)
{
this.Name = Name;
this.RequiredOutputs = RequiredOutputs;
}
/// <summary>
/// Creates a concrete aggregate object from this specification.
/// </summary>
internal void AddToGraph(BgExprContext Context, BgGraph Graph)
{
BgAggregate Aggregate = new BgAggregate(Name.Compute(Context));
Aggregate.RequiredNodes.UnionWith(RequiredOutputs.ComputeTags(Context).Select(x => Graph.TagNameToNodeOutput[x].ProducingNode));
Graph.NameToAggregate.Add(Aggregate.Name, Aggregate);
}
/// <summary>
/// Adds a set of dependencies to this aggregate
/// </summary>
/// <param name="Tokens">List of token dependencies</param>
public void Requires(params BgFileSet[] Tokens)
{
RequiredOutputs.Add(Tokens);
}
}
}