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 2927181 on 2016/03/29 by Dmitry.Rekman (Optionally) exclude idle time from server FPS charts. - Time spent waiting for the next frame in order to hit capped FPS can be optionally excluded by using t.FPSChart.ExcludeIdleTime (set to 1 for servers). - Server FPS charts analytics events and log output will include the information if idle time was excluded. - Also: added a log line each time we detect a server hitch for easier pin-pointing them in the log. #rb Paul.Moore #codereview Paul.Moore, Michael.Noland #tests Ran Linux server and Windows client on compatible content. Change 2927084 on 2016/03/29 by Ben.Marsh BuildGraph: Don't allow triggers to run until all their order dependencies are complete. Just because a downstream node doesn't have a dependency on an upstream node via temp storage doesn't mean it can run immediately. #rb none #tests none Change2927060on 2016/03/29 by Michael.Noland Renamed GPU analytics event from GPU to DesktopGPU to reflect that it is the default desktop adapter and not the one we initialized (which is GPUAdapter) Updated text/log based FPS chart events to print out GPUAdapter instead (with DesktopGPU in parens if they differ, e.g., in an optimus setup) #rb marcus.wassmer #tests Ran and did some fps charts Change 2927048 on 2016/03/29 by Michael.Noland HLOD: Removed an unused cvar r.HLODEnabled (everything is done thru r.HLOD) #tests Compiled and ran Paragon #rb marcus.wassmer Change 2926920 on 2016/03/29 by Ben.Marsh BuildGraph: Update schema with Rename task. Change 2926911 on 2016/03/29 by Ben.Marsh BuildGraph: Add a task which can rename files matching a given wildcard. Syntax is: <Rename Files="*.txt" To="*.md"> or <Rename Files="Engine/Build/..." From="*.txt" To="*.md"/> #rb none #tests none Change2926908on 2016/03/29 by Andrew.Grant Fix for CDO properties of renamed blueprints not being applied #rb none #tests loaded Origin map (renamed from Playgo3) and verified properties are applied. Change 2926799 on 2016/03/29 by Jason.Bestimt #ORION_DG - Merge MAIN (23) @ CL# 2926780 #RB:none #Tests:none Change 2926663 on 2016/03/29 by david.nikdel #ROBOMERGE-OBO: jason.bestimt #ROBOMERGE-SOURCE: CL 2926660 in //Orion/Release-0.23/... via CL 2926662 #ROBOMERGE-BOT: ORION (Main -> Dev-General) #ORION_23 - Potential fix for Cook failures "Fix shelved in 2926635, tested in Dev-Blueprints. Could not run any GEditor related logic safely in ShutdownModule because of the same destruction issue orders that caused the bug in the first place. I will chat with Editor team about nulling out GEditor the same way we null out GUnrealEd." #RB:none #Tests: none [CodeReviewed]: andrew.grant, dan.oconnor Change 2926510 on 2016/03/29 by Andrew.Grant Potential fix for OR-18207 - editor becomes unresponsive (audio deadlock) #rb none #tests compiled Change 2926495 on 2016/03/29 by Rob.Cannaday Change storing HTTP requests as raw pointers to weak pointers with validity being checked via Pinning it #jira FORT-18947 #jira OR-17695 #tests golden path #rb eric.newman Change 2926427 on 2016/03/29 by Josh.Markiewicz #UE4 - fixed typo #rb none #tests none Change 2926250 on 2016/03/29 by Martin.Mittring fixed OR-18489 HERO: IGGY: RMB on E ability causes blinding hair effect #rb:Chris.Bunner #codereview:Brian.Karis Change 2926224 on 2016/03/29 by Daniel.Lamb Fix for potenital threading issue with Console manager removing vars which could cause double free. #rb Robert.Manuszewski #test Orion cook Change 2926174 on 2016/03/29 by Gareth.Martin Cloned fix for bUseMaterialPositionOffsetInStaticLighting crashing across from //UE4/Dev-Landscape/ to unblock people #rb #tests editor Change 2925968 on 2016/03/29 by David.Nikdel #MCP #OSS - Read RedirectUrl from ini #RB: Eric.Newman #TESTS: compiled in another branch (merge over) #ROBOMERGE: Main [CL 2929424 by Andrew Grant in Main branch]
375 lines
12 KiB
C#
375 lines
12 KiB
C#
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Threading;
|
|
using System.Reflection;
|
|
using System.Linq;
|
|
using System.Net.Mail;
|
|
using AutomationTool;
|
|
using UnrealBuildTool;
|
|
|
|
/// <summary>
|
|
/// Helper command used for rebuilding a projects light maps.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Command line parameters used by this command:
|
|
/// -project - Absolute path to a .uproject file
|
|
/// -MapsToRebuildLightMaps - A list of '+' delimited maps we wish to build lightmaps for.
|
|
/// -CommandletTargetName - The Target used in running the commandlet
|
|
/// -StakeholdersEmailAddresses - Users to notify of completion
|
|
///
|
|
/// </remarks>
|
|
namespace AutomationScripts.Automation
|
|
{
|
|
[RequireP4]
|
|
public class RebuildLightMaps : BuildCommand
|
|
{
|
|
// The rebuild lighting process
|
|
#region RebuildLightMaps Command
|
|
|
|
public override void ExecuteBuild()
|
|
{
|
|
Log("********** REBUILD LIGHT MAPS COMMAND STARTED **********");
|
|
|
|
try
|
|
{
|
|
var Params = new ProjectParams
|
|
(
|
|
Command: this,
|
|
// Shared
|
|
RawProjectPath: ProjectPath
|
|
);
|
|
|
|
// Sync and build our targets required for the commandlet to run correctly.
|
|
// P4.Sync(String.Format("-f {0}/...#head", P4Env.BuildRootP4));
|
|
|
|
bool NoBuild = ParseParam("nobuild");
|
|
|
|
if (!NoBuild)
|
|
{
|
|
BuildNecessaryTargets();
|
|
}
|
|
CreateChangelist(Params);
|
|
RunRebuildLightmapsCommandlet(Params);
|
|
SubmitRebuiltMaps();
|
|
}
|
|
catch (Exception ProcessEx)
|
|
{
|
|
Log("********** REBUILD LIGHT MAPS COMMAND FAILED **********");
|
|
Log("Error message: {0}", ProcessEx.Message);
|
|
HandleFailure(ProcessEx.Message);
|
|
throw ProcessEx;
|
|
}
|
|
|
|
// The processes steps have completed successfully.
|
|
HandleSuccess();
|
|
|
|
Log("********** REBUILD LIGHT MAPS COMMAND COMPLETED **********");
|
|
}
|
|
|
|
#endregion
|
|
|
|
// Broken down steps used to run the process.
|
|
#region RebuildLightMaps Process Steps
|
|
|
|
private void BuildNecessaryTargets()
|
|
{
|
|
Log("Running Step:- RebuildLightMaps::BuildNecessaryTargets");
|
|
UE4Build.BuildAgenda Agenda = new UE4Build.BuildAgenda();
|
|
Agenda.AddTarget("UnrealHeaderTool", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development);
|
|
Agenda.AddTarget("ShaderCompileWorker", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development);
|
|
Agenda.AddTarget("UnrealLightmass", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development);
|
|
Agenda.AddTarget(CommandletTargetName, UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development);
|
|
|
|
try
|
|
{
|
|
UE4Build Builder = new UE4Build(this);
|
|
Builder.Build(Agenda, InDeleteBuildProducts: true, InUpdateVersionFiles: true, InForceNoXGE: false, InChangelistNumberOverride: GetLatestCodeChange());
|
|
UE4Build.CheckBuildProducts(Builder.BuildProductFiles);
|
|
}
|
|
catch (AutomationException Ex)
|
|
{
|
|
LogError("Rebuild Light Maps has failed.");
|
|
throw Ex;
|
|
}
|
|
}
|
|
|
|
private int GetLatestCodeChange()
|
|
{
|
|
List<P4Connection.ChangeRecord> ChangeRecords;
|
|
if(!P4.Changes(out ChangeRecords, String.Format("-m 1 //{0}/....cpp@<{1} //{0}/....h@<{1} //{0}/....cs@<{1} //{0}/....usf@<{1}", P4Env.Client, P4Env.Changelist), WithClient: true))
|
|
{
|
|
throw new AutomationException("Couldn't enumerate latest change from branch");
|
|
}
|
|
return ChangeRecords.Max(x => x.CL);
|
|
}
|
|
|
|
private void CreateChangelist(ProjectParams Params)
|
|
{
|
|
Log("Running Step:- RebuildLightMaps::CheckOutMaps");
|
|
// Setup a P4 Cl we will use to submit the new lightmaps
|
|
WorkingCL = P4.CreateChange(P4Env.Client, String.Format("{0} rebuilding lightmaps from changelist {1}\n#rb None\n#tests None", Params.ShortProjectName, P4Env.Changelist));
|
|
Log("Working in {0}", WorkingCL);
|
|
|
|
}
|
|
|
|
private void RunRebuildLightmapsCommandlet(ProjectParams Params)
|
|
{
|
|
Log("Running Step:- RebuildLightMaps::RunRebuildLightmapsCommandlet");
|
|
|
|
// Find the commandlet binary
|
|
string UE4EditorExe = HostPlatform.Current.GetUE4ExePath(Params.UE4Exe);
|
|
if (!FileExists(UE4EditorExe))
|
|
{
|
|
LogError("Missing " + UE4EditorExe + " executable. Needs to be built first.");
|
|
throw new AutomationException("Missing " + UE4EditorExe + " executable. Needs to be built first.");
|
|
}
|
|
|
|
// Now let's rebuild lightmaps for the project
|
|
try
|
|
{
|
|
var CommandletParams = IsBuildMachine ? "-unattended -buildmachine -fileopenlog" : "-fileopenlog";
|
|
CommandletParams += " -AutoCheckOutPackages";
|
|
if (P4Enabled)
|
|
{
|
|
CommandletParams += String.Format(" -SCCProvider={0} -P4Port={1} -P4User={2} -P4Client={3} -P4Changelist={4} -P4Passwd={5}", "Perforce", P4Env.P4Port, P4Env.User, P4Env.Client, WorkingCL.ToString(), P4.GetAuthenticationToken());
|
|
}
|
|
RebuildLightMapsCommandlet(Params.RawProjectPath, Params.UE4Exe, Params.MapsToRebuildLightMaps.ToArray(), CommandletParams);
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
string FinalLogLines = "No log file found";
|
|
AutomationException AEx = Ex as AutomationException;
|
|
if ( AEx != null )
|
|
{
|
|
string LogFile = AEx.LogFileName;
|
|
UnrealBuildTool.Log.TraceWarning("Attempting to load file {0}", LogFile);
|
|
if ( LogFile != "")
|
|
{
|
|
|
|
UnrealBuildTool.Log.TraceWarning("Attempting to read file {0}", LogFile);
|
|
try
|
|
{
|
|
string[] AllLogFile = ReadAllLines(LogFile);
|
|
|
|
FinalLogLines = "Important log entries\n";
|
|
foreach (string LogLine in AllLogFile)
|
|
{
|
|
if (LogLine.Contains("[REPORT]"))
|
|
{
|
|
FinalLogLines += LogLine + "\n";
|
|
}
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
// we don't care about this because if this is hit then there is no log file the exception probably has more info
|
|
LogError("Could not find log file " + LogFile);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Something went wrong with the commandlet. Abandon this run, don't check in any updated files, etc.
|
|
LogError("Rebuild Light Maps has failed. because "+ Ex.ToString());
|
|
throw new AutomationException(ExitCode.Error_Unknown, Ex, "RebuildLightMaps failed. {0}", FinalLogLines);
|
|
}
|
|
}
|
|
|
|
private void SubmitRebuiltMaps()
|
|
{
|
|
Log("Running Step:- RebuildLightMaps::SubmitRebuiltMaps");
|
|
|
|
// Check everything in!
|
|
if (WorkingCL != -1)
|
|
{
|
|
Log("Running Step:- Submitting CL " + WorkingCL);
|
|
int SubmittedCL;
|
|
P4.Submit(WorkingCL, out SubmittedCL, true, true);
|
|
Log("INFO: Lightmaps successfully submitted in cl "+ SubmittedCL.ToString());
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
// Helper functions and procedure steps necessary for running the commandlet successfully
|
|
#region RebuildLightMaps Helper Functions
|
|
|
|
/**
|
|
* Parse the P4 output for any errors that we really care about.
|
|
* e.g. umaps and assets are exclusive checkout files, if we cant check out a map for this reason
|
|
* then we need to stop.
|
|
*/
|
|
private bool FoundCheckOutErrorInP4Output(string Output)
|
|
{
|
|
bool bHadAnError = false;
|
|
|
|
var Lines = Output.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
|
foreach (string Line in Lines)
|
|
{
|
|
// Check for log spew that matches exclusive checkout failure
|
|
// http://answers.perforce.com/articles/KB/3114
|
|
if (Line.Contains("can't edit exclusive file already opened"))
|
|
{
|
|
bHadAnError = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return bHadAnError;
|
|
}
|
|
|
|
/**
|
|
* Cleanup anything this build may leave behind and inform the user
|
|
*/
|
|
private void HandleFailure(String FailureMessage)
|
|
{
|
|
try
|
|
{
|
|
if (WorkingCL != -1)
|
|
{
|
|
P4.RevertAll(WorkingCL);
|
|
P4.DeleteChange(WorkingCL);
|
|
}
|
|
SendCompletionMessage(false, FailureMessage);
|
|
}
|
|
catch (P4Exception P4Ex)
|
|
{
|
|
LogError("Failed to clean up P4 changelist: " + P4Ex.Message);
|
|
}
|
|
catch (Exception SendMailEx)
|
|
{
|
|
LogError("Failed to notify that build succeeded: " + SendMailEx.Message);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Perform any post completion steps needed. I.e. Notify stakeholders etc.
|
|
*/
|
|
private void HandleSuccess()
|
|
{
|
|
try
|
|
{
|
|
SendCompletionMessage(true, "Successfully rebuilt lightmaps.");
|
|
}
|
|
catch (Exception SendMailEx)
|
|
{
|
|
LogError("Failed to notify that build succeeded: " + SendMailEx.Message);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Notify stakeholders of the commandlet results
|
|
*/
|
|
void SendCompletionMessage(bool bWasSuccessful, String MessageBody)
|
|
{
|
|
MailMessage Message = new System.Net.Mail.MailMessage();
|
|
Message.Priority = MailPriority.High;
|
|
Message.From = new MailAddress("unrealbot@epicgames.com");
|
|
|
|
string Branch = "Unknown";
|
|
if ( P4Enabled )
|
|
{
|
|
Branch = P4Env.BuildRootP4;
|
|
}
|
|
|
|
foreach (String NextStakeHolder in StakeholdersEmailAddresses)
|
|
{
|
|
Message.To.Add(new MailAddress(NextStakeHolder));
|
|
}
|
|
|
|
Message.CC.Add(new MailAddress("Daniel.Lamb@epicgames.com"));
|
|
Message.CC.Add(new MailAddress("Andrew.Grant@epicgames.com"));
|
|
Message.Subject = String.Format("Nightly lightmap rebuild {0} for {1}", bWasSuccessful ? "[SUCCESS]" : "[FAILED]", Branch);
|
|
Message.Body = MessageBody;
|
|
/*Attachment Attach = new Attachment();
|
|
Message.Attachments.Add()*/
|
|
try
|
|
{
|
|
SmtpClient MailClient = new SmtpClient("smtp.epicgames.net");
|
|
MailClient.Send(Message);
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
LogError("Failed to send notify email to {0} ({1})", String.Join(", ", StakeholdersEmailAddresses.ToArray()), Ex.Message);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
// Member vars used in multiple steps.
|
|
#region RebuildLightMaps Property Set-up
|
|
|
|
// Users to notify if the process fails or succeeds.
|
|
List<String> StakeholdersEmailAddresses
|
|
{
|
|
get
|
|
{
|
|
String UnprocessedEmailList = ParseParamValue("StakeholdersEmailAddresses");
|
|
if (String.IsNullOrEmpty(UnprocessedEmailList) == false)
|
|
{
|
|
return UnprocessedEmailList.Split('+').ToList();
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
// The Changelist used when doing the work.
|
|
private int WorkingCL = -1;
|
|
|
|
// The target name of the commandlet binary we wish to build and run.
|
|
private String CommandletTargetName
|
|
{
|
|
get
|
|
{
|
|
return ParseParamValue("CommandletTargetName", "");
|
|
}
|
|
}
|
|
|
|
// Process command-line and find a project file. This is necessary for the commandlet to run successfully
|
|
private FileReference ProjectFullPath;
|
|
public virtual FileReference ProjectPath
|
|
{
|
|
get
|
|
{
|
|
if (ProjectFullPath == null)
|
|
{
|
|
var OriginalProjectName = ParseParamValue("project", "");
|
|
var ProjectName = OriginalProjectName;
|
|
ProjectName = ProjectName.Trim(new char[] { '\"' });
|
|
if (ProjectName.IndexOfAny(new char[] { '\\', '/' }) < 0)
|
|
{
|
|
ProjectName = CombinePaths(CmdEnv.LocalRoot, ProjectName, ProjectName + ".uproject");
|
|
}
|
|
else if (!FileExists_NoExceptions(ProjectName))
|
|
{
|
|
ProjectName = CombinePaths(CmdEnv.LocalRoot, ProjectName);
|
|
}
|
|
if (FileExists_NoExceptions(ProjectName))
|
|
{
|
|
ProjectFullPath = new FileReference(ProjectName);
|
|
}
|
|
else
|
|
{
|
|
var Branch = new BranchInfo(new List<UnrealTargetPlatform> { UnrealBuildTool.BuildHostPlatform.Current.Platform });
|
|
var GameProj = Branch.FindGame(OriginalProjectName);
|
|
if (GameProj != null)
|
|
{
|
|
ProjectFullPath = GameProj.FilePath;
|
|
}
|
|
if (!FileExists_NoExceptions(ProjectFullPath.FullName))
|
|
{
|
|
throw new AutomationException("Could not find a project file {0}.", ProjectName);
|
|
}
|
|
}
|
|
}
|
|
return ProjectFullPath;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |