Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/AutomationUtils/BuildEnvironment.cs
Matthew Griffin 20be235fa6 Merging //UE4/Release-4.11 to //UE4/Main (Up to 2874930)
#lockdown Nick.Penwarden

==========================
MAJOR FEATURES + CHANGES
==========================

Change 2868448 on 2016/02/16 by Mark.Satterthwaite

	Bring MetalRHI & MetalShaderFormat mostly up to Dev-Platform CL #2867146 to address JIRA UE-26181 and as the first part of addressing JIRA UE-23208. Only CL #2854142 has been omitted for compatibility with the 4.11 branch.
	#jira UE-26181

Change 2868454 on 2016/02/16 by Mark.Satterthwaite

	Shader changes necessary to properly fix Mobile Preview under Mac Metal (JIRA UE-23208) - Mac ES 3.1 doesn't support framebuffer fetch & is in fact a Mobile Emulation shader platform.
	#jira UE-23208

Change 2868650 on 2016/02/16 by Matthew.Griffin

	Allow Developer modules to be pre-compiled when the target is editor.
	#jira UE-26802

Change 2868859 on 2016/02/16 by Nick.Whiting

	Merging StereoPanorama fixes from Main to Release-4.11 (CL 2811839)

	#jira UE-25066

Change 2868927 on 2016/02/16 by Mieszko.Zielinski

	Fixed some regular-use crashes in LogVisualizer #UE4

	#rb Lukasz.Furman
	#jira UE-27003

Change 2868994 on 2016/02/16 by Lina.Halper

	Fix refresh UI issue with remove joint

	#jira : UE-26529
	#rb: Martin.Wilson

Change 2868996 on 2016/02/16 by Lina.Halper

	Fix node stop working when negative value of LODThreshold

	#jira: UE-26828
	#rb:Martin.Wilson

Change 2868998 on 2016/02/16 by Lina.Halper

	Fix with crash when invalid index has entered

	#jira : UE-26715
	#rb : Martin.Wilson

Change 2869003 on 2016/02/16 by Ori.Cohen

	- Fix thread safety issue when cloth child collision or environment collision is used.
	- Fix cloth bounds growing when stale transform data is used.

	#JIRA OR-14990
	#rb James.Golding

Change 2869109 on 2016/02/16 by mason.seay

	Updated test assets for Restitution testing

	#jira UE-24473

Change 2869223 on 2016/02/16 by Taizyd.Korambayil

	#jira UE-19083 Disabled LOD on SkySphere BP

Change 2869558 on 2016/02/16 by Dan.Oconnor

	Conservative fix for crash that occurs when adding a weak object ptr to an array of object ptrs in a blueprint
	#jira UE-25893

Change 2869891 on 2016/02/17 by Thomas.Sarkanen

	Fix crash when re-compiling anim BPs that are dependencies of 'parent' Blueprints

	Force a re-initialzation of nodes when initializing the whole anim instance. The bInitialized flag was intended as a runtime optimization - we assume our function will not change for the lifetime of the UAnimInstance. While parts of the graph will be re-initialized we dont need to re-acquire our UFunction ptrs (etc.) unless the whole instance is getting re-initialized.

	#rb Martin.Wilson
	#jira UE-26642 - Switch Skeletal Mesh node crashes the editor if the blueprint is compiled.

Change 2869956 on 2016/02/17 by Tim.Hobson

	#Jira UE-26550 - Added three new icons for Arrow, Locked, and Unlocked per request from IanS.

Change 2869965 on 2016/02/17 by Gareth.Martin

	Fix check() being hit when loading KiteDemo x1_y1 (and other old foliage maps)
	#jira UE-26930

Change 2870007 on 2016/02/17 by Richard.TalbotWatkin

	Merging from //UE4/Dev-Editor CL 2867609

	Fixed auto-generation of unique object/package names when duplicating, so they generate the same names if they the source object was named the same as its package.
	#jira UE-25769 - Crash when Copy+Pasting numbered umaps in the content browser
	#RB Bob.Tellez

Change 2870072 on 2016/02/17 by Michael.Schoell

	Level Blueprints will no longer preload newly created Blueprints that they reference when they are reloaded.

	#jira UE-23637 - Use of Blueprint delegate in sub-level script causes errors on startup

Change 2870087 on 2016/02/17 by Matthew.Griffin

	Removed Android and IOS from list of platforms to build only for UnrealMatch3, so that they can be cooked and packaged correctly.

Change 2870141 on 2016/02/17 by mason.seay

	Test content for Copy Pose From Mesh

	#jira UE-24473

Change 2870195 on 2016/02/17 by Mieszko.Zielinski

	PR #2052: Added missing Super::BeginPlay() (Contributed by Skylonxe)

	#jira UE-26915

Change 2870325 on 2016/02/17 by Steve.Robb

[CL 2882948 by Matthew Griffin in Main branch]
2016-02-26 05:49:37 -05:00

250 lines
8.0 KiB
C#

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Reflection;
using Microsoft.Win32;
using System.Diagnostics;
using Tools.DotNETCommon;
using UnrealBuildTool;
using System.Text.RegularExpressions;
namespace AutomationTool
{
/// <summary>
/// Defines the environment variable names that will be used to setup the environemt.
/// </summary>
static class EnvVarNames
{
// Command Environment
static public readonly string LocalRoot = "uebp_LOCAL_ROOT";
static public readonly string LogFolder = "uebp_LogFolder";
static public readonly string CSVFile = "uebp_CSVFile";
static public readonly string EngineSavedFolder = "uebp_EngineSavedFolder";
static public readonly string MacMallocNanoZone = "MallocNanoZone";
// Perforce Environment
static public readonly string P4Port = "uebp_PORT";
static public readonly string ClientRoot = "uebp_CLIENT_ROOT";
static public readonly string Changelist = "uebp_CL";
static public readonly string User = "uebp_USER";
static public readonly string Client = "uebp_CLIENT";
static public readonly string BuildRootP4 = "uebp_BuildRoot_P4";
static public readonly string BuildRootEscaped = "uebp_BuildRoot_Escaped";
static public readonly string LabelToSync = "uebp_LabelToSync";
static public readonly string P4Password = "uebp_PASS";
}
/// <summary>
/// Environment to allow access to commonly used environment variables.
/// </summary>
public class CommandEnvironment
{
/// <summary>
/// Path to a file we know to always exist under the UE4 root directory.
/// </summary>
public static readonly string KnownFileRelativeToRoot = @"Engine/Config/BaseEngine.ini";
#region Command Environment properties
public string LocalRoot { get; protected set; }
public string EngineSavedFolder { get; protected set; }
public string LogFolder { get; protected set; }
public string CSVFile { get; protected set; }
public string RobocopyExe { get; protected set; }
public string MountExe { get; protected set; }
public string CmdExe { get; protected set; }
public string UATExe { get; protected set; }
public string TimestampAsString { get; protected set; }
public bool HasCapabilityToCompile { get; protected set; }
public string MsBuildExe { get; protected set; }
public string MsDevExe { get; protected set; }
public string MallocNanoZone { get; protected set; }
#endregion
internal CommandEnvironment()
{
InitEnvironment();
}
/// <summary>
/// Sets the location of the exe.
/// </summary>
protected void SetUATLocation()
{
if (String.IsNullOrEmpty(UATExe))
{
UATExe = Assembly.GetEntryAssembly().GetOriginalLocation();
}
if (!CommandUtils.FileExists_NoExceptions(UATExe))
{
throw new AutomationException("Could not find AutomationTool.exe. Reflection indicated it was here: {0}", UATExe);
}
}
/// <summary>
/// Sets the location of the AutomationTool/Saved directory
/// </summary>
protected void SetUATSavedPath()
{
var LocalRootPath = CommandUtils.GetEnvVar(EnvVarNames.LocalRoot);
var SavedPath = CommandUtils.CombinePaths(PathSeparator.Slash, LocalRootPath, "Engine", "Programs", "AutomationTool", "Saved");
CommandUtils.SetEnvVar(EnvVarNames.EngineSavedFolder, SavedPath);
}
/// <summary>
/// Initializes the environement.
/// </summary>
protected virtual void InitEnvironment()
{
SetUATLocation();
LocalRoot = CommandUtils.GetEnvVar(EnvVarNames.LocalRoot);
if (String.IsNullOrEmpty(CommandUtils.GetEnvVar(EnvVarNames.EngineSavedFolder)))
{
SetUATSavedPath();
}
if (LocalRoot.EndsWith(":"))
{
LocalRoot += Path.DirectorySeparatorChar;
}
EngineSavedFolder = CommandUtils.GetEnvVar(EnvVarNames.EngineSavedFolder);
CSVFile = CommandUtils.GetEnvVar(EnvVarNames.CSVFile);
LogFolder = CommandUtils.GetEnvVar(EnvVarNames.LogFolder);
RobocopyExe = GetSystemExePath("robocopy.exe");
MountExe = GetSystemExePath("mount.exe");
CmdExe = Utils.IsRunningOnMono ? "/bin/sh" : GetSystemExePath("cmd.exe");
MallocNanoZone = "0";
CommandUtils.SetEnvVar(EnvVarNames.MacMallocNanoZone, MallocNanoZone);
if (String.IsNullOrEmpty(LogFolder))
{
throw new AutomationException("Environment is not set up correctly: LogFolder is not set!");
}
if (String.IsNullOrEmpty(LocalRoot))
{
throw new AutomationException("Environment is not set up correctly: LocalRoot is not set!");
}
if (String.IsNullOrEmpty(EngineSavedFolder))
{
throw new AutomationException("Environment is not set up correctly: EngineSavedFolder is not set!");
}
// Make sure that the log folder exists
var LogFolderInfo = new DirectoryInfo(LogFolder);
if (!LogFolderInfo.Exists)
{
LogFolderInfo.Create();
}
// Setup the timestamp string
DateTime LocalTime = DateTime.Now;
string TimeStamp = LocalTime.Year + "-"
+ LocalTime.Month.ToString("00") + "-"
+ LocalTime.Day.ToString("00") + "_"
+ LocalTime.Hour.ToString("00") + "."
+ LocalTime.Minute.ToString("00") + "."
+ LocalTime.Second.ToString("00");
TimestampAsString = TimeStamp;
SetupBuildEnvironment();
LogSettings();
}
/// <summary>
/// Returns the path to an executable in the System Directory.
/// To help support running 32-bit assemblies on a 64-bit operating system, if the executable
/// can't be found in System32, we also search Sysnative.
/// </summary>
/// <param name="ExeName">The name of the executable to find</param>
/// <returns>The path to the executable within the system folder</returns>
string GetSystemExePath(string ExeName)
{
var Result = CommandUtils.CombinePaths(Environment.SystemDirectory, ExeName);
if (!CommandUtils.FileExists(Result))
{
// Use Regex.Replace so we can do a case-insensitive replacement of System32
var SysNativeDirectory = Regex.Replace(Environment.SystemDirectory, "System32", "Sysnative", RegexOptions.IgnoreCase);
var SysNativeExe = CommandUtils.CombinePaths(SysNativeDirectory, ExeName);
if (CommandUtils.FileExists(SysNativeExe))
{
Result = SysNativeExe;
}
}
return Result;
}
void LogSettings()
{
Log.TraceVerbose("Command Environment settings:");
Log.TraceVerbose("CmdExe={0}", CmdExe);
Log.TraceVerbose("EngineSavedFolder={0}", EngineSavedFolder);
Log.TraceVerbose("HasCapabilityToCompile={0}", HasCapabilityToCompile);
Log.TraceVerbose("LocalRoot={0}", LocalRoot);
Log.TraceVerbose("LogFolder={0}", LogFolder);
Log.TraceVerbose("MountExe={0}", MountExe);
Log.TraceVerbose("MsBuildExe={0}", MsBuildExe);
Log.TraceVerbose("MsDevExe={0}", MsDevExe);
Log.TraceVerbose("RobocopyExe={0}", RobocopyExe);
Log.TraceVerbose("TimestampAsString={0}", TimestampAsString);
Log.TraceVerbose("UATExe={0}", UATExe);
}
#region Compiler Setup
/// <summary>
/// Initializes build environemnt: finds the path to msbuild.exe
/// </summary>
void SetupBuildEnvironment()
{
// Assume we have the capability co compile.
HasCapabilityToCompile = true;
if (HasCapabilityToCompile)
{
try
{
MsBuildExe = HostPlatform.Current.GetMsBuildExe();
}
catch (Exception Ex)
{
Log.WriteLine(LogEventType.Warning, Ex.Message);
Log.WriteLine(LogEventType.Warning, "Assuming no compilation capability.");
HasCapabilityToCompile = false;
MsBuildExe = "";
}
}
if (HasCapabilityToCompile)
{
try
{
MsDevExe = HostPlatform.Current.GetMsDevExe();
}
catch (Exception Ex)
{
Log.WriteLine(LogEventType.Warning, Ex.Message);
Log.WriteLine(LogEventType.Warning, "Assuming no solution compilation capability.");
MsDevExe = "";
}
}
Log.TraceVerbose("CompilationEvironment.HasCapabilityToCompile={0}", HasCapabilityToCompile);
Log.TraceVerbose("CompilationEvironment.MsBuildExe={0}", MsBuildExe);
Log.TraceVerbose("CompilationEvironment.MsDevExe={0}", MsDevExe);
}
#endregion
}
}