You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#lockdown Nick.Penwarden
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3284872 on 2017/02/03 by Graeme.Thornton
Seperate pak cache granularity from pak signing chunk size
Change 3285765 on 2017/02/03 by Graeme.Thornton
Fix stats warnings because each slate new loading screen thread has the same stat name, but is assigned to a different thread
#jira UE-41478
Change 3286913 on 2017/02/04 by Ben.Marsh
IncludeTool: Merging fixes.
* Don't remove existing forward declarations unless explicitly instructed to do so. Files are optimized with these declarations in place, so removing them can cause output files to fail to build. It can be a useful separate step though, so expose it as a command-line option instead.
* Add a specific option for which files should be output by the tool. Any files which are excluded from this list are treated specially when generating output files, so as to prevent them from causing files to be omitted from other files that include them. Also add an option to force this mode for all headers, for use when testing formatting/include path generation.
Change 3287100 on 2017/02/05 by Ben.Marsh
UBT: Move platform settings into platform-specific TargetRules objects.
Change 3287106 on 2017/02/05 by Ben.Marsh
Merge UEBuildPlatformContext into UEBuildPlatform. Now that targets can have platform-specific settings, there is no need to separate a platform class which contains target-specific information.
Change 3287398 on 2017/02/06 by Steve.Robb
Fix for UHT failing when -WarningsAsErrors and -Verbose are specified together.
Change 3287399 on 2017/02/06 by Steve.Robb
Log verbosities made more readable in the debugger.
Change 3287410 on 2017/02/06 by Steve.Robb
Fix for TStructOpsTypeTraits where WithCopy gives a different result between specializing the traits and not providing WithCopy and not specializing the traits at all.
#fyi marc.audy
Change 3288020 on 2017/02/06 by Ben.Marsh
Prevent forward declaration of the ITextData class. We need to include the header for the debugger visualizers to work correctly.
Change 3291817 on 2017/02/08 by Steve.Robb
New EBlueprintCompileReinstancerFlags used to construct FBlueprintCompileReinstancer, instead of lots of bools.
Change 3292090 on 2017/02/08 by Graeme.Thornton
Crash fix - don't update font engine services if it was never created
#jira UE-33953
Change 3292993 on 2017/02/08 by Ben.Marsh
Add an option to disable force-including PCHs for files in the non-unity working set. (bAdaptiveUnityDisablesPCH)
Change 3293231 on 2017/02/08 by Ben.Marsh
BuildGraph: Allow overriding the changelist that a badge should be displayed for (with the Change="" attribute on the Badge declaration in XML), so the code changelist can be used if necessary. Also link to the failed step if only one has failed.
Change 3294213 on 2017/02/09 by Ben.Marsh
EC: Allow setting a property on frequent CI jobs that allows us to exclude it from job searches for generating the dashboard. Filtering on the client side is causing dashboard pages to be almost empty.
Change 3294753 on 2017/02/09 by Ben.Zeigler
#jira UE-41151 Fix UObjectLibrary::RemoveObject to remove from the correct array, and add comment mentioning that the dynamic use of Object Library is semi-deprecated
Change 3296070 on 2017/02/09 by Ben.Zeigler
Explicitly turn off Copy for a struct that has a linked list internally. I think turning Copy on by default for all non POD Types is pretty risky and is likely to crash for other games. In this case it was being copied for network replication, and it didn't have one defined so the default C++ one copied the linked list and crashed on destruction.
Change 3296420 on 2017/02/10 by Graeme.Thornton
Remove remaining references to AES_KEY, instead using the encryption key delegates to access the key where needed
Refactored encryption and signing key access in unrealpak to make it easier to use
Change 3296609 on 2017/02/10 by Ben.Marsh
BuildGraph: Fix error running the <Copy> task with an empty "From" argument.
* FileSystemReference.IsUnderDirectory() was not correctly handling cases where the directory was a root directory (and has to end in a path separator)
* FilePattern.AsDirectoryReference() with an empty token would append a path separator to an empty string, resulting in it referencing the root directory rather than the given base directory.
Change 3297440 on 2017/02/10 by Ben.Marsh
UBT: Move the FileFilter class into UnrealBuildTool.
Change 3297725 on 2017/02/10 by Ben.Zeigler
#jira UE-39199 Fix issue with enum value redirects using the wrong short or long name, it now fully supports both.
Clean up a lot of confusingly named and broken functions on UEnum:
#jira UE-41348 Deprecate FindEnumIndex, GetEnum, GetEnumName, replace with GetIndexByName, GetNameByIndex, and GetNameStringByIndex and clean up warnings
#jira UE-38187 Deprecate GetDisplayNameText and GetEnumText, replaced both with GetDisplayNameTextAtIndex which is now callable outside the editor and has a better comment
Deprecate FindEnumRedirects and replace with GetIndexByNameString. Fix code to not check the redirects array 5 times per enum lookup
Fix GetValueAsString to actually act on a value, not an index. This matches common usage and the function's name
While fixing deprecation warnings on internal games, fixed dozens of cases where it was using Index functions when it should have been using Value functions
Delete some now redundant enum editor code and pipe everything through UEnum
Change 3297979 on 2017/02/10 by Ben.Zeigler
Fix issues parsing Enums that are literally the string "None", which is allowed but leads to some odd behavior
Change 3298299 on 2017/02/10 by Steve.Robb
TTuple improvements:
- equality comparable
- serializable
- in the correct folder
2-tuples are specialized to be syntactically compatible with both TPair and TTuple.
TPair is now an alias for a 2-tuple and is no longer bound to TPairInitializer.
#fyi robert.manuszewski,ben.marsh
Change 3298460 on 2017/02/11 by Ben.Marsh
UGS: Set the correct result from running custom tasks.
Change 3298462 on 2017/02/11 by Ben.Marsh
UBT: Fix some deprecated messages that have the wrong release version, and add a better message for how ModuleRules constructors need to be updated.
Change 3299447 on 2017/02/13 by Graeme.Thornton
Fix AES and pak signing key embedding for content only projects
- Force temp target when any keys are specified by project config
Change 3299649 on 2017/02/13 by Steve.Robb
PLATFORM_HAS_DEFAULTED_OPERATORS fixed.
Other obsolete compiler switches removed.
Change 3299787 on 2017/02/13 by Steve.Robb
IsAbstract() for testing if a reflected native type contains pure virtual functions. Needed for BP nativization.
#fyi robert.manuszewski
Change 3300576 on 2017/02/13 by Ben.Marsh
EC: Add support for starting builds on any agent type. Mapping from agent types to resource pools is stored in an EC property sheet (/Generated/<Stream>/AgentTypes), allowing EC procedures to map it to a resource pool from a parameter.
Change 3300600 on 2017/02/13 by Ben.Marsh
EC: Add the -ClearHistory argument to UAT run to export BuildGraph settings, to allow running on incremental workspaces.
Change 3300624 on 2017/02/13 by Ben.Marsh
Switch incremental builds for all streams to start up on the incremental agent.
Change 3302134 on 2017/02/14 by Steve.Robb
UnrealCodeAnalyzer removed.
#fyi ben.marsh,robert.manuszewski
Change 3302639 on 2017/02/14 by Ben.Zeigler
Fix crash cooking odin with default command line
#jira UE-41952 Delete StealthTeleport map that crashes on load, and update default cook list that gets used if nothing specified
Change 3303002 on 2017/02/14 by Ben.Zeigler
#jira UE-41061 Fix it so editor only filtering on savepackage is uniformly applied regardless of if it's at package or object level
#jira UE-41880 Rewrite editor/client/server only filtering logic in SavePackage to fix various bugs. It now does all of the filtering up front, and won't process any filtered objects for imports or exports
Rename NotForEditorGame to NotAlwaysLoadedForEditorGame and improve comments, this flag says that the asset should be loaded EVEN IF it is editor only, it does not affect loading for normal objects
Change the non-map cook flags to RF_Public instead of RF_Standalone. Blueprint classes aren't RF_Standalone so were only being cooked before due to an accident of the dependency checker
Change it so anything with a Transient outer is marked transient at save time. These objects would not save out properly anyway
Fix it so -cooksinglepackage works properly again and excludes localization and startup packages
Tested with Fortnite and Odin, Odin works but with lots of warnings with nativization on which I need to investigate
Change 3303084 on 2017/02/14 by Ben.Zeigler
Attempt to get Nativization and EDL working without warnings
Change 3305153 on 2017/02/15 by Ben.Zeigler
Fix Fortnite and Orion cook, I don't understand why this passed my local testing
Fix the CDO subobject finder to actually return things instead of doing nothing, and fix a shadow variable warning
Change 3305959 on 2017/02/16 by Gil.Gribb
UE4 - Tweaked out the EDL loader for the switch with benefits to all platforms.
Change 3306159 on 2017/02/16 by Ben.Marsh
Fix path to target binaries when building non-monolithic in a unique build environment.
Change 3306584 on 2017/02/16 by Steve.Robb
UEnum internal functions renamed from Index to Value.
GetValueAsString_Internal() parameter now takes an int64, as is expected for enum values.
#fyi ben.zeigler
Change 3307836 on 2017/02/16 by Ben.Zeigler
#jira UE-42055 Load very old redirects in cooked builds. Matinee has no way of resaving redirects, so as long as matinee exists we need to keep them around forever, or fix matinee manually
Fixes lighting in Infiltrator demo
Change 3307929 on 2017/02/16 by Ben.Zeigler
#jira UE-42055 Second half of matinee redirector fix
Change 3308840 on 2017/02/17 by Matthew.Griffin
Reimplementing CL#3305808 from 4.15
Changed QA label build process so that it only allows version with 3 components (we always add the .0 for initial releases)
Change 3309115 on 2017/02/17 by Ben.Marsh
Windows: Fix the GetModulesDirectory() function always returning the engine binaries directory. It's possible to build non-monolithic targets which output all engine binaries to the game binaries directory - a requirement to being able to set game-specific defines or build settings, because we don't want shared engine binaries to be tainted with them. The module manager needs to be able to operate early on, before many of the game settings have been initialized, so just return the directory containing the Core module instead.
Change 3309120 on 2017/02/17 by Ben.Marsh
Fix support for creating modular builds which don't use the shared build environment.
Change 3309125 on 2017/02/17 by Ben.Marsh
Require that -CookDir arguments are specified separately on the command line. '+' is a valid path character (and common in build versions), so we shouldn't treat it as an argument separator.
Change 3309128 on 2017/02/17 by Ben.Marsh
Fix UnrealPak failures when enumerating all files from a source directory, if that directory happens to contain spaces.
Change 3309131 on 2017/02/17 by Ben.Marsh
Fix list of discovered assets being cleared by second call to FindFilesRecursive() when building DDC. Disable the -cookdir parameter again.
Change 3309140 on 2017/02/17 by Ben.Marsh
UAT: Fix exception moving a file from one location to another if the target directory does not exist.
Change 3309212 on 2017/02/17 by Ben.Marsh
Fixes/improvements for mod editor and code mods:
* A separate top-level project is generated for each code mod in the Visual Studio solution.
* Plugin descriptors now have a flag to identify themselves as mod as opposed to a regular game plugin, which prevents project plugins from getting their own VS project. New mods created with the mod editor will have this set by default, as do the three existing sample mods.
* Cleaning and building code mods will never modify engine binaries. Presence of the Engine/Build/InstalledProjectBuild.txt file is used to indicate running in this environment. This flag also disables options to edit metadata for non-mod plugins in installed builds.
* Plugin browser now includes a separate category for mods.
* Mod editor now behaves as an "installed" program by default, and will use the user's home folder for storing settings.
Change 3309231 on 2017/02/17 by Steve.Robb
Fix for Ar << bSomeBool where Ar is a derived class which overrides an operator<<.
#jira UE-42052
Change 3309248 on 2017/02/17 by Ben.Marsh
Add support for hot-reloading game plugin modules from Visual Studio, as long as their module returns IsGameModule() = true.
Change 3309257 on 2017/02/17 by Ben.Marsh
Prevent game binaries from being renamed for hot reload when working with installed projects.
Change 3309355 on 2017/02/17 by Steven.Hutton
Changes to make the website compatible with the new database changes.
Change 3309371 on 2017/02/17 by Ben.Marsh
Fix exception on shutdown when running asset registry with threads disabled.
#jira UE-41951
Change 3309389 on 2017/02/17 by Ben.Zeigler
#jira UE-42051 Fix ensure and crash when loading a null asset ID via the LoadAsset BP node
Change 3309570 on 2017/02/17 by Gil.Gribb
UE4 - Switch load time performace tweaks, plus abstracted the IO tracker and handle manager for other platforms and applied it to the PS4.
Change 3310039 on 2017/02/17 by Ben.Marsh
BuildGraph: Prevent exception when trying to delete a file that does not exist.
Change 3311484 on 2017/02/20 by Chris.Wood
CrashReportProcess crash add retry logic improvements (CRP v1.2.16)
Change 3311600 on 2017/02/20 by Matthew.Griffin
Updated StripSymbols functions so that all platforms can deal with the source and target file being the same
Change 3311675 on 2017/02/20 by Steve.Robb
FNativeClassHeaderGenerator::CurrentSourceFile stack replaced with C++ stack.
Change 3311893 on 2017/02/20 by Ben.Marsh
UGS: Add support for notifying users if CIS steps fail for content changes. Badges which test content should be listed in the [Notifications] section of the project-specific INI file, through +ContentBadges= lines.
Change 3313966 on 2017/02/21 by Ben.Marsh
Fix EC parsing of error messages output by the editor in the form "LogXYZ:Error:". Greedy optional subexpression in regex was matching everything until a space, so terminate a colon too.
Change 3314398 on 2017/02/21 by Ben.Zeigler
#jira UE-42212 Fix shutdown of AnimGraph module to be safer
[CL 3315211 by Ben Marsh in Main branch]
707 lines
23 KiB
C#
707 lines
23 KiB
C#
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.IO;
|
|
using AutomationTool;
|
|
using UnrealBuildTool;
|
|
using System.Reflection;
|
|
using System.Xml;
|
|
using System.Linq;
|
|
using System.Diagnostics;
|
|
|
|
namespace AutomationTool
|
|
{
|
|
/// <summary>
|
|
/// Options for how the graph should be printed
|
|
/// </summary>
|
|
enum GraphPrintOptions
|
|
{
|
|
/// <summary>
|
|
/// Includes a list of the graph options
|
|
/// </summary>
|
|
ShowCommandLineOptions = 0x1,
|
|
|
|
/// <summary>
|
|
/// Includes the list of dependencies for each node
|
|
/// </summary>
|
|
ShowDependencies = 0x2,
|
|
|
|
/// <summary>
|
|
/// Includes the list of notifiers for each node
|
|
/// </summary>
|
|
ShowNotifications = 0x4,
|
|
}
|
|
|
|
/// <summary>
|
|
/// Diagnostic message from the graph script. These messages are parsed at startup, then culled along with the rest of the graph nodes before output. Doing so
|
|
/// allows errors and warnings which are only output if a node is part of the graph being executed.
|
|
/// </summary>
|
|
class GraphDiagnostic
|
|
{
|
|
/// <summary>
|
|
/// The diagnostic event type
|
|
/// </summary>
|
|
public LogEventType EventType;
|
|
|
|
/// <summary>
|
|
/// The message to display
|
|
/// </summary>
|
|
public string Message;
|
|
|
|
/// <summary>
|
|
/// The node which this diagnostic is declared in. If the node is culled from the graph, the message will not be displayed.
|
|
/// </summary>
|
|
public Node EnclosingNode;
|
|
|
|
/// <summary>
|
|
/// The agent that this diagnostic is declared in. If the entire agent is culled from the graph, the message will not be displayed.
|
|
/// </summary>
|
|
public Agent EnclosingAgent;
|
|
|
|
/// <summary>
|
|
/// The trigger that this diagnostic is declared in. If this trigger is not being run, the message will not be displayed.
|
|
/// </summary>
|
|
public ManualTrigger EnclosingTrigger;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Represents a graph option. These are expanded during preprocessing, but are retained in order to display help messages.
|
|
/// </summary>
|
|
class GraphOption
|
|
{
|
|
/// <summary>
|
|
/// Name of this option
|
|
/// </summary>
|
|
public string Name;
|
|
|
|
/// <summary>
|
|
/// Description for this option
|
|
/// </summary>
|
|
public string Description;
|
|
|
|
/// <summary>
|
|
/// Default value for this option
|
|
/// </summary>
|
|
public string DefaultValue;
|
|
|
|
/// <summary>
|
|
/// Constructor
|
|
/// </summary>
|
|
/// <param name="Name">The name of this option</param>
|
|
/// <param name="Description">Description of the option, for display on help pages</param>
|
|
/// <param name="DefaultValue">Default value for the option</param>
|
|
public GraphOption(string Name, string Description, string DefaultValue)
|
|
{
|
|
this.Name = Name;
|
|
this.Description = Description;
|
|
this.DefaultValue = DefaultValue;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns a name of this option for debugging
|
|
/// </summary>
|
|
/// <returns>Name of the option</returns>
|
|
public override string ToString()
|
|
{
|
|
return Name;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Definition of a graph.
|
|
/// </summary>
|
|
class Graph
|
|
{
|
|
/// <summary>
|
|
/// List of options, in the order they were specified
|
|
/// </summary>
|
|
public List<GraphOption> Options = new List<GraphOption>();
|
|
|
|
/// <summary>
|
|
/// List of agents containing nodes to execute
|
|
/// </summary>
|
|
public List<Agent> Agents = new List<Agent>();
|
|
|
|
/// <summary>
|
|
/// All manual triggers that are part of this graph
|
|
/// </summary>
|
|
public Dictionary<string, ManualTrigger> NameToTrigger = new Dictionary<string, ManualTrigger>(StringComparer.InvariantCultureIgnoreCase);
|
|
|
|
/// <summary>
|
|
/// Mapping from name to agent
|
|
/// </summary>
|
|
public Dictionary<string, Agent> NameToAgent = new Dictionary<string, Agent>(StringComparer.InvariantCultureIgnoreCase);
|
|
|
|
/// <summary>
|
|
/// Mapping of names to the corresponding node.
|
|
/// </summary>
|
|
public Dictionary<string, Node> NameToNode = new Dictionary<string,Node>(StringComparer.InvariantCultureIgnoreCase);
|
|
|
|
/// <summary>
|
|
/// Mapping of names to the corresponding report.
|
|
/// </summary>
|
|
public Dictionary<string, Report> NameToReport = new Dictionary<string, Report>(StringComparer.InvariantCultureIgnoreCase);
|
|
|
|
/// <summary>
|
|
/// Mapping of names to their corresponding node output.
|
|
/// </summary>
|
|
public HashSet<string> LocalTagNames = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
|
|
|
/// <summary>
|
|
/// Mapping of names to their corresponding node output.
|
|
/// </summary>
|
|
public Dictionary<string, NodeOutput> TagNameToNodeOutput = new Dictionary<string,NodeOutput>(StringComparer.InvariantCultureIgnoreCase);
|
|
|
|
/// <summary>
|
|
/// Mapping of aggregate names to their respective nodes
|
|
/// </summary>
|
|
public Dictionary<string, Node[]> AggregateNameToNodes = new Dictionary<string,Node[]>(StringComparer.InvariantCultureIgnoreCase);
|
|
|
|
/// <summary>
|
|
/// List of badges that can be displayed for this build
|
|
/// </summary>
|
|
public List<Badge> Badges = new List<Badge>();
|
|
|
|
/// <summary>
|
|
/// Diagnostic messages for this graph
|
|
/// </summary>
|
|
public List<GraphDiagnostic> Diagnostics = new List<GraphDiagnostic>();
|
|
|
|
/// <summary>
|
|
/// Default constructor
|
|
/// </summary>
|
|
public Graph()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Checks whether a given name already exists
|
|
/// </summary>
|
|
/// <param name="Name">The name to check.</param>
|
|
/// <returns>True if the name exists, false otherwise.</returns>
|
|
public bool ContainsName(string Name)
|
|
{
|
|
return NameToNode.ContainsKey(Name) || NameToReport.ContainsKey(Name) || AggregateNameToNodes.ContainsKey(Name);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tries to resolve the given name to one or more nodes. Checks for aggregates, and actual nodes.
|
|
/// </summary>
|
|
/// <param name="Name">The name to search for</param>
|
|
/// <param name="OutNodes">If the name is a match, receives an array of nodes and their output names</param>
|
|
/// <returns>True if the name was found, false otherwise.</returns>
|
|
public bool TryResolveReference(string Name, out Node[] OutNodes)
|
|
{
|
|
// Check if it's a tag reference or node reference
|
|
if(Name.StartsWith("#"))
|
|
{
|
|
// Check if it's a regular node or output name
|
|
NodeOutput Output;
|
|
if(TagNameToNodeOutput.TryGetValue(Name, out Output))
|
|
{
|
|
OutNodes = new Node[]{ Output.ProducingNode };
|
|
return true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// Check if it's a regular node or output name
|
|
Node Node;
|
|
if(NameToNode.TryGetValue(Name, out Node))
|
|
{
|
|
OutNodes = new Node[]{ Node };
|
|
return true;
|
|
}
|
|
|
|
// Check if it's an aggregate name
|
|
Node[] Nodes;
|
|
if(AggregateNameToNodes.TryGetValue(Name, out Nodes))
|
|
{
|
|
OutNodes = Nodes;
|
|
return true;
|
|
}
|
|
|
|
// Check if it's a group name
|
|
Agent Agent;
|
|
if(NameToAgent.TryGetValue(Name, out Agent))
|
|
{
|
|
OutNodes = Agent.Nodes.ToArray();
|
|
return true;
|
|
}
|
|
}
|
|
|
|
// Otherwise fail
|
|
OutNodes = null;
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tries to resolve the given name to one or more node outputs. Checks for aggregates, and actual nodes.
|
|
/// </summary>
|
|
/// <param name="Name">The name to search for</param>
|
|
/// <param name="OutOutputs">If the name is a match, receives an array of nodes and their output names</param>
|
|
/// <returns>True if the name was found, false otherwise.</returns>
|
|
public bool TryResolveInputReference(string Name, out NodeOutput[] OutOutputs)
|
|
{
|
|
// Check if it's a tag reference or node reference
|
|
if(Name.StartsWith("#"))
|
|
{
|
|
// Check if it's a regular node or output name
|
|
NodeOutput Output;
|
|
if(TagNameToNodeOutput.TryGetValue(Name, out Output))
|
|
{
|
|
OutOutputs = new NodeOutput[]{ Output };
|
|
return true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// Check if it's a regular node or output name
|
|
Node Node;
|
|
if(NameToNode.TryGetValue(Name, out Node))
|
|
{
|
|
OutOutputs = Node.Outputs.Union(Node.Inputs).ToArray();
|
|
return true;
|
|
}
|
|
|
|
// Check if it's an aggregate name
|
|
Node[] Nodes;
|
|
if(AggregateNameToNodes.TryGetValue(Name, out Nodes))
|
|
{
|
|
OutOutputs = Nodes.SelectMany(x => x.Outputs.Union(x.Inputs)).Distinct().ToArray();
|
|
return true;
|
|
}
|
|
}
|
|
|
|
// Otherwise fail
|
|
OutOutputs = null;
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Cull the graph to only include the given nodes and their dependencies
|
|
/// </summary>
|
|
/// <param name="TargetNodes">A set of target nodes to build</param>
|
|
public void Select(IEnumerable<Node> TargetNodes)
|
|
{
|
|
// Find this node and all its dependencies
|
|
HashSet<Node> RetainNodes = new HashSet<Node>(TargetNodes);
|
|
foreach(Node TargetNode in TargetNodes)
|
|
{
|
|
RetainNodes.UnionWith(TargetNode.InputDependencies);
|
|
}
|
|
|
|
// Remove all the nodes which are not marked to be kept
|
|
foreach(Agent Agent in Agents)
|
|
{
|
|
Agent.Nodes = Agent.Nodes.Where(x => RetainNodes.Contains(x)).ToList();
|
|
}
|
|
|
|
// Remove all the empty agents
|
|
Agents.RemoveAll(x => x.Nodes.Count == 0);
|
|
|
|
// Trim down the list of nodes for each report to the ones that are being built
|
|
foreach (Report Report in NameToReport.Values)
|
|
{
|
|
Report.Nodes.RemoveWhere(x => !RetainNodes.Contains(x));
|
|
}
|
|
|
|
// Remove all the empty reports
|
|
NameToReport = NameToReport.Where(x => x.Value.Nodes.Count > 0).ToDictionary(Pair => Pair.Key, Pair => Pair.Value, StringComparer.InvariantCultureIgnoreCase);
|
|
|
|
// Remove all the order dependencies which are no longer part of the graph. Since we don't need to build them, we don't need to wait for them
|
|
foreach(Node Node in RetainNodes)
|
|
{
|
|
Node.OrderDependencies = Node.OrderDependencies.Where(x => RetainNodes.Contains(x)).ToArray();
|
|
}
|
|
|
|
// Create a new list of triggers from all the nodes which are left
|
|
NameToTrigger = RetainNodes.Where(x => x.ControllingTrigger != null).Select(x => x.ControllingTrigger).Distinct().ToDictionary(x => x.Name, x => x, StringComparer.InvariantCultureIgnoreCase);
|
|
|
|
// Create a new list of aggregates for everything that's left
|
|
AggregateNameToNodes = AggregateNameToNodes.Where(x => x.Value.All(y => RetainNodes.Contains(y))).ToDictionary(Pair => Pair.Key, Pair => Pair.Value, StringComparer.InvariantCultureIgnoreCase);
|
|
|
|
// Remove any badges which do not have all their dependencies
|
|
Badges.RemoveAll(x => x.Nodes.Any(y => !RetainNodes.Contains(y)));
|
|
|
|
// Remove any diagnostics which are no longer part of the graph
|
|
Diagnostics.RemoveAll(x => (x.EnclosingNode != null && !RetainNodes.Contains(x.EnclosingNode)) || (x.EnclosingAgent != null && !Agents.Contains(x.EnclosingAgent)));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Skips the given triggers, collapsing everything inside them into their parent trigger.
|
|
/// </summary>
|
|
/// <param name="Triggers">Set of triggers to skip</param>
|
|
public void SkipTriggers(HashSet<ManualTrigger> Triggers)
|
|
{
|
|
foreach(ManualTrigger Trigger in Triggers)
|
|
{
|
|
NameToTrigger.Remove(Trigger.Name);
|
|
}
|
|
foreach(Node Node in NameToNode.Values)
|
|
{
|
|
while(Triggers.Contains(Node.ControllingTrigger))
|
|
{
|
|
Node.ControllingTrigger = Node.ControllingTrigger.Parent;
|
|
}
|
|
}
|
|
foreach(GraphDiagnostic Diagnostic in Diagnostics)
|
|
{
|
|
while(Triggers.Contains(Diagnostic.EnclosingTrigger))
|
|
{
|
|
Diagnostic.EnclosingTrigger = Diagnostic.EnclosingTrigger.Parent;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Writes a preprocessed build graph to a script file
|
|
/// </summary>
|
|
/// <param name="File">The file to load</param>
|
|
/// <param name="SchemaFile">Schema file for validation</param>
|
|
public void Write(FileReference File, FileReference SchemaFile)
|
|
{
|
|
XmlWriterSettings Settings = new XmlWriterSettings();
|
|
Settings.Indent = true;
|
|
Settings.IndentChars = "\t";
|
|
|
|
using (XmlWriter Writer = XmlWriter.Create(File.FullName, Settings))
|
|
{
|
|
Writer.WriteStartElement("BuildGraph", "http://www.epicgames.com/BuildGraph");
|
|
|
|
if (SchemaFile != null)
|
|
{
|
|
Writer.WriteAttributeString("schemaLocation", "http://www.w3.org/2001/XMLSchema-instance", "http://www.epicgames.com/BuildGraph " + SchemaFile.MakeRelativeTo(File.Directory));
|
|
}
|
|
|
|
foreach (Agent Agent in Agents)
|
|
{
|
|
Agent.Write(Writer, null);
|
|
}
|
|
|
|
foreach (ManualTrigger ControllingTrigger in Agents.SelectMany(x => x.Nodes).Where(x => x.ControllingTrigger != null).Select(x => x.ControllingTrigger).Distinct())
|
|
{
|
|
Writer.WriteStartElement("Trigger");
|
|
Writer.WriteAttributeString("Name", ControllingTrigger.QualifiedName);
|
|
foreach (Agent Agent in Agents)
|
|
{
|
|
Agent.Write(Writer, ControllingTrigger);
|
|
}
|
|
Writer.WriteEndElement();
|
|
}
|
|
|
|
foreach (KeyValuePair<string, Node[]> Aggregate in AggregateNameToNodes)
|
|
{
|
|
Writer.WriteStartElement("Aggregate");
|
|
Writer.WriteAttributeString("Name", Aggregate.Key);
|
|
Writer.WriteAttributeString("Requires", String.Join(";", Aggregate.Value.Select(x => x.Name)));
|
|
Writer.WriteEndElement();
|
|
}
|
|
|
|
foreach (Report Report in NameToReport.Values)
|
|
{
|
|
Writer.WriteStartElement("Report");
|
|
Writer.WriteAttributeString("Name", Report.Name);
|
|
Writer.WriteAttributeString("Requires", String.Join(";", Report.Nodes.Select(x => x.Name)));
|
|
Writer.WriteEndElement();
|
|
}
|
|
|
|
foreach (Badge Badge in Badges)
|
|
{
|
|
Writer.WriteStartElement("Badge");
|
|
Writer.WriteAttributeString("Name", Badge.Name);
|
|
if (Badge.Project != null)
|
|
{
|
|
Writer.WriteAttributeString("Project", Badge.Project);
|
|
}
|
|
if (Badge.Change != 0)
|
|
{
|
|
Writer.WriteAttributeString("Change", Badge.Change.ToString());
|
|
}
|
|
Writer.WriteAttributeString("Requires", String.Join(";", Badge.Nodes.Select(x => x.Name)));
|
|
Writer.WriteEndElement();
|
|
}
|
|
|
|
Writer.WriteEndElement();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Export the build graph to a Json file, for parallel execution by the build system
|
|
/// </summary>
|
|
/// <param name="File">Output file to write</param>
|
|
/// <param name="Trigger">The trigger whose nodes to run. Null for the default nodes.</param>
|
|
/// <param name="CompletedNodes">Set of nodes which have been completed</param>
|
|
public void Export(FileReference File, ManualTrigger Trigger, HashSet<Node> CompletedNodes)
|
|
{
|
|
// Find all the nodes which we're actually going to execute. We'll use this to filter the graph.
|
|
HashSet<Node> NodesToExecute = new HashSet<Node>();
|
|
foreach(Node Node in Agents.SelectMany(x => x.Nodes))
|
|
{
|
|
if(!CompletedNodes.Contains(Node) && Node.IsBehind(Trigger))
|
|
{
|
|
NodesToExecute.Add(Node);
|
|
}
|
|
}
|
|
|
|
// Open the output file
|
|
using(JsonWriter JsonWriter = new JsonWriter(File.FullName))
|
|
{
|
|
JsonWriter.WriteObjectStart();
|
|
|
|
// Write all the agents
|
|
JsonWriter.WriteArrayStart("Groups");
|
|
foreach(Agent Agent in Agents)
|
|
{
|
|
Node[] Nodes = Agent.Nodes.Where(x => NodesToExecute.Contains(x) && x.ControllingTrigger == Trigger).ToArray();
|
|
if(Nodes.Length > 0)
|
|
{
|
|
JsonWriter.WriteObjectStart();
|
|
JsonWriter.WriteValue("Name", Agent.Name);
|
|
JsonWriter.WriteArrayStart("Agent Types");
|
|
foreach(string AgentType in Agent.PossibleTypes)
|
|
{
|
|
JsonWriter.WriteValue(AgentType);
|
|
}
|
|
JsonWriter.WriteArrayEnd();
|
|
JsonWriter.WriteArrayStart("Nodes");
|
|
foreach(Node Node in Nodes)
|
|
{
|
|
JsonWriter.WriteObjectStart();
|
|
JsonWriter.WriteValue("Name", Node.Name);
|
|
JsonWriter.WriteValue("DependsOn", String.Join(";", Node.GetDirectOrderDependencies().Where(x => NodesToExecute.Contains(x) && x.ControllingTrigger == Trigger)));
|
|
JsonWriter.WriteObjectStart("Notify");
|
|
JsonWriter.WriteValue("Default", String.Join(";", Node.NotifyUsers));
|
|
JsonWriter.WriteValue("Submitters", String.Join(";", Node.NotifySubmitters));
|
|
JsonWriter.WriteValue("Warnings", Node.bNotifyOnWarnings);
|
|
JsonWriter.WriteObjectEnd();
|
|
JsonWriter.WriteObjectEnd();
|
|
}
|
|
JsonWriter.WriteArrayEnd();
|
|
JsonWriter.WriteObjectEnd();
|
|
}
|
|
}
|
|
JsonWriter.WriteArrayEnd();
|
|
|
|
// Write all the badges
|
|
JsonWriter.WriteArrayStart("Badges");
|
|
foreach (Badge Badge in Badges)
|
|
{
|
|
Node[] Dependencies = Badge.Nodes.Where(x => NodesToExecute.Contains(x)).ToArray();
|
|
if (Dependencies.Length > 0)
|
|
{
|
|
// Reduce that list to the smallest subset of direct dependencies
|
|
HashSet<Node> DirectDependencies = new HashSet<Node>(Dependencies);
|
|
foreach (Node Dependency in Dependencies)
|
|
{
|
|
DirectDependencies.ExceptWith(Dependency.OrderDependencies);
|
|
}
|
|
|
|
JsonWriter.WriteObjectStart();
|
|
JsonWriter.WriteValue("Name", Badge.Name);
|
|
if (!String.IsNullOrEmpty(Badge.Project))
|
|
{
|
|
JsonWriter.WriteValue("Project", Badge.Project);
|
|
}
|
|
if(Badge.Change != 0)
|
|
{
|
|
JsonWriter.WriteValue("Change", Badge.Change);
|
|
}
|
|
JsonWriter.WriteValue("AllDependencies", String.Join(";", Agents.SelectMany(x => x.Nodes).Where(x => Dependencies.Contains(x)).Select(x => x.Name)));
|
|
JsonWriter.WriteValue("DirectDependencies", String.Join(";", DirectDependencies.Select(x => x.Name)));
|
|
JsonWriter.WriteObjectEnd();
|
|
}
|
|
}
|
|
JsonWriter.WriteArrayEnd();
|
|
|
|
// Write all the triggers and reports.
|
|
JsonWriter.WriteArrayStart("Reports");
|
|
foreach (Report Report in NameToReport.Values)
|
|
{
|
|
Node[] Dependencies = Report.Nodes.Where(x => NodesToExecute.Contains(x)).ToArray();
|
|
if (Dependencies.Length > 0)
|
|
{
|
|
// Reduce that list to the smallest subset of direct dependencies
|
|
HashSet<Node> DirectDependencies = new HashSet<Node>(Dependencies);
|
|
foreach (Node Dependency in Dependencies)
|
|
{
|
|
DirectDependencies.ExceptWith(Dependency.OrderDependencies);
|
|
}
|
|
|
|
JsonWriter.WriteObjectStart();
|
|
JsonWriter.WriteValue("Name", Report.Name);
|
|
JsonWriter.WriteValue("AllDependencies", String.Join(";", Agents.SelectMany(x => x.Nodes).Where(x => Dependencies.Contains(x)).Select(x => x.Name)));
|
|
JsonWriter.WriteValue("DirectDependencies", String.Join(";", DirectDependencies.Select(x => x.Name)));
|
|
JsonWriter.WriteValue("Notify", String.Join(";", Report.NotifyUsers));
|
|
JsonWriter.WriteValue("IsTrigger", false);
|
|
JsonWriter.WriteObjectEnd();
|
|
}
|
|
}
|
|
foreach (ManualTrigger DownstreamTrigger in NameToTrigger.Values)
|
|
{
|
|
if(DownstreamTrigger.Parent == Trigger)
|
|
{
|
|
// Find all the nodes that this trigger is dependent on
|
|
HashSet<Node> Dependencies = new HashSet<Node>();
|
|
foreach(Node NodeToExecute in NodesToExecute)
|
|
{
|
|
if(NodeToExecute.IsBehind(DownstreamTrigger))
|
|
{
|
|
Dependencies.UnionWith(NodeToExecute.OrderDependencies.Where(x => x.ControllingTrigger == Trigger));
|
|
}
|
|
}
|
|
|
|
// Reduce that list to the smallest subset of direct dependencies
|
|
HashSet<Node> DirectDependencies = new HashSet<Node>(Dependencies);
|
|
foreach(Node Dependency in Dependencies)
|
|
{
|
|
DirectDependencies.ExceptWith(Dependency.OrderDependencies);
|
|
}
|
|
|
|
// Write out the object
|
|
JsonWriter.WriteObjectStart();
|
|
JsonWriter.WriteValue("Name", DownstreamTrigger.Name);
|
|
JsonWriter.WriteValue("AllDependencies", String.Join(";", Agents.SelectMany(x => x.Nodes).Where(x => Dependencies.Contains(x)).Select(x => x.Name)));
|
|
JsonWriter.WriteValue("DirectDependencies", String.Join(";", Dependencies.Where(x => DirectDependencies.Contains(x)).Select(x => x.Name)));
|
|
JsonWriter.WriteValue("Notify", String.Join(";", DownstreamTrigger.NotifyUsers));
|
|
JsonWriter.WriteValue("IsTrigger", true);
|
|
JsonWriter.WriteObjectEnd();
|
|
}
|
|
}
|
|
JsonWriter.WriteArrayEnd();
|
|
|
|
JsonWriter.WriteObjectEnd();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Print the contents of the graph
|
|
/// </summary>
|
|
/// <param name="CompletedNodes">Set of nodes which are already complete</param>
|
|
/// <param name="PrintOptions">Options for how to print the graph</param>
|
|
public void Print(HashSet<Node> CompletedNodes, GraphPrintOptions PrintOptions)
|
|
{
|
|
// Print the options
|
|
if((PrintOptions & GraphPrintOptions.ShowCommandLineOptions) != 0)
|
|
{
|
|
// Get the list of messages
|
|
List<string> Messages = new List<string>();
|
|
foreach(GraphOption Option in Options)
|
|
{
|
|
StringBuilder Message = new StringBuilder();
|
|
Message.AppendFormat("-set:{0}=... {1}", Option.Name, Option.Description);
|
|
if(!String.IsNullOrEmpty(Option.DefaultValue))
|
|
{
|
|
Message.AppendFormat(" (Default: {0})", Option.DefaultValue);
|
|
}
|
|
Messages.Add(Message.ToString());
|
|
}
|
|
|
|
// Format them to the log
|
|
if(Messages.Count > 0)
|
|
{
|
|
CommandUtils.Log("");
|
|
CommandUtils.Log("Options:");
|
|
CommandUtils.Log("");
|
|
foreach(string Line in CommandUtils.FormatParams(Messages, 4, 24))
|
|
{
|
|
CommandUtils.Log(Line);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Get a list of all the triggers, including the null global one
|
|
List<ManualTrigger> AllTriggers = new List<ManualTrigger>();
|
|
AllTriggers.Add(null);
|
|
AllTriggers.AddRange(NameToTrigger.Values.OrderBy(x => x.QualifiedName));
|
|
|
|
// Output all the triggers in order
|
|
CommandUtils.Log("");
|
|
CommandUtils.Log("Graph:");
|
|
foreach(ManualTrigger Trigger in AllTriggers)
|
|
{
|
|
// Filter everything by this trigger
|
|
Dictionary<Agent, Node[]> FilteredAgentToNodes = new Dictionary<Agent,Node[]>();
|
|
foreach(Agent Agent in Agents)
|
|
{
|
|
Node[] Nodes = Agent.Nodes.Where(x => x.ControllingTrigger == Trigger).ToArray();
|
|
if(Nodes.Length > 0)
|
|
{
|
|
FilteredAgentToNodes[Agent] = Nodes;
|
|
}
|
|
}
|
|
|
|
// Skip this trigger if there's nothing to display
|
|
if(FilteredAgentToNodes.Count == 0)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
// Print the trigger name
|
|
CommandUtils.Log(" Trigger: {0}", (Trigger == null)? "None" : Trigger.QualifiedName);
|
|
if(Trigger != null && PrintOptions.HasFlag(GraphPrintOptions.ShowNotifications))
|
|
{
|
|
foreach(string User in Trigger.NotifyUsers)
|
|
{
|
|
CommandUtils.Log(" notify> {0}", User);
|
|
}
|
|
}
|
|
|
|
// Output all the agents for this trigger
|
|
foreach(Agent Agent in Agents)
|
|
{
|
|
Node[] Nodes;
|
|
if(FilteredAgentToNodes.TryGetValue(Agent, out Nodes))
|
|
{
|
|
CommandUtils.Log(" Agent: {0} ({1})", Agent.Name, String.Join(";", Agent.PossibleTypes));
|
|
foreach(Node Node in Nodes)
|
|
{
|
|
CommandUtils.Log(" Node: {0}{1}", Node.Name, CompletedNodes.Contains(Node)? " (completed)" : "");
|
|
if(PrintOptions.HasFlag(GraphPrintOptions.ShowDependencies))
|
|
{
|
|
HashSet<Node> InputDependencies = new HashSet<Node>(Node.GetDirectInputDependencies());
|
|
foreach(Node InputDependency in InputDependencies)
|
|
{
|
|
CommandUtils.Log(" input> {0}", InputDependency.Name);
|
|
}
|
|
HashSet<Node> OrderDependencies = new HashSet<Node>(Node.GetDirectOrderDependencies());
|
|
foreach(Node OrderDependency in OrderDependencies.Except(InputDependencies))
|
|
{
|
|
CommandUtils.Log(" after> {0}", OrderDependency.Name);
|
|
}
|
|
}
|
|
if(PrintOptions.HasFlag(GraphPrintOptions.ShowNotifications))
|
|
{
|
|
string Label = Node.bNotifyOnWarnings? "warnings" : "errors";
|
|
foreach(string User in Node.NotifyUsers)
|
|
{
|
|
CommandUtils.Log(" {0}> {1}", Label, User);
|
|
}
|
|
foreach(string Submitter in Node.NotifySubmitters)
|
|
{
|
|
CommandUtils.Log(" {0}> submitters to {1}", Label, Submitter);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
CommandUtils.Log("");
|
|
|
|
// Print out all the aggregates
|
|
string[] AggregateNames = AggregateNameToNodes.Keys.OrderBy(x => x).ToArray();
|
|
if(AggregateNames.Length > 0)
|
|
{
|
|
CommandUtils.Log("Aggregates:");
|
|
foreach(string AggregateName in AggregateNames)
|
|
{
|
|
CommandUtils.Log(" {0}", AggregateName);
|
|
}
|
|
CommandUtils.Log("");
|
|
}
|
|
}
|
|
}
|
|
}
|