Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Scripts/BuildProjectCommand.Automation.cs
Wes Hunt a94b6477cb Copying //UE4/Dev-Build to //UE4/Main
==========================
MAJOR FEATURES + CHANGES
==========================

Change 2790858 on 2015/12/04 by Ben.Marsh

	Fix ERRORLEVEL not being correctly returned by build.bat, causing failed builds to be treated as succeeded builds when launched from Visual Studio.

	#codereview Wes.Hunt

Change 2792683 on 2015/12/07 by Matthew.Griffin

	Removed some usages of RunningRocket() function

	Checks for whether engine tools need rebuilding should be ignored in all installed engine builds.
	New Intermediate folders should be within project directory and engine's should not be removed when engine installed.

Change 2794194 on 2015/12/08 by Matthew.Griffin

	Removed IsRocket function.
	Changed IsEngineInstalled so that -NotInstalledEngine will always disable installed engine behavior.

Change 2801483 on 2015/12/14 by Matthew.Griffin

	Removed uses of UnrealBuildTool.RunningRocket()

	Mac Tool chain test was down to Engine libraries being pre-compiled
	Allow Third Party dependencies in any monolithic target, not just games
	All installed engine builds should use shared build environment
	Removed test no longer needed now that projects from installed builds have game targets
	Include engine source if it exists in any installed build to improve intellisense in VCProjects

Change 2803276 on 2015/12/15 by Matthew.Griffin

	Removed Rocket switch from ProjectParams as it can always check Automation.RunningRocket()
	Removed bGeneratingRocketProjectFiles from ProjectFileGenerator as it can always check UnrealBuildTool.RunningRocket()
	Changed a few usages to IsEngineInstalled where obvious

Change 2814190 on 2016/01/03 by Ben.Marsh

	Convert ParallelExecutor to managed code, so we can use it trivially from UAT without having to compile with UBT first. Should be moved into UBT at some point.

	Also add a support class for creating managed child processes, which are terminated automatically if the parent process is closed. Currently only implemented on Windows, using P/Invoke. Also allows setting priority level of the process, which could replace the hacky way that we determine the physical processor count in UBT.

Change 2822503 on 2016/01/10 by Wes.Hunt

	AnalyticsET now uses the Data Router protocol.
	* Automatically detects configs that try to use the old endpoint and routes them to the new endpoint. This code is temp until internal games merge the code and have a chance to update their configs.
	* There is a new attribute on BeginSession called "LegacyURL" that is "true" if the code needs to have its configs updated, as well as a LogAnalytics warning.
	* Updated EngineAnalytics and AutomationAnalytics providers to use the new URL and specify any appropriate new, optional config values.
	* Update CrashReporter provider to use new URL and simplified it's provider configuration (now uses AnalyticsET config struct directly).
	Removed recently added GetUE4TypeOverride and moved it to the one place in Engine that needs it.
	#jira UE-21755

#lockdown nick.penwarden

[CL 2822983 by Wes Hunt in Main branch]
2016-01-11 10:12:46 -05:00

170 lines
6.1 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 AutomationTool;
using UnrealBuildTool;
[Flags]
public enum ProjectBuildTargets
{
None = 0,
Editor = 1 << 0,
ClientCooked = 1 << 1,
ServerCooked = 1 << 2,
Bootstrap = 1 << 3,
CrashReporter = 1 << 4,
Programs = 1 << 5,
// All targets
All = Editor | ClientCooked | ServerCooked | Bootstrap | CrashReporter | Programs,
}
/// <summary>
/// Helper command used for compiling.
/// </summary>
/// <remarks>
/// Command line params used by this command:
/// -cooked
/// -cookonthefly
/// -clean
/// -[platform]
/// </remarks>
public partial class Project : CommandUtils
{
#region Build Command
public static void Build(BuildCommand Command, ProjectParams Params, int WorkingCL = -1, ProjectBuildTargets TargetMask = ProjectBuildTargets.All)
{
Params.ValidateAndLog();
if (!Params.Build)
{
return;
}
Log("********** BUILD COMMAND STARTED **********");
var UE4Build = new UE4Build(Command);
var Agenda = new UE4Build.BuildAgenda();
var CrashReportPlatforms = new HashSet<UnrealTargetPlatform>();
// Setup editor targets
if (Params.HasEditorTargets && !Automation.RunningRocket() && (TargetMask & ProjectBuildTargets.Editor) == ProjectBuildTargets.Editor)
{
// @todo Mac: proper platform detection
UnrealTargetPlatform EditorPlatform = HostPlatform.Current.HostEditorPlatform;
const UnrealTargetConfiguration EditorConfiguration = UnrealTargetConfiguration.Development;
CrashReportPlatforms.Add(EditorPlatform);
Agenda.AddTargets(Params.EditorTargets.ToArray(), EditorPlatform, EditorConfiguration, Params.CodeBasedUprojectPath);
if (Params.EditorTargets.Contains("UnrealHeaderTool") == false)
{
Agenda.AddTargets(new string[] { "UnrealHeaderTool" }, EditorPlatform, EditorConfiguration);
}
if (Params.EditorTargets.Contains("ShaderCompileWorker") == false)
{
Agenda.AddTargets(new string[] { "ShaderCompileWorker" }, EditorPlatform, EditorConfiguration);
}
if (Params.Pak && Params.EditorTargets.Contains("UnrealPak") == false)
{
Agenda.AddTargets(new string[] { "UnrealPak" }, EditorPlatform, EditorConfiguration);
}
if (Params.FileServer && Params.EditorTargets.Contains("UnrealFileServer") == false)
{
Agenda.AddTargets(new string[] { "UnrealFileServer" }, EditorPlatform, EditorConfiguration);
}
}
string ScriptPluginArgs = "";
// if we're utilizing an auto-generated code plugin/module (a product of
// the cook process), make sure to compile it along with the targets here
if (Params.RunAssetNativization)
{
// Add every plugin:
foreach( var CodePlugin in Params.BlueprintPluginPaths)
{
ScriptPluginArgs = "-PLUGIN \"" + CodePlugin + "\"";
}
}
// Setup cooked targets
if (Params.HasClientCookedTargets && (TargetMask & ProjectBuildTargets.ClientCooked) == ProjectBuildTargets.ClientCooked)
{
foreach (var BuildConfig in Params.ClientConfigsToBuild)
{
foreach (var ClientPlatform in Params.ClientTargetPlatforms)
{
CrashReportPlatforms.Add(ClientPlatform);
Agenda.AddTargets(Params.ClientCookedTargets.ToArray(), ClientPlatform, BuildConfig, Params.CodeBasedUprojectPath, InAddArgs: ScriptPluginArgs + " -remoteini=\"" + Params.RawProjectPath.Directory.FullName + "\"");
}
}
}
if (Params.HasServerCookedTargets && (TargetMask & ProjectBuildTargets.ServerCooked) == ProjectBuildTargets.ServerCooked)
{
foreach (var BuildConfig in Params.ServerConfigsToBuild)
{
foreach (var ServerPlatform in Params.ServerTargetPlatforms)
{
CrashReportPlatforms.Add(ServerPlatform);
Agenda.AddTargets(Params.ServerCookedTargets.ToArray(), ServerPlatform, BuildConfig, Params.CodeBasedUprojectPath, InAddArgs: ScriptPluginArgs + " -remoteini=\"" + Params.RawProjectPath.Directory.FullName + "\"");
}
}
}
if (!Params.NoBootstrapExe && !Automation.RunningRocket() && (TargetMask & ProjectBuildTargets.Bootstrap) == ProjectBuildTargets.Bootstrap)
{
UnrealBuildTool.UnrealTargetPlatform[] BootstrapPackagedGamePlatforms = { UnrealBuildTool.UnrealTargetPlatform.Win32, UnrealBuildTool.UnrealTargetPlatform.Win64 };
foreach(UnrealBuildTool.UnrealTargetPlatform BootstrapPackagedGamePlatform in BootstrapPackagedGamePlatforms)
{
if(Params.ClientTargetPlatforms.Contains(BootstrapPackagedGamePlatform))
{
Agenda.AddTarget("BootstrapPackagedGame", BootstrapPackagedGamePlatform, UnrealBuildTool.UnrealTargetConfiguration.Shipping);
}
}
}
if (Params.CrashReporter && !Automation.RunningRocket() && (TargetMask & ProjectBuildTargets.CrashReporter) == ProjectBuildTargets.CrashReporter)
{
foreach (var CrashReportPlatform in CrashReportPlatforms)
{
if (UnrealBuildTool.UnrealBuildTool.PlatformSupportsCrashReporter(CrashReportPlatform))
{
Agenda.AddTarget("CrashReportClient", CrashReportPlatform, UnrealTargetConfiguration.Shipping);
}
}
}
if (Params.HasProgramTargets && !Automation.RunningRocket() && (TargetMask & ProjectBuildTargets.Programs) == ProjectBuildTargets.Programs)
{
foreach (var BuildConfig in Params.ClientConfigsToBuild)
{
foreach (var ClientPlatform in Params.ClientTargetPlatforms)
{
Agenda.AddTargets(Params.ProgramTargets.ToArray(), ClientPlatform, BuildConfig, Params.CodeBasedUprojectPath);
}
}
}
UE4Build.Build(Agenda, InDeleteBuildProducts: Params.Clean, InUpdateVersionFiles: WorkingCL > 0);
if (WorkingCL > 0) // only move UAT files if we intend to check in some build products
{
UE4Build.AddUATFilesToBuildProducts();
}
UE4Build.CheckBuildProducts(UE4Build.BuildProductFiles);
if (WorkingCL > 0)
{
// Sign everything we built
CodeSign.SignMultipleIfEXEOrDLL(Command, UE4Build.BuildProductFiles);
// Open files for add or edit
UE4Build.AddBuildProductsToChangelist(WorkingCL, UE4Build.BuildProductFiles);
}
Log("********** BUILD COMMAND COMPLETED **********");
}
#endregion
}