Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/AutomationUtils/HelpUtils.cs

376 lines
10 KiB
C#
Raw Normal View History

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Text;
using System.Threading;
using Tools.DotNETCommon.XmlHandler;
using System.ComponentModel;
using System.Reflection;
namespace AutomationTool
{
#region Help
/// <summary>
/// Help Attribute.
/// </summary>
[AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
public class HelpAttribute : DescriptionAttribute
{
private bool IsParamHelp;
/// <summary>
/// Basic constructor for class descriptions.
/// </summary>
/// <param name="Description">Class description</param>
public HelpAttribute(string Description)
: base(Description)
{
IsParamHelp = false;
}
/// <summary>
/// Constructor for parameter descriptions.
/// </summary>
/// <param name="ParamName">Paramter name</param>
/// <param name="Description">Paramter description</param>
public HelpAttribute(string ParamName, string Description)
: base(FormatDescription(ParamName, Description))
{
IsParamHelp = true;
}
/// <summary>
/// Additional type to display help for.
/// </summary>
/// <param name="AdditionalType"></param>
public HelpAttribute(Type AdditionalType)
{
IsParamHelp = false;
AdditionalHelp = AdditionalType;
}
private static string FormatDescription(string Name, string Description)
{
return String.Format("-{0} {1}", Name, Description);
}
public bool IsParam
{
get { return IsParamHelp; }
}
public Type AdditionalHelp
{
get;
private set;
}
}
#endregion
/// <summary>
/// Base utility function for script commands.
/// </summary>
public partial class CommandUtils
{
#region Help
/// <summary>
/// Displays help for the specified command.
/// <param name="Command">Command type.</param>
/// </summary>
public static void Help(Type Command)
{
string Description;
List<string> Params;
GetTypeHelp(Command, out Description, out Params);
LogHelp(Command, Description, Params);
}
/// <summary>
/// Displays help for the specified Type.
/// </summary>
/// <param name="Command">Type to display help for.</param>
public static void LogHelp(Type Command)
{
string Description;
List<string> Params;
GetTypeHelp(Command, out Description, out Params);
LogHelp(Command, Description, Params);
}
/// <summary>
/// Displays a formatted help for the specified Command type.
/// </summary>
/// <param name="Command">Command Type</param>
/// <param name="Description">Command Desscription</param>
/// <param name="Params">Command Parameters</param>
public static void LogHelp(Type Command, string Description, List<string> Params)
{
string HelpMessage = Environment.NewLine;
bool bFirstLine = true;
if (Command != null)
{
HelpMessage += String.Format("{0} Help:{1}", Command.Name, Environment.NewLine);
bFirstLine = false;
}
if (String.IsNullOrEmpty(Description) == false)
{
if (!bFirstLine)
{
HelpMessage += Environment.NewLine;
}
HelpMessage += Description + Environment.NewLine;
bFirstLine = false;
}
if (IsNullOrEmpty(Params) == false)
{
if (!bFirstLine)
{
HelpMessage += Environment.NewLine;
}
HelpMessage += "Parameters: " + Environment.NewLine;
HelpMessage += Environment.NewLine;
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3058348) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 2982033 on 2016/05/18 by Chad.Garyet Checking in progress on the ue4 BuildGraph conversion. Builds and Compiles editor and game on all platforms Builds DDC on win64 and mac Builds Tools on win64 Change 3047983 on 2016/07/13 by Ben.Marsh PR #2597: Fix P4 environment used for running BuildUGS commandlet (Contributed by paulevans) Change 3048267 on 2016/07/13 by Ben.Marsh BuildGraph: Allow more permissive list of characters for node names; just restrict against characters which are illegal in filenames. Allows creating aggregate names which match job names (eg. "Editor, Tools & Monolithics"). Change 3048293 on 2016/07/13 by Ben.Marsh BuildGraph: Allow passing -listonly without a specific -target=... parameter in BuildGraph, to see the contents of the entire script. Change 3048454 on 2016/07/13 by Ben.Marsh BuildGraph: Disable output of error messages when just printing the contents of the graph. Change 3048507 on 2016/07/13 by Ben.Marsh BuildGraph: Rename "Ticket" to "Token" for files used to ensure exclusive access to run part of a build. Change 3049459 on 2016/07/14 by Matthew.Griffin Updated location of HTML5 SDKs for Installed Builds #jira UE-32171 Change 3049675 on 2016/07/14 by Matthew.Griffin Ensured that all platforms are registered when running -validateplatform command #jira UE-31082 Change 3049922 on 2016/07/14 by Ben.Marsh UBT: Fix path to XML config file in boilerplate message. Change 3051483 on 2016/07/15 by Ben.Marsh EC: Remove code to prettify node names, now that we can have pretty node names explicitly. Change 3051522 on 2016/07/15 by Ben.Marsh BuildGraph: Change spawn task to fail if a non-zero exit code is returned by an external program. The minimum exit code to be treated as an error can be set using the "ErrorLevel" attribute, similar to ERRORLEVEL in DOS. Change 3051770 on 2016/07/15 by Ben.Marsh UGS: Add support for narrowing virtual streams; fetch event and precompiled binaries for parent stream instead. Change 3052990 on 2016/07/17 by Ben.Marsh Show the names of people with notifications disabled in the heading of failure emails, so it's clear that they're not on CC. Change 3053556 on 2016/07/18 by Ben.Marsh BuildGraph: Add a explicit <Option> tag instead of the <Property Default=""/> shenanigans, so that properties that are meant to be modified by the user are listed explicitly. Supported attributes are "DefaultValue" (which specifies a default if the user does not set it on the command line), "Description" (which explains the purpose of the option to users, which is displayed in a table when BuildGraph is invoked with the -listonly argument), and "Restrict" (which specifies a regex to validate an argument supplied by the user). Also add an <EnvVar Name="Blah"/> tag which imports the given environment variable as a property (or sets it to "" if it doesn't exist), and rename the <Choose>/<Option>/<Otherwise> triple to <Switch>/<Case>/<Default> to avoid confusion with the new <Option> tag. Change 3053688 on 2016/07/18 by Ben.Marsh Update build scripts to link to p4-swarm rather than p4-web in dashboard pages and notification emails. Change 3054039 on 2016/07/18 by Ben.Marsh Fix confusing message when compiler isn't installed if the target forces VS2013 Change 3054360 on 2016/07/18 by Ben.Marsh Remove GUBP support from EC scripts. Change 3054399 on 2016/07/18 by Ben.Marsh Remove circular include from Json.h -> JsonSerializerMacros.h -> Json.h Change 3055671 on 2016/07/19 by Ben.Marsh Remove incomplete UWP integration from UE4. Change 3055943 on 2016/07/19 by Ben.Marsh Remove the WinRT target platform. Change 3056270 on 2016/07/19 by Ben.Marsh Core: Move VectorRegister.h include to eliminate include dependency on UnrealMathUtility.h Change 3056390 on 2016/07/19 by Ben.Marsh Core: Directly include headers required by default JsonWriter template instantiation. Change 3057444 on 2016/07/20 by Ben.Marsh UBT: Fall back to checking for the VS140COMNTOOLS environment variable if we couldn't determine the Visual Studio installation directory from the registry. Allows using the standalone Visual Studio build tools to compile UE4. Change 3058337 on 2016/07/20 by Ben.Marsh Remove EnvVarsToXML. All target platforms now determine their compile environment directly from the registry. Change 3058348 on 2016/07/20 by Ben.Marsh Disable optimization for all automation projects. They don't generally do anything particularly CPU intensive, and VS2015 optimizations are inhibitive to debugging. [CL 3058822 by Ben Marsh in Main branch]
2016-07-20 20:25:02 -04:00
foreach(string Line in FormatParams(Params, 4, 24))
{
HelpMessage += Line + Environment.NewLine;
}
}
Log(HelpMessage);
}
/// <summary>
/// Formats the given parameters as so:
/// -Param1 Param1 Description
///
/// -Param2 Param2 Description, this description is
/// longer and splits onto a separate line.
///
/// -Param3 Param3 Description continues as before.
/// </summary>
/// <param name="Params">List of parameters arranged as "-ParamName Param Description"</param>
/// <param name="Indent">Indent from the left hand side</param>
/// <param name="DefaultRightPadding">The minimum padding from the start of the param name to the start of the description (resizes with larger param names)</param>
/// <returns></returns>
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3058348) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 2982033 on 2016/05/18 by Chad.Garyet Checking in progress on the ue4 BuildGraph conversion. Builds and Compiles editor and game on all platforms Builds DDC on win64 and mac Builds Tools on win64 Change 3047983 on 2016/07/13 by Ben.Marsh PR #2597: Fix P4 environment used for running BuildUGS commandlet (Contributed by paulevans) Change 3048267 on 2016/07/13 by Ben.Marsh BuildGraph: Allow more permissive list of characters for node names; just restrict against characters which are illegal in filenames. Allows creating aggregate names which match job names (eg. "Editor, Tools & Monolithics"). Change 3048293 on 2016/07/13 by Ben.Marsh BuildGraph: Allow passing -listonly without a specific -target=... parameter in BuildGraph, to see the contents of the entire script. Change 3048454 on 2016/07/13 by Ben.Marsh BuildGraph: Disable output of error messages when just printing the contents of the graph. Change 3048507 on 2016/07/13 by Ben.Marsh BuildGraph: Rename "Ticket" to "Token" for files used to ensure exclusive access to run part of a build. Change 3049459 on 2016/07/14 by Matthew.Griffin Updated location of HTML5 SDKs for Installed Builds #jira UE-32171 Change 3049675 on 2016/07/14 by Matthew.Griffin Ensured that all platforms are registered when running -validateplatform command #jira UE-31082 Change 3049922 on 2016/07/14 by Ben.Marsh UBT: Fix path to XML config file in boilerplate message. Change 3051483 on 2016/07/15 by Ben.Marsh EC: Remove code to prettify node names, now that we can have pretty node names explicitly. Change 3051522 on 2016/07/15 by Ben.Marsh BuildGraph: Change spawn task to fail if a non-zero exit code is returned by an external program. The minimum exit code to be treated as an error can be set using the "ErrorLevel" attribute, similar to ERRORLEVEL in DOS. Change 3051770 on 2016/07/15 by Ben.Marsh UGS: Add support for narrowing virtual streams; fetch event and precompiled binaries for parent stream instead. Change 3052990 on 2016/07/17 by Ben.Marsh Show the names of people with notifications disabled in the heading of failure emails, so it's clear that they're not on CC. Change 3053556 on 2016/07/18 by Ben.Marsh BuildGraph: Add a explicit <Option> tag instead of the <Property Default=""/> shenanigans, so that properties that are meant to be modified by the user are listed explicitly. Supported attributes are "DefaultValue" (which specifies a default if the user does not set it on the command line), "Description" (which explains the purpose of the option to users, which is displayed in a table when BuildGraph is invoked with the -listonly argument), and "Restrict" (which specifies a regex to validate an argument supplied by the user). Also add an <EnvVar Name="Blah"/> tag which imports the given environment variable as a property (or sets it to "" if it doesn't exist), and rename the <Choose>/<Option>/<Otherwise> triple to <Switch>/<Case>/<Default> to avoid confusion with the new <Option> tag. Change 3053688 on 2016/07/18 by Ben.Marsh Update build scripts to link to p4-swarm rather than p4-web in dashboard pages and notification emails. Change 3054039 on 2016/07/18 by Ben.Marsh Fix confusing message when compiler isn't installed if the target forces VS2013 Change 3054360 on 2016/07/18 by Ben.Marsh Remove GUBP support from EC scripts. Change 3054399 on 2016/07/18 by Ben.Marsh Remove circular include from Json.h -> JsonSerializerMacros.h -> Json.h Change 3055671 on 2016/07/19 by Ben.Marsh Remove incomplete UWP integration from UE4. Change 3055943 on 2016/07/19 by Ben.Marsh Remove the WinRT target platform. Change 3056270 on 2016/07/19 by Ben.Marsh Core: Move VectorRegister.h include to eliminate include dependency on UnrealMathUtility.h Change 3056390 on 2016/07/19 by Ben.Marsh Core: Directly include headers required by default JsonWriter template instantiation. Change 3057444 on 2016/07/20 by Ben.Marsh UBT: Fall back to checking for the VS140COMNTOOLS environment variable if we couldn't determine the Visual Studio installation directory from the registry. Allows using the standalone Visual Studio build tools to compile UE4. Change 3058337 on 2016/07/20 by Ben.Marsh Remove EnvVarsToXML. All target platforms now determine their compile environment directly from the registry. Change 3058348 on 2016/07/20 by Ben.Marsh Disable optimization for all automation projects. They don't generally do anything particularly CPU intensive, and VS2015 optimizations are inhibitive to debugging. [CL 3058822 by Ben Marsh in Main branch]
2016-07-20 20:25:02 -04:00
public static IEnumerable<string> FormatParams(IEnumerable<string> Params, int Indent, int DefaultRightPadding)
{
Dictionary<string, string> ParamDict = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
// Extract Params/Descriptions into Key/Value pairs
foreach (var Param in Params)
{
// Find the first space (should be following the param name)
if (!String.IsNullOrWhiteSpace(Param))
{
var ParamName = String.Empty;
var ParamDesc = String.Empty;
var SplitPoint = Param.IndexOf(' ');
if (SplitPoint > 0)
{
// Extract the name and description seperately
ParamName = Param.Substring(0, SplitPoint);
ParamDesc = Param.Substring(SplitPoint + 1, Param.Length - (SplitPoint + 1));
}
else
{
ParamName = Param;
}
// build dictionary using Name and Desc as Key and Value
if (!ParamDict.ContainsKey(ParamName))
{
ParamDict.Add(ParamName, ParamDesc);
}
else
{
LogWarning("Duplicated help parameter \"{0}\"", ParamName);
}
}
}
// string used to intent the param
string IndentString = string.Empty.PadRight(Indent);
// default the padding value
int RightPadding = DefaultRightPadding;
// If (Padding < longest param name) padding = longest param name + 1
foreach (var ParamName in ParamDict.Keys)
{
if (ParamName.Length + 1 > RightPadding)
{
RightPadding = ParamName.Length + 1;
}
}
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3058348) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 2982033 on 2016/05/18 by Chad.Garyet Checking in progress on the ue4 BuildGraph conversion. Builds and Compiles editor and game on all platforms Builds DDC on win64 and mac Builds Tools on win64 Change 3047983 on 2016/07/13 by Ben.Marsh PR #2597: Fix P4 environment used for running BuildUGS commandlet (Contributed by paulevans) Change 3048267 on 2016/07/13 by Ben.Marsh BuildGraph: Allow more permissive list of characters for node names; just restrict against characters which are illegal in filenames. Allows creating aggregate names which match job names (eg. "Editor, Tools & Monolithics"). Change 3048293 on 2016/07/13 by Ben.Marsh BuildGraph: Allow passing -listonly without a specific -target=... parameter in BuildGraph, to see the contents of the entire script. Change 3048454 on 2016/07/13 by Ben.Marsh BuildGraph: Disable output of error messages when just printing the contents of the graph. Change 3048507 on 2016/07/13 by Ben.Marsh BuildGraph: Rename "Ticket" to "Token" for files used to ensure exclusive access to run part of a build. Change 3049459 on 2016/07/14 by Matthew.Griffin Updated location of HTML5 SDKs for Installed Builds #jira UE-32171 Change 3049675 on 2016/07/14 by Matthew.Griffin Ensured that all platforms are registered when running -validateplatform command #jira UE-31082 Change 3049922 on 2016/07/14 by Ben.Marsh UBT: Fix path to XML config file in boilerplate message. Change 3051483 on 2016/07/15 by Ben.Marsh EC: Remove code to prettify node names, now that we can have pretty node names explicitly. Change 3051522 on 2016/07/15 by Ben.Marsh BuildGraph: Change spawn task to fail if a non-zero exit code is returned by an external program. The minimum exit code to be treated as an error can be set using the "ErrorLevel" attribute, similar to ERRORLEVEL in DOS. Change 3051770 on 2016/07/15 by Ben.Marsh UGS: Add support for narrowing virtual streams; fetch event and precompiled binaries for parent stream instead. Change 3052990 on 2016/07/17 by Ben.Marsh Show the names of people with notifications disabled in the heading of failure emails, so it's clear that they're not on CC. Change 3053556 on 2016/07/18 by Ben.Marsh BuildGraph: Add a explicit <Option> tag instead of the <Property Default=""/> shenanigans, so that properties that are meant to be modified by the user are listed explicitly. Supported attributes are "DefaultValue" (which specifies a default if the user does not set it on the command line), "Description" (which explains the purpose of the option to users, which is displayed in a table when BuildGraph is invoked with the -listonly argument), and "Restrict" (which specifies a regex to validate an argument supplied by the user). Also add an <EnvVar Name="Blah"/> tag which imports the given environment variable as a property (or sets it to "" if it doesn't exist), and rename the <Choose>/<Option>/<Otherwise> triple to <Switch>/<Case>/<Default> to avoid confusion with the new <Option> tag. Change 3053688 on 2016/07/18 by Ben.Marsh Update build scripts to link to p4-swarm rather than p4-web in dashboard pages and notification emails. Change 3054039 on 2016/07/18 by Ben.Marsh Fix confusing message when compiler isn't installed if the target forces VS2013 Change 3054360 on 2016/07/18 by Ben.Marsh Remove GUBP support from EC scripts. Change 3054399 on 2016/07/18 by Ben.Marsh Remove circular include from Json.h -> JsonSerializerMacros.h -> Json.h Change 3055671 on 2016/07/19 by Ben.Marsh Remove incomplete UWP integration from UE4. Change 3055943 on 2016/07/19 by Ben.Marsh Remove the WinRT target platform. Change 3056270 on 2016/07/19 by Ben.Marsh Core: Move VectorRegister.h include to eliminate include dependency on UnrealMathUtility.h Change 3056390 on 2016/07/19 by Ben.Marsh Core: Directly include headers required by default JsonWriter template instantiation. Change 3057444 on 2016/07/20 by Ben.Marsh UBT: Fall back to checking for the VS140COMNTOOLS environment variable if we couldn't determine the Visual Studio installation directory from the registry. Allows using the standalone Visual Studio build tools to compile UE4. Change 3058337 on 2016/07/20 by Ben.Marsh Remove EnvVarsToXML. All target platforms now determine their compile environment directly from the registry. Change 3058348 on 2016/07/20 by Ben.Marsh Disable optimization for all automation projects. They don't generally do anything particularly CPU intensive, and VS2015 optimizations are inhibitive to debugging. [CL 3058822 by Ben Marsh in Main branch]
2016-07-20 20:25:02 -04:00
// Get the window width, using a default value if there's no console attached to this process.
int WindowWidth;
try
{
WindowWidth = Console.WindowWidth;
}
catch
{
WindowWidth = 240;
}
// Build the formatted params
foreach (var ParamName in ParamDict.Keys)
{
// build the param first, including intend and padding on the rights size
string ParamString = IndentString + ParamName.PadRight(RightPadding);
// Build the description line by line, adding the same amount of intending each time.
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3058348) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 2982033 on 2016/05/18 by Chad.Garyet Checking in progress on the ue4 BuildGraph conversion. Builds and Compiles editor and game on all platforms Builds DDC on win64 and mac Builds Tools on win64 Change 3047983 on 2016/07/13 by Ben.Marsh PR #2597: Fix P4 environment used for running BuildUGS commandlet (Contributed by paulevans) Change 3048267 on 2016/07/13 by Ben.Marsh BuildGraph: Allow more permissive list of characters for node names; just restrict against characters which are illegal in filenames. Allows creating aggregate names which match job names (eg. "Editor, Tools & Monolithics"). Change 3048293 on 2016/07/13 by Ben.Marsh BuildGraph: Allow passing -listonly without a specific -target=... parameter in BuildGraph, to see the contents of the entire script. Change 3048454 on 2016/07/13 by Ben.Marsh BuildGraph: Disable output of error messages when just printing the contents of the graph. Change 3048507 on 2016/07/13 by Ben.Marsh BuildGraph: Rename "Ticket" to "Token" for files used to ensure exclusive access to run part of a build. Change 3049459 on 2016/07/14 by Matthew.Griffin Updated location of HTML5 SDKs for Installed Builds #jira UE-32171 Change 3049675 on 2016/07/14 by Matthew.Griffin Ensured that all platforms are registered when running -validateplatform command #jira UE-31082 Change 3049922 on 2016/07/14 by Ben.Marsh UBT: Fix path to XML config file in boilerplate message. Change 3051483 on 2016/07/15 by Ben.Marsh EC: Remove code to prettify node names, now that we can have pretty node names explicitly. Change 3051522 on 2016/07/15 by Ben.Marsh BuildGraph: Change spawn task to fail if a non-zero exit code is returned by an external program. The minimum exit code to be treated as an error can be set using the "ErrorLevel" attribute, similar to ERRORLEVEL in DOS. Change 3051770 on 2016/07/15 by Ben.Marsh UGS: Add support for narrowing virtual streams; fetch event and precompiled binaries for parent stream instead. Change 3052990 on 2016/07/17 by Ben.Marsh Show the names of people with notifications disabled in the heading of failure emails, so it's clear that they're not on CC. Change 3053556 on 2016/07/18 by Ben.Marsh BuildGraph: Add a explicit <Option> tag instead of the <Property Default=""/> shenanigans, so that properties that are meant to be modified by the user are listed explicitly. Supported attributes are "DefaultValue" (which specifies a default if the user does not set it on the command line), "Description" (which explains the purpose of the option to users, which is displayed in a table when BuildGraph is invoked with the -listonly argument), and "Restrict" (which specifies a regex to validate an argument supplied by the user). Also add an <EnvVar Name="Blah"/> tag which imports the given environment variable as a property (or sets it to "" if it doesn't exist), and rename the <Choose>/<Option>/<Otherwise> triple to <Switch>/<Case>/<Default> to avoid confusion with the new <Option> tag. Change 3053688 on 2016/07/18 by Ben.Marsh Update build scripts to link to p4-swarm rather than p4-web in dashboard pages and notification emails. Change 3054039 on 2016/07/18 by Ben.Marsh Fix confusing message when compiler isn't installed if the target forces VS2013 Change 3054360 on 2016/07/18 by Ben.Marsh Remove GUBP support from EC scripts. Change 3054399 on 2016/07/18 by Ben.Marsh Remove circular include from Json.h -> JsonSerializerMacros.h -> Json.h Change 3055671 on 2016/07/19 by Ben.Marsh Remove incomplete UWP integration from UE4. Change 3055943 on 2016/07/19 by Ben.Marsh Remove the WinRT target platform. Change 3056270 on 2016/07/19 by Ben.Marsh Core: Move VectorRegister.h include to eliminate include dependency on UnrealMathUtility.h Change 3056390 on 2016/07/19 by Ben.Marsh Core: Directly include headers required by default JsonWriter template instantiation. Change 3057444 on 2016/07/20 by Ben.Marsh UBT: Fall back to checking for the VS140COMNTOOLS environment variable if we couldn't determine the Visual Studio installation directory from the registry. Allows using the standalone Visual Studio build tools to compile UE4. Change 3058337 on 2016/07/20 by Ben.Marsh Remove EnvVarsToXML. All target platforms now determine their compile environment directly from the registry. Change 3058348 on 2016/07/20 by Ben.Marsh Disable optimization for all automation projects. They don't generally do anything particularly CPU intensive, and VS2015 optimizations are inhibitive to debugging. [CL 3058822 by Ben Marsh in Main branch]
2016-07-20 20:25:02 -04:00
foreach (var DescriptionLine in WordWrap(ParamDict[ParamName], WindowWidth - ParamString.Length))
{
// Formatting as following:
// <Indent>-param<Right Padding>Description<New line>
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3058348) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 2982033 on 2016/05/18 by Chad.Garyet Checking in progress on the ue4 BuildGraph conversion. Builds and Compiles editor and game on all platforms Builds DDC on win64 and mac Builds Tools on win64 Change 3047983 on 2016/07/13 by Ben.Marsh PR #2597: Fix P4 environment used for running BuildUGS commandlet (Contributed by paulevans) Change 3048267 on 2016/07/13 by Ben.Marsh BuildGraph: Allow more permissive list of characters for node names; just restrict against characters which are illegal in filenames. Allows creating aggregate names which match job names (eg. "Editor, Tools & Monolithics"). Change 3048293 on 2016/07/13 by Ben.Marsh BuildGraph: Allow passing -listonly without a specific -target=... parameter in BuildGraph, to see the contents of the entire script. Change 3048454 on 2016/07/13 by Ben.Marsh BuildGraph: Disable output of error messages when just printing the contents of the graph. Change 3048507 on 2016/07/13 by Ben.Marsh BuildGraph: Rename "Ticket" to "Token" for files used to ensure exclusive access to run part of a build. Change 3049459 on 2016/07/14 by Matthew.Griffin Updated location of HTML5 SDKs for Installed Builds #jira UE-32171 Change 3049675 on 2016/07/14 by Matthew.Griffin Ensured that all platforms are registered when running -validateplatform command #jira UE-31082 Change 3049922 on 2016/07/14 by Ben.Marsh UBT: Fix path to XML config file in boilerplate message. Change 3051483 on 2016/07/15 by Ben.Marsh EC: Remove code to prettify node names, now that we can have pretty node names explicitly. Change 3051522 on 2016/07/15 by Ben.Marsh BuildGraph: Change spawn task to fail if a non-zero exit code is returned by an external program. The minimum exit code to be treated as an error can be set using the "ErrorLevel" attribute, similar to ERRORLEVEL in DOS. Change 3051770 on 2016/07/15 by Ben.Marsh UGS: Add support for narrowing virtual streams; fetch event and precompiled binaries for parent stream instead. Change 3052990 on 2016/07/17 by Ben.Marsh Show the names of people with notifications disabled in the heading of failure emails, so it's clear that they're not on CC. Change 3053556 on 2016/07/18 by Ben.Marsh BuildGraph: Add a explicit <Option> tag instead of the <Property Default=""/> shenanigans, so that properties that are meant to be modified by the user are listed explicitly. Supported attributes are "DefaultValue" (which specifies a default if the user does not set it on the command line), "Description" (which explains the purpose of the option to users, which is displayed in a table when BuildGraph is invoked with the -listonly argument), and "Restrict" (which specifies a regex to validate an argument supplied by the user). Also add an <EnvVar Name="Blah"/> tag which imports the given environment variable as a property (or sets it to "" if it doesn't exist), and rename the <Choose>/<Option>/<Otherwise> triple to <Switch>/<Case>/<Default> to avoid confusion with the new <Option> tag. Change 3053688 on 2016/07/18 by Ben.Marsh Update build scripts to link to p4-swarm rather than p4-web in dashboard pages and notification emails. Change 3054039 on 2016/07/18 by Ben.Marsh Fix confusing message when compiler isn't installed if the target forces VS2013 Change 3054360 on 2016/07/18 by Ben.Marsh Remove GUBP support from EC scripts. Change 3054399 on 2016/07/18 by Ben.Marsh Remove circular include from Json.h -> JsonSerializerMacros.h -> Json.h Change 3055671 on 2016/07/19 by Ben.Marsh Remove incomplete UWP integration from UE4. Change 3055943 on 2016/07/19 by Ben.Marsh Remove the WinRT target platform. Change 3056270 on 2016/07/19 by Ben.Marsh Core: Move VectorRegister.h include to eliminate include dependency on UnrealMathUtility.h Change 3056390 on 2016/07/19 by Ben.Marsh Core: Directly include headers required by default JsonWriter template instantiation. Change 3057444 on 2016/07/20 by Ben.Marsh UBT: Fall back to checking for the VS140COMNTOOLS environment variable if we couldn't determine the Visual Studio installation directory from the registry. Allows using the standalone Visual Studio build tools to compile UE4. Change 3058337 on 2016/07/20 by Ben.Marsh Remove EnvVarsToXML. All target platforms now determine their compile environment directly from the registry. Change 3058348 on 2016/07/20 by Ben.Marsh Disable optimization for all automation projects. They don't generally do anything particularly CPU intensive, and VS2015 optimizations are inhibitive to debugging. [CL 3058822 by Ben Marsh in Main branch]
2016-07-20 20:25:02 -04:00
yield return ParamString + DescriptionLine;
// we replace the param string on subsequent lines with white space of the same length
ParamString = string.Empty.PadRight(IndentString.Length + RightPadding);
}
}
}
/// <summary>
/// Takes a given sentence and wraps it on a word by word basis so that no line exceeds the
/// set maximum line length. Words longer than a line are broken up. Returns the sentence as
/// a list of individual lines.
/// </summary>
/// <param name="sentence">The sentence to be wrapped</param>
/// <param name="MaximumLineLength">The maximum (non negative) length of the returned sentences</param>
/// <returns>The provided sentence in a list of individual lines no longer than MaximumLineLength</returns>
static List<string> WordWrap(string Sentence, int MaximumLineLength)
{
// Early out
if (Sentence.Length == 0)
{
return new List<string>();
}
string[] words = Sentence.Split(' ');
List<string> WrappedWords = new List<string>();
string CurrentSentence = string.Empty;
foreach (var word in words)
{
// if this is a very large word, split it
if (word.Length > MaximumLineLength)
{
// Top up the current line
WrappedWords.Add(CurrentSentence + word.Substring(0, MaximumLineLength - CurrentSentence.Length));
int length = MaximumLineLength - CurrentSentence.Length;
while (length + MaximumLineLength < word.Length)
{
// Place the starting lengths into their own lines
WrappedWords.Add(word.Substring(length, Math.Min(MaximumLineLength, word.Length - length)));
length += MaximumLineLength;
}
// then the trailing end into the next line
CurrentSentence += word.Substring(length, Math.Min(MaximumLineLength, word.Length - length)) + " ";
}
else
{
if (CurrentSentence.Length + word.Length > MaximumLineLength)
{
// next line and reset sentence
WrappedWords.Add(CurrentSentence);
CurrentSentence = string.Empty;
}
// Add the word to the current sentence.
CurrentSentence += word + " ";
}
}
if (CurrentSentence.Length > 0)
{
WrappedWords.Add(CurrentSentence);
}
return WrappedWords;
}
/// <summary>
/// Gets the description and a list of parameters for the specified type.
/// </summary>
/// <param name="ObjType">Type to get help for.</param>
/// <param name="ObjectDescription">Description</param>
/// <param name="Params">List of paramters</param>
public static void GetTypeHelp(Type ObjType, out string ObjectDescription, out List<string> Params)
{
ObjectDescription = String.Empty;
Params = new List<string>();
var AllAttributes = ObjType.GetCustomAttributes(false);
foreach (var CustomAttribute in AllAttributes)
{
var HelpAttribute = CustomAttribute as HelpAttribute;
if (HelpAttribute != null)
{
if (HelpAttribute.IsParam)
{
Params.Add(HelpAttribute.Description);
}
else if (HelpAttribute.AdditionalHelp != null)
{
string DummyDescription;
List<string> AdditionalParams;
GetTypeHelp(HelpAttribute.AdditionalHelp, out DummyDescription, out AdditionalParams);
Params.AddRange(AdditionalParams);
}
else
{
ObjectDescription = HelpAttribute.Description;
}
}
}
var AllMembers = GetAllMemebers(ObjType);
foreach (var Member in AllMembers)
{
var AllMemeberAtributes = Member.GetCustomAttributes(false);
foreach (var CustomAttribute in AllMemeberAtributes)
{
var HelpAttribute = CustomAttribute as HelpAttribute;
if (HelpAttribute != null && HelpAttribute.IsParam)
{
Params.Add(HelpAttribute.Description);
}
}
}
}
private static List<MemberInfo> GetAllMemebers(Type ObjType)
{
var Members = new List<MemberInfo>();
for (; ObjType != null; ObjType = ObjType.BaseType)
{
var ObjMembers = ObjType.GetMembers(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
Members.AddRange(ObjMembers);
}
return Members;
}
#endregion
}
}