Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Scripts/BuildCommonTools.Automation.cs
Ben Marsh 70f47fef98 Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 2959429)
==========================
MAJOR FEATURES + CHANGES
==========================

Change 2945275 on 2016/04/15 by Ben.Marsh

	BuildCommonTools: Stop forcing the DeleteBuildProducts flag to true; just respect the -Clean parameter from the command line.

Change 2946668 on 2016/04/18 by Ben.Marsh

	EC: Prevent lookbehind for UBT error strings on Mac.

Change 2952657 on 2016/04/22 by Ben.Marsh

	UGS: Require the user to explicitly choose to show *.uprojectdirs files, to discourage people from selecting the first thing they see in a synced branch. The uprojectdirs workflow is only used by Engine QA, but catches a lot of people out.

Change 2954256 on 2016/04/25 by Ben.Marsh

	EC: Fix lines starting with error: and warning: being swallowed by the postprocessor. Also remove confusing 4 line look-behind on generic error and warning messages.

Change 2954449 on 2016/04/25 by Ben.Marsh

	Use the original application name for log files (and for the prefix in stdout), rather than the application name after the host platform has modified it. Prevents UAT/UBT calls showing up with a "mono: " prefix on Mac, rather than "AutomationTool:" or "UnrealBuildTool:".

Change 2955885 on 2016/04/26 by Ben.Marsh

	BuildGraph: Allow passing -Clean on the command line to propagate to UE4Build, impacting how targets are compiled as well as clearing the cached BuildGraph state. Add a second parameter, -ClearHistory, to just wipe the history of completed nodes.

Change 2955919 on 2016/04/26 by Chad.Garyet

	Fixed timestamp resolution to check for two seconds instead of two ticks.  This was causing mac builders to throw false positives on file changes

Change 2956118 on 2016/04/26 by Ben.Marsh

	BuildGraph: Add support for conditional blocks in BuildGraph scripts, either with a simple condition, or picking from a list of options. Two new elements can be added anywhere in scripts:

	<Do If="...">
	    <!-- Inner elements -->
	</Do>

	<Choose>
	    <Option If="...">
	        <!-- Inner elements -->
	    </Option>
	    <Option If="...">
	        <!-- Inner elements -->
	    </Option>
	    <Otherwise>
	        <!-- Inner elements -->
	    </Otherwise>
	</Choose>

Change 2956792 on 2016/04/26 by Ben.Marsh

	EC: Prevent scheduled builds being queued up, and starting at times other than the times they're scheduled for. Prevents builds which have just been added to the stream settings from starting immediately, and prevents full builds starting during the day (as soon as the first change is made).

Change 2957131 on 2016/04/26 by Ben.Marsh

	EC: Increase the precedence of the stack trace matcher.

Change 2957419 on 2016/04/27 by Ben.Marsh

	EC: Skip the "end: stack for UAT" line in postp.

Change 2957588 on 2016/04/27 by Ben.Marsh

	Core: Change formatting for callstacks for crashes and ensures so that EC can parse them from logs more easily.

Change 2958047 on 2016/04/27 by Ben.Marsh

	BuildGraph: Feature to generate reports as part of build graph scripts. Reports operate similarly to triggers, but just provide a summary of completed jobsteps without offering to run a downstream job. Syntax is similar to declaring aggregates: <Report Name="Summary" Requires="Node1;Node2"/>

Change 2958188 on 2016/04/27 by Ben.Marsh

	BuildGraph: Automatically generate a report when a preflight completes.

Change 2959053 on 2016/04/28 by Ben.Marsh

	BuildGraph: Move the CleanTempStorage commandlet into BuildGraph, and add support for cleaning out new-style temp storage directories (which do not contain TempManifest files).

Change 2959429 on 2016/04/28 by Ben.Marsh

	UAT: Add a script to describe a stream being copied up to its parent. To use, just run the UAT command "StreamCopyDescription -Stream=//UE4/Dev-Build". Optionally specify -Changes=//UE4/OtherStream/Engine/...

#lockdown Nick.Penwarden

[CL 2959583 by Ben Marsh in Main branch]
2016-04-28 14:13:21 -04:00

193 lines
9.4 KiB
C#

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutomationTool;
using UnrealBuildTool;
[Help("Builds common tools used by the engine which are not part of typical editor or game builds. Useful when syncing source-only on GitHub.")]
[Help("platforms=<X>+<Y>+...", "Specifies on or more platforms to build for (defaults to the current host platform)")]
[Help("manifest=<Path>", "Writes a manifest of all the build products to the given path")]
public class BuildCommonTools : BuildCommand
{
public override void ExecuteBuild()
{
Log("************************* BuildCommonTools");
// Get the list of platform names
string[] PlatformNames = ParseParamValue("platforms", BuildHostPlatform.Current.Platform.ToString()).Split('+');
// Parse the platforms
List<UnrealBuildTool.UnrealTargetPlatform> Platforms = new List<UnrealTargetPlatform>();
foreach(string PlatformName in PlatformNames)
{
UnrealBuildTool.UnrealTargetPlatform Platform;
if(!UnrealBuildTool.UnrealTargetPlatform.TryParse(PlatformName, true, out Platform))
{
throw new AutomationException("Unknown platform specified on command line - '{0}' - valid platforms are {1}", PlatformName, String.Join("/", Enum.GetNames(typeof(UnrealBuildTool.UnrealTargetPlatform))));
}
Platforms.Add(Platform);
}
// Add all the platforms if specified
if(ParseParam("allplatforms"))
{
foreach(UnrealTargetPlatform Platform in Enum.GetValues(typeof(UnrealTargetPlatform)))
{
if(!Platforms.Contains(Platform))
{
Platforms.Add(Platform);
}
}
}
// Get the agenda
List<string> ExtraBuildProducts = new List<string>();
UE4Build.BuildAgenda Agenda = MakeAgenda(Platforms.ToArray(), ExtraBuildProducts);
// Build everything. We don't want to touch version files for GitHub builds -- these are "programmer builds" and won't have a canonical build version
UE4Build Builder = new UE4Build(this);
Builder.Build(Agenda, InUpdateVersionFiles: false);
// Add UAT and UBT to the build products
Builder.AddUATFilesToBuildProducts();
Builder.AddUBTFilesToBuildProducts();
// Add all the extra build products
foreach(string ExtraBuildProduct in ExtraBuildProducts)
{
Builder.AddBuildProduct(ExtraBuildProduct);
}
// Make sure all the build products exist
UE4Build.CheckBuildProducts(Builder.BuildProductFiles);
// Write the manifest if needed
string ManifestPath = ParseParamValue("manifest");
if(ManifestPath != null)
{
SortedSet<string> Files = new SortedSet<string>();
foreach(string BuildProductFile in Builder.BuildProductFiles)
{
Files.Add(BuildProductFile);
}
File.WriteAllLines(ManifestPath, Files.ToArray());
}
}
public static UE4Build.BuildAgenda MakeAgenda(UnrealBuildTool.UnrealTargetPlatform[] Platforms, List<string> ExtraBuildProducts)
{
// Create the build agenda
UE4Build.BuildAgenda Agenda = new UE4Build.BuildAgenda();
// C# binaries
Agenda.SwarmProject = @"Engine\Source\Programs\UnrealSwarm\UnrealSwarm.sln";
Agenda.DotNetProjects.Add(@"Engine/Source/Editor/SwarmInterface/DotNET/SwarmInterface.csproj");
Agenda.DotNetProjects.Add(@"Engine/Source/Programs/DotNETCommon/DotNETUtilities/DotNETUtilities.csproj");
Agenda.DotNetProjects.Add(@"Engine/Source/Programs/RPCUtility/RPCUtility.csproj");
Agenda.DotNetProjects.Add(@"Engine/Source/Programs/UnrealControls/UnrealControls.csproj");
// Windows binaries
if(Platforms.Contains(UnrealBuildTool.UnrealTargetPlatform.Win64))
{
Agenda.AddTarget("CrashReportClient", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development);
Agenda.AddTarget("CrashReportClient", UnrealBuildTool.UnrealTargetPlatform.Win32, UnrealBuildTool.UnrealTargetConfiguration.Development);
Agenda.AddTarget("UnrealHeaderTool", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development);
Agenda.AddTarget("UnrealPak", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development);
Agenda.AddTarget("UnrealLightmass", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development);
Agenda.AddTarget("ShaderCompileWorker", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development);
Agenda.AddTarget("UnrealVersionSelector", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Shipping);
Agenda.AddTarget("BootstrapPackagedGame", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Shipping);
Agenda.AddTarget("BootstrapPackagedGame", UnrealBuildTool.UnrealTargetPlatform.Win32, UnrealBuildTool.UnrealTargetConfiguration.Shipping);
Agenda.AddTarget("UnrealCEFSubProcess", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development);
Agenda.AddTarget("UnrealCEFSubProcess", UnrealBuildTool.UnrealTargetPlatform.Win32, UnrealBuildTool.UnrealTargetConfiguration.Development);
}
// Mac binaries
if(Platforms.Contains(UnrealBuildTool.UnrealTargetPlatform.Mac))
{
Agenda.AddTarget("CrashReportClient", UnrealBuildTool.UnrealTargetPlatform.Mac, UnrealBuildTool.UnrealTargetConfiguration.Development, InAddArgs: "-CopyAppBundleBackToDevice");
Agenda.AddTarget("UnrealPak", UnrealBuildTool.UnrealTargetPlatform.Mac, UnrealBuildTool.UnrealTargetConfiguration.Development, InAddArgs: "-CopyAppBundleBackToDevice");
Agenda.AddTarget("UnrealLightmass", UnrealBuildTool.UnrealTargetPlatform.Mac, UnrealBuildTool.UnrealTargetConfiguration.Development, InAddArgs: "-CopyAppBundleBackToDevice");
Agenda.AddTarget("ShaderCompileWorker", UnrealBuildTool.UnrealTargetPlatform.Mac, UnrealBuildTool.UnrealTargetConfiguration.Development, InAddArgs: "-CopyAppBundleBackToDevice");
Agenda.AddTarget("UE4EditorServices", UnrealBuildTool.UnrealTargetPlatform.Mac, UnrealBuildTool.UnrealTargetConfiguration.Development, InAddArgs: "-CopyAppBundleBackToDevice");
Agenda.AddTarget("UnrealCEFSubProcess", UnrealBuildTool.UnrealTargetPlatform.Mac, UnrealBuildTool.UnrealTargetConfiguration.Development, InAddArgs: "-CopyAppBundleBackToDevice");
}
// Linux binaries
if (Platforms.Contains(UnrealBuildTool.UnrealTargetPlatform.Linux))
{
Agenda.AddTarget("CrashReportClient", UnrealBuildTool.UnrealTargetPlatform.Linux, UnrealBuildTool.UnrealTargetConfiguration.Development);
}
// iOS binaries
if(Platforms.Contains(UnrealBuildTool.UnrealTargetPlatform.IOS))
{
Agenda.DotNetProjects.Add(@"Engine/Source/Programs/iOS/iPhonePackager/iPhonePackager.csproj");
ExtraBuildProducts.Add(CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, @"Engine/Binaries/DotNET/iOS/iPhonePackager.exe"));
Agenda.DotNetProjects.Add(@"Engine/Source/Programs/iOS/DeploymentServer/DeploymentServer.csproj");
ExtraBuildProducts.Add(CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, @"Engine/Binaries/DotNET/iOS/DeploymentServer.exe"));
Agenda.DotNetProjects.Add(@"Engine/Source/Programs/iOS/DeploymentInterface/DeploymentInterface.csproj");
ExtraBuildProducts.Add(CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, @"Engine/Binaries/DotNET/iOS/DeploymentInterface.dll"));
Agenda.DotNetProjects.Add(@"Engine/Source/Programs/iOS/MobileDeviceInterface/MobileDeviceInterface.csproj");
ExtraBuildProducts.Add(CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, @"Engine/Binaries/DotNET/iOS/MobileDeviceInterface.dll"));
}
// PS4 binaries
if(Platforms.Contains(UnrealBuildTool.UnrealTargetPlatform.PS4))
{
Agenda.AddTarget("PS4MapFileUtil", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development);
Agenda.DotNetProjects.Add(CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, @"Engine/Source/Programs/PS4/PS4DevKitUtil/PS4DevKitUtil.csproj"));
ExtraBuildProducts.Add(CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, @"Engine/Binaries/DotNET/PS4/PS4DevKitUtil.exe"));
}
// Xbox One binaries
if(Platforms.Contains(UnrealBuildTool.UnrealTargetPlatform.XboxOne))
{
Agenda.AddTarget("XboxOnePDBFileUtil", UnrealBuildTool.UnrealTargetPlatform.Win64, UnrealBuildTool.UnrealTargetConfiguration.Development);
}
// HTML5 binaries
if (Platforms.Contains(UnrealBuildTool.UnrealTargetPlatform.HTML5))
{
Agenda.DotNetProjects.Add(@"Engine/Source/Programs/HTML5/HTML5LaunchHelper/HTML5LaunchHelper.csproj");
ExtraBuildProducts.Add(CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, @"Engine/Binaries/DotNET/HTML5LaunchHelper.exe"));
}
return Agenda;
}
}
public class ZipProjectUp : BuildCommand
{
public override void ExecuteBuild()
{
// Get Directories
string ProjectDirectory = ParseParamValue("project", "");
string InstallDirectory = ParseParamValue("install", "");
ProjectDirectory = Path.GetDirectoryName(ProjectDirectory);
Log("Started zipping project up");
Log("Project directory: {0}", ProjectDirectory);
Log("Install directory: {0}", InstallDirectory);
Log("Packaging up the project...");
// Setup filters
FileFilter Filter = new FileFilter();
Filter.Include("/Config/...");
Filter.Include("/Content/...");
Filter.Include("/Source/...");
Filter.Include("*.uproject");
ZipFiles(InstallDirectory, ProjectDirectory, Filter);
Log("Completed zipping project up");
}
}