Files
UnrealEngineUWP/Engine/Source/Programs/UnrealBuildTool/System/ProjectDescriptor.cs
Ben Marsh 40f391e11e Copying //UE4/Dev-Build to //UE4/Main
==========================
MAJOR FEATURES + CHANGES
==========================

Change 2857832 on 2016/02/05 by Ben.Marsh

	GitHub #1959 - Prevent UELinkerFixups file from using shared PCHs; it doesn't necessarily have the right compile environment to be able to use them.

Change 2858189 on 2016/02/06 by Ben.Marsh

	Allow runtime dependencies to be optional, so we can allow games to be staged without requiring PhysX/Apex PDBs.

Change 2858968 on 2016/02/08 by Ben.Marsh

	Allow plugins to be enabled/disabled depending on different target types. Contributed by Ben Everett/Hi-Rez Studios.

Change 2859325 on 2016/02/08 by Ben.Marsh

	Stop adding a debug output device if it goes to the same place as the regular log output device. Prevent output messages printing to the log twice on Mac.

	#codereview Michael.Trepka

Change 2859995 on 2016/02/09 by Matthew.Griffin

	Changed UnrealFileServer to be non-monolithic so that it doesn't include code that is not public

Change 2860393 on 2016/02/09 by Ben.Marsh

	Add support for pre and post build steps for projects and plugin files. Steps are specified as a list of shell commands per-target platform, and are written to a shell script by UBT. Whenever the target is built, the pre-build steps are executed before UHT, and post-build steps are executed at the end.

	The following target properties are expanded with UBT properties in the commands: $(EngineDir), $(ProjectDir), $(TargetName), $(TargetPlatform), $(TargetConfiguration), $(TargetType), $(ProjectFile), $(PluginDir).

	Example JSON fragment:

		"PreBuildSteps": {
			"Win64": [
				"echo EngineDir=$(EngineDir)",
				"echo ProjectDir=$(ProjectDir)",
				"echo TargetName=$(TargetName)",
				"echo TargetPlatform=$(TargetPlatform)",
				"echo TargetConfiguration=$(TargetConfiguration)",
				"echo TargetType=$(TargetType)",
				"echo ProjectFile=$(ProjectFile)",
				"echo PluginDir=$(PluginDir)"
			]
		},

Change 2860504 on 2016/02/09 by Ben.Marsh

	Remove nodes from the grid view that we don't have any data for.

Change 2860592 on 2016/02/09 by Ben.Marsh

	Add script to copy all UAT/UBT build products to another directory. To be used to avoid compiling multiple times on build system.

Change 2861087 on 2016/02/09 by Ben.Marsh

	Allow UAT binaries compiled on the initial agent to be copied to all other agents in a build. Saves a lot of startup time on Mac, in particular.

Change 2861788 on 2016/02/10 by Ben.Marsh

	Fix warnings and mangled notification email if triggers finish before all their jobsteps have been created.

#lockdown Nick.Penwarden

[CL 2863732 by Ben Marsh in Main branch]
2016-02-11 15:36:17 -05:00

128 lines
4.1 KiB
C#

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UnrealBuildTool
{
enum ProjectDescriptorVersion
{
Invalid = 0,
Initial = 1,
NameHash = 2,
ProjectPluginUnification = 3,
// !!!!!!!!!! IMPORTANT: Remember to also update LatestPluginDescriptorFileVersion in Plugins.cs (and Plugin system documentation) when this changes!!!!!!!!!!!
// -----<new versions can be added before this line>-------------------------------------------------
// - this needs to be the last line (see note below)
LatestPlusOne,
Latest = LatestPlusOne - 1
}
public class ProjectDescriptor
{
// Descriptor version number. */
public int FileVersion;
// The engine to open this project with.
public string EngineAssociation;
// Category to show under the project browser
public string Category;
// Description to show in the project browser
public string Description;
// List of all modules associated with this project
public ModuleDescriptor[] Modules;
// List of plugins for this project (may be enabled/disabled)
public PluginReferenceDescriptor[] Plugins;
// Array of platforms that this project is targeting
public string[] TargetPlatforms;
// A hash that is used to determine if the project was forked from a sample
public uint EpicSampleNameHash;
// Steps to execute before building targets in this project
public CustomBuildSteps PreBuildSteps;
// Steps to execute before building targets in this project
public CustomBuildSteps PostBuildSteps;
/// <summary>
/// Constructor.
/// </summary>
public ProjectDescriptor()
{
FileVersion = (int)ProjectDescriptorVersion.Latest;
}
/// <summary>
/// Creates a plugin descriptor from a file on disk
/// </summary>
/// <param name="FileName">The filename to read</param>
/// <returns>New plugin descriptor</returns>
public static ProjectDescriptor FromFile(string FileName)
{
JsonObject RawObject = JsonObject.Read(FileName);
try
{
ProjectDescriptor Descriptor = new ProjectDescriptor();
// Read the version
if (!RawObject.TryGetIntegerField("FileVersion", out Descriptor.FileVersion))
{
if (!RawObject.TryGetIntegerField("ProjectFileVersion", out Descriptor.FileVersion))
{
throw new BuildException("Project descriptor '{0}' does not contain a valid FileVersion entry", FileName);
}
}
// Check it's not newer than the latest version we can parse
if (Descriptor.FileVersion > (int)PluginDescriptorVersion.Latest)
{
throw new BuildException("Project descriptor '{0}' appears to be in a newer version ({1}) of the file format that we can load (max version: {2}).", FileName, Descriptor.FileVersion, (int)ProjectDescriptorVersion.Latest);
}
// Read simple fields
RawObject.TryGetStringField("EngineAssociation", out Descriptor.EngineAssociation);
RawObject.TryGetStringField("Category", out Descriptor.Category);
RawObject.TryGetStringField("Description", out Descriptor.Description);
// Read the modules
JsonObject[] ModulesArray;
if (RawObject.TryGetObjectArrayField("Modules", out ModulesArray))
{
Descriptor.Modules = Array.ConvertAll(ModulesArray, x => ModuleDescriptor.FromJsonObject(x));
}
// Read the plugins
JsonObject[] PluginsArray;
if (RawObject.TryGetObjectArrayField("Plugins", out PluginsArray))
{
Descriptor.Plugins = Array.ConvertAll(PluginsArray, x => PluginReferenceDescriptor.FromJsonObject(x));
}
// Read the target platforms
RawObject.TryGetStringArrayField("TargetPlatforms", out Descriptor.TargetPlatforms);
// Get the sample name hash
RawObject.TryGetUnsignedIntegerField("EpicSampleNameHash", out Descriptor.EpicSampleNameHash);
// Read the pre and post-build steps
CustomBuildSteps.TryRead(RawObject, "PreBuildSteps", out Descriptor.PreBuildSteps);
CustomBuildSteps.TryRead(RawObject, "PostBuildSteps", out Descriptor.PostBuildSteps);
return Descriptor;
}
catch (JsonParseException ParseException)
{
throw new JsonParseException("{0} (in {1})", ParseException.Message, FileName);
}
}
}
}