You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
==========================
MAJOR FEATURES + CHANGES
==========================
#lockdown Nick.Penwarden
Change 2903938 on 2016/03/10 by Frank.Gigliotti
Added an instance ID to FAnimMontageInstance
#CodeReview Laurent.Delayen
#RB Laurent.Delayen
#Tests PIE
Change 2903745 on 2016/03/10 by Wes.Hunt
Update Oodle TPS
#rb none
#tests none
#codereview:john.pollard
Change 2903689 on 2016/03/10 by Uriel.Doyon
New "LogHeroMaterials" console command, displaying the current state of materials and textures on the character hero.
#rb marcus.wasmer
#codereview marcus.wassmer
#tests editor, playing PC games, trying the new command
Change 2903669 on 2016/03/10 by Aaron.McLeran
OR-17180 Make stat soundcues and stat soundwaves NOT display zero volume sounds
- Change only effects debug stat commands for audio guys
#rb none
#tests played paragon with new debug stat commands, confirms doesn't show zero-volume sounds
Change 2903625 on 2016/03/10 by John.Pollard
XB1 Oodle SDK
#rb none
#tests none
#codereview Jeff.Campeau
Change 2903577 on 2016/03/10 by Ben.Marsh
Remaking latest build scripts from //UE4/Main @ 2900980.
Change 2903560 on 2016/03/10 by Ben.Marsh
Initial version of BuildGraph scripts - used to create build processes in UE4 which can be run locally or in parallel across a build farm (assuming synchronization and resource allocation implemented by a separate system). Intended to supersede GUBP.
Build graphs are declared using an XML script using syntax similar to MSBuild, ANT or NAnt, and consist of the following components:
* Tasks: Building blocks which can be executed as part of the build process. Many predefined tasks are provided (<Cook>, <Compile>, <Copy>, <Stage>, <Log>, <PakFile>, etc...), and additional tasks may be added be declaring classes derived from AutomationTool.CustomTask in other UAT modules.
* Nodes: A named sequence of tasks which is executed to produce outputs. Nodes may have input dependencies on other nodes before they can be executed. Declared with the <Node> element in scripts.
* Agent Groups: A set of nodes nodes which is executed on the same machine if running as part of a build system. Has no effect when building locally. Declared with the <Group> element in scripts.
* Triggers: Container for groups which should only be executed when explicitly triggered (using the -Trigger=<Name> or -SkipTriggers command line argument). Declared with the <Trigger> element in scripts.
* Notifiers: Specifies email recipients for failures in one or more nodes, whether they should receive notifications on warnings, and so on.
Properties can be passed in to a script on the command line, or set procedurally with the <Property Name="Foo" Value="Bar"/> syntax. Properties referenced with the $(Property Name) notation are valid within all strings, and will be expanded as macros when the script is read. If a property name is not set explicitly, it defaults to the contents of an environment variable with the same name.
Local properties, which only affect the scope of the containing XML element (node, group, etc...) are declared with the <Local Name="Foo" Value="Bar"/> element, and will override a similarly named global property for the local property's scope.
Any elements can be conditionally defined via the "If" attribute, and are largely identical to MSBuild conditions. Literals in conditions may be quoted with single (') or double (") quotes, or an unquoted sequence of letters, digits and underscore characters. All literals are considered identical regardless of how they are declared, and are considered case-insensitive for comparisons (so true equals 'True', equals "TRUE"). Available operators are "==", "!=", "And", "Or", "!", "(...)", "Exists(...)" and "HasTrailingSlash(...)". A full grammar is written up in Condition.cs.
File manipulation is done using wildcards and tags. Any attribute that accepts a list of files may consist of: a Perforce-style wildcard (matching any number of "...", "*" and "?" patterns in any location), a full path name, or a reference to a tagged collection of files, denoted by prefixing with a '#' character. Files may be added to a tag set using the <Tag> Task, which also allows performing set union/difference style operations. Each node can declare multiple outputs in the form of a list of named tags, which other nodes can then depend on.
Build graphs may be executed in parallel as part build system. To do so, the initial graph configuration is generated by running with the -Export=<Filename> argument (producing a JSON file listing the nodes and dependencies to execute). Each participating agent should be synced to the same changelist, and UAT should be re-run with the appropriate -Node=<Name> argument. Outputs from different nodes are transferred between agents via shared storage, typically a network share, the path to which can be specified on the command line using the -SharedStorageDir=<Path> argument. Note that the allocation of machines, and coordination between them, is assumed to be managed by an external system.
A schema for the known set of tasks can be generated by running UAT with the "-Schema=<FileName>" option. Generating a schema and referencing it from a BuildGraph script allows Visual Studio to validate and auto-complete elements as you type.
#rb none
#codereview Marc.Audy, Wes.Hunt, Matthew.Griffin, Richard.Fawcett
#tests local only so far, but not part of any build process yet
Change 2903539 on 2016/03/10 by John.Pollard
Improve replay playback debugging of character movement
#rb none
#tests replays
Change 2903526 on 2016/03/10 by Ben.Marsh
Remake changes from //UE4/Main without integration history, to add support for BuildGraph tasks.
#rb none
#tests none
Change 2903512 on 2016/03/10 by Dan.Youhon
Modify minimum Duration values for JumpForce and MoveToForce ability tasks so that having minimum Duration values doesn't trigger check()s
#rb None
#tests Compiles
Change 2903474 on 2016/03/10 by Marc.Audy
Fix crash if ChildActor is null
#rb None
#tests None
Change 2903314 on 2016/03/10 by Marc.Audy
Fix ParentComponent not being persisted and fixup content that was saved in the window it was broken
#rb James.Golding
#tests Selection of child actors works as expected
#jira UE-28201
Change 2903298 on 2016/03/10 by Simon.Tovey
Disabling the trails optimization.
#tests none
#rb none
#codereview Olaf.Piesche
Change 2903124 on 2016/03/10 by Robert.Manuszewski
Small refactor to pak signing to help with exe protection
#rb none
#tests none
[CL 2907678 by Andrew Grant in Main branch]
331 lines
11 KiB
C#
331 lines
11 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AutomationTool
|
|
{
|
|
/// <summary>
|
|
/// Exception class thrown due to type and syntax errors in condition expressions
|
|
/// </summary>
|
|
class ConditionException : Exception
|
|
{
|
|
/// <summary>
|
|
/// Constructor; formats the exception message with the given String.Format() style parameters.
|
|
/// </summary>
|
|
/// <param name="Format">Formatting string, in String.Format syntax</param>
|
|
/// <param name="Args">Optional arguments for the string</param>
|
|
public ConditionException(string Format, params object[] Args) : base(String.Format(Format, Args))
|
|
{
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Class to evaluate condition expressions in build scripts, following this grammar:
|
|
///
|
|
/// or-expression ::= and-expression
|
|
/// | or-expression "Or" and-expression;
|
|
///
|
|
/// and-expression ::= comparison
|
|
/// | and-expression "And" comparison;
|
|
///
|
|
/// comparison ::= scalar
|
|
/// | scalar "==" scalar
|
|
/// | scalar "!=" scalar;
|
|
///
|
|
/// scalar ::= "(" or-expression ")"
|
|
/// | "!" scalar
|
|
/// | "Exists" "(" scalar ")"
|
|
/// | "HasTrailingSlash" "(" scalar ")"
|
|
/// | string
|
|
/// | identifier;
|
|
///
|
|
/// string ::= any sequence of characters terminated by single quotes (') or double quotes ("). Not escaped.
|
|
/// identifier ::= any sequence of letters, digits, or underscore characters.
|
|
///
|
|
/// The type of each subexpression is always a scalar, which are converted to expression-specific types (eg. booleans) as required.
|
|
/// Scalar values are case-insensitive strings. The identifier 'true' and the strings "true" and "True" are all identical scalars.
|
|
/// </summary>
|
|
static class Condition
|
|
{
|
|
/// <summary>
|
|
/// Sentinel added to the end of a sequence of tokens.
|
|
/// </summary>
|
|
const string EndToken = "<EOF>";
|
|
|
|
/// <summary>
|
|
/// Evaluates the given string as a condition. Throws a ConditionException on a type or syntax error.
|
|
/// </summary>
|
|
/// <param name="Text">The condition text</param>
|
|
/// <returns>The result of evaluating the condition</returns>
|
|
public static bool Evaluate(string Text)
|
|
{
|
|
List<string> Tokens = new List<string>();
|
|
Tokenize(Text, Tokens);
|
|
|
|
bool bResult = true;
|
|
if(Tokens.Count > 1)
|
|
{
|
|
int Idx = 0;
|
|
string Result = EvaluateOr(Tokens, ref Idx);
|
|
if(Tokens[Idx] != EndToken)
|
|
{
|
|
throw new ConditionException("Garbage after expression: {0}", String.Join("", Tokens.Skip(Idx)));
|
|
}
|
|
bResult = CoerceToBool(Result);
|
|
}
|
|
return bResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Evaluates an "or-expression" production.
|
|
/// </summary>
|
|
/// <param name="Tokens">List of tokens in the expression</param>
|
|
/// <param name="Idx">Current position in the token stream. Will be incremented as tokens are consumed.</param>
|
|
/// <returns>A scalar representing the result of evaluating the expression.</returns>
|
|
static string EvaluateOr(List<string> Tokens, ref int Idx)
|
|
{
|
|
// <Condition> Or <Condition> Or...
|
|
string Result = EvaluateAnd(Tokens, ref Idx);
|
|
while(String.Compare(Tokens[Idx], "Or", true) == 0)
|
|
{
|
|
// Evaluate this condition. We use a binary OR here, because we want to parse everything rather than short-circuit it.
|
|
Idx++;
|
|
string Lhs = Result;
|
|
string Rhs = EvaluateAnd(Tokens, ref Idx);
|
|
Result = (CoerceToBool(Lhs) | CoerceToBool(Rhs))? "true" : "false";
|
|
}
|
|
return Result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Evaluates an "and-expression" production.
|
|
/// </summary>
|
|
/// <param name="Tokens">List of tokens in the expression</param>
|
|
/// <param name="Idx">Current position in the token stream. Will be incremented as tokens are consumed.</param>
|
|
/// <returns>A scalar representing the result of evaluating the expression.</returns>
|
|
static string EvaluateAnd(List<string> Tokens, ref int Idx)
|
|
{
|
|
// <Condition> And <Condition> And...
|
|
string Result = EvaluateComparison(Tokens, ref Idx);
|
|
while(String.Compare(Tokens[Idx], "And", true) == 0)
|
|
{
|
|
// Evaluate this condition. We use a binary AND here, because we want to parse everything rather than short-circuit it.
|
|
Idx++;
|
|
string Lhs = Result;
|
|
string Rhs = EvaluateComparison(Tokens, ref Idx);
|
|
Result = (CoerceToBool(Lhs) & CoerceToBool(Rhs))? "true" : "false";
|
|
}
|
|
return Result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Evaluates a "comparison" production.
|
|
/// </summary>
|
|
/// <param name="Tokens">List of tokens in the expression</param>
|
|
/// <param name="Idx">Current position in the token stream. Will be incremented as tokens are consumed.</param>
|
|
/// <returns>The result of evaluating the expression</returns>
|
|
static string EvaluateComparison(List<string> Tokens, ref int Idx)
|
|
{
|
|
// Scalar
|
|
// Scalar == Scalar
|
|
// Scalar != Scalar
|
|
|
|
string Result = EvaluateScalar(Tokens, ref Idx);
|
|
if(Tokens[Idx] == "==")
|
|
{
|
|
// Compare two scalars for equality
|
|
Idx++;
|
|
string Lhs = Result;
|
|
string Rhs = EvaluateScalar(Tokens, ref Idx);
|
|
Result = (String.Compare(Lhs, Rhs, true) == 0)? "true" : "false";
|
|
}
|
|
else if(Tokens[Idx] == "!=")
|
|
{
|
|
// Compare two scalars for inequality
|
|
Idx++;
|
|
string Lhs = Result;
|
|
string Rhs = EvaluateScalar(Tokens, ref Idx);
|
|
Result = (String.Compare(Lhs, Rhs, true) != 0)? "true" : "false";
|
|
}
|
|
return Result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Evaluates a "scalar" production.
|
|
/// </summary>
|
|
/// <param name="Tokens">List of tokens in the expression</param>
|
|
/// <param name="Idx">Current position in the token stream. Will be incremented as tokens are consumed.</param>
|
|
/// <returns>The result of evaluating the expression</returns>
|
|
static string EvaluateScalar(List<string> Tokens, ref int Idx)
|
|
{
|
|
string Result;
|
|
if(Tokens[Idx] == "(")
|
|
{
|
|
// Subexpression
|
|
Idx++;
|
|
Result = EvaluateOr(Tokens, ref Idx);
|
|
if(Tokens[Idx] != ")")
|
|
{
|
|
throw new ConditionException("Expected ')'");
|
|
}
|
|
Idx++;
|
|
}
|
|
else if(Tokens[Idx] == "!")
|
|
{
|
|
// Logical not
|
|
Idx++;
|
|
string Rhs = EvaluateScalar(Tokens, ref Idx);
|
|
Result = CoerceToBool(Rhs)? "false" : "true";
|
|
}
|
|
else if(String.Compare(Tokens[Idx], "Exists", true) == 0 && Tokens[Idx + 1] == "(")
|
|
{
|
|
// Check whether file or directory exists. Evaluate the argument as a subexpression.
|
|
Idx++;
|
|
string Argument = EvaluateScalar(Tokens, ref Idx);
|
|
Result = File.Exists(Argument)? "true" : "false";
|
|
}
|
|
else if(String.Compare(Tokens[Idx], "HasTrailingSlash", true) == 0 && Tokens[Idx + 1] == "(")
|
|
{
|
|
// Check whether the given string ends with a slash
|
|
Idx++;
|
|
string Argument = EvaluateScalar(Tokens, ref Idx);
|
|
Result = (Argument.Last() == Path.DirectorySeparatorChar || Argument.Last() == Path.AltDirectorySeparatorChar)? "true" : "false";
|
|
}
|
|
else
|
|
{
|
|
// Raw scalar. Remove quotes from strings, and allow literals and simple identifiers to pass through directly.
|
|
string Token = Tokens[Idx];
|
|
if(Token.Length >= 2 && (Token[0] == '\'' || Token[0] == '\"') && Token[Token.Length - 1] == Token[0])
|
|
{
|
|
Result = Token.Substring(1, Token.Length - 2);
|
|
Idx++;
|
|
}
|
|
else if(Char.IsLetterOrDigit(Token[0]) || Token[0] == '_')
|
|
{
|
|
Result = Token;
|
|
Idx++;
|
|
}
|
|
else
|
|
{
|
|
throw new ConditionException("Token '{0}' is not a valid scalar", Token);
|
|
}
|
|
}
|
|
return Result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Converts a scalar to a boolean value.
|
|
/// </summary>
|
|
/// <param name="Scalar">The scalar to convert</param>
|
|
/// <returns>The scalar converted to a boolean value.</returns>
|
|
static bool CoerceToBool(string Scalar)
|
|
{
|
|
bool Result;
|
|
if(String.Compare(Scalar, "true", true) == 0)
|
|
{
|
|
Result = true;
|
|
}
|
|
else if(String.Compare(Scalar, "false", true) == 0)
|
|
{
|
|
Result = false;
|
|
}
|
|
else
|
|
{
|
|
throw new ConditionException("Token '{0}' cannot be coerced to a bool", Scalar);
|
|
}
|
|
return Result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Splits an input string up into expression tokens.
|
|
/// </summary>
|
|
/// <param name="Text">Text to be converted into tokens</param>
|
|
/// <param name="Tokens">List to receive a list of tokens</param>
|
|
static void Tokenize(string Text, List<string> Tokens)
|
|
{
|
|
int Idx = 0;
|
|
while(Idx < Text.Length)
|
|
{
|
|
int EndIdx = Idx + 1;
|
|
if(!Char.IsWhiteSpace(Text[Idx]))
|
|
{
|
|
// Scan to the end of the current token
|
|
if(Char.IsNumber(Text[Idx]))
|
|
{
|
|
// Number
|
|
while(EndIdx < Text.Length && Char.IsNumber(Text[EndIdx]))
|
|
{
|
|
EndIdx++;
|
|
}
|
|
}
|
|
else if(Char.IsLetter(Text[Idx]) || Text[Idx] == '_')
|
|
{
|
|
// Identifier
|
|
while(EndIdx < Text.Length && (Char.IsLetterOrDigit(Text[EndIdx]) || Text[EndIdx] == '_'))
|
|
{
|
|
EndIdx++;
|
|
}
|
|
}
|
|
else if(Text[Idx] == '!' || Text[Idx] == '<' || Text[Idx] == '>' || Text[Idx] == '=')
|
|
{
|
|
// Operator that can be followed by an equals character
|
|
if(EndIdx < Text.Length && Text[EndIdx] == '=')
|
|
{
|
|
EndIdx++;
|
|
}
|
|
}
|
|
else if(Text[Idx] == '\'' || Text[Idx] == '\"')
|
|
{
|
|
// String
|
|
if(EndIdx < Text.Length)
|
|
{
|
|
EndIdx++;
|
|
while(EndIdx < Text.Length && Text[EndIdx - 1] != Text[Idx]) EndIdx++;
|
|
}
|
|
}
|
|
Tokens.Add(Text.Substring(Idx, EndIdx - Idx));
|
|
}
|
|
Idx = EndIdx;
|
|
}
|
|
Tokens.Add(EndToken);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Test cases for conditions.
|
|
/// </summary>
|
|
public static void TestConditions()
|
|
{
|
|
TestCondition("1 == 2", false);
|
|
TestCondition("1 == 1", true);
|
|
TestCondition("1 != 2", true);
|
|
TestCondition("1 != 1", false);
|
|
TestCondition("'hello' == 'hello'", true);
|
|
TestCondition("'hello' == ('hello')", true);
|
|
TestCondition("'hello' == 'world'", false);
|
|
TestCondition("'hello' != ('world')", true);
|
|
TestCondition("true == ('true')", true);
|
|
TestCondition("true == ('True')", true);
|
|
TestCondition("true == ('false')", false);
|
|
TestCondition("true == !('False')", true);
|
|
TestCondition("true == 'true' and 'false' == 'False'", true);
|
|
TestCondition("true == 'true' and 'false' == 'true'", false);
|
|
TestCondition("true == 'false' or 'false' == 'false'", true);
|
|
TestCondition("true == 'false' or 'false' == 'true'", true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Helper method to evaluate a condition and check it's the expected result
|
|
/// </summary>
|
|
/// <param name="Condition">Condition to evaluate</param>
|
|
/// <param name="ExpectedResult">The expected result</param>
|
|
static void TestCondition(string Condition, bool ExpectedResult)
|
|
{
|
|
bool Result = Evaluate(Condition);
|
|
Console.WriteLine("{0}: {1} = {2}", (Result == ExpectedResult)? "PASS" : "FAIL", Condition, Result);
|
|
}
|
|
}
|
|
}
|