Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/BuildGraph/Tasks/SetVersionTask.cs
Ben Marsh 28be3c41b4 Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3075869)
#lockdown Nick.Penwarden
#rb none

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

Change 3059740 on 2016/07/21 by Ben.Marsh

	Format license violations on separate lines rather than as a single multi-line string, so they can be parsed out correctly by the EC log parser.

Change 3063115 on 2016/07/25 by Ben.Marsh

	Add missing projects to Mono AutomationTool solution.

Change 3067125 on 2016/07/27 by Ben.Marsh

	Clean up and document the engine versioning system.

	* Version.h has a summary of all the different versioning concepts in UE4, as well as an explanation of what all the macros do.
	* VersionLocked.h has been removed. ENGINE_NET_VERSION and ENGINE_REPLAY_VERSION can be overriden directly in Version.h if necessary.
	* Added explicit macros for ENGINE_CURRENT_CL_VERSION And ENGINE_COMPATIBLE_CL_VERSION. The MODULE_API_VERSION macro is now defined to be the same as ENGINE_COMPATIBLE_CL_VERSION.
	* Build/Build.version now includes the compatible CL version, so it can be determined without having to parse header files inside MacToolChain.cs.
	* UpdateLocalVersion UAT command now exposes a -CompatibleCL=... argument to update ENGINE_COMPATIBLE_CL_VERSION and the CompatibleChange property in Build.version.
	* SetVersion BuildGraph task now has a CompatibleChange="" attribute to update ENGINE_COMPATIBLE_CL_VERSION and the CompatibleChange property in Build.version.
	* VersionFileUpdater now makes an effort to parse tokens matching the macros it's going to overwrite, rather than requiring exact matches in whitespace in Version.h.
	* Running UpdateLocalVersion now syncs files to revision 0 before writing if P4 is enabled, similarly to UGS, or fails if they are not writable.

Change 3067242 on 2016/07/27 by Ben.Marsh

	Fix UGS showing a build failure/warning dialog immediately if you submit while the build is yellow/red. Now ignores builds before your last submitted CL.

Change 3068116 on 2016/07/28 by Ben.Marsh

	Add a small Windows utility to terminate all running processes under a given root directory, and run it before and after every sync. Mean to fix instances where zombie editor processes do not terminate correctly and cause subsequent syncs to fail.

Change 3068246 on 2016/07/28 by Ben.Marsh

	UGS: Improvements to 'Clean Workspace' dialog - empty folders are now set to be deleted by default, and added a context menu to select all/none/empty/default for a subtree, as well as to open Windows explorer at that location.

Change 3068573 on 2016/07/28 by Ben.Marsh

	Attempt to fix AppDomain unload errors; suspect caused by delay to terminate child processes when managed exception is thrown on child threads. Now waits for the currently running threads to finish executing before quitting.

Change 3068575 on 2016/07/28 by Ben.Marsh

	Respect the -noxge command-line argument when compiling UHT.

Change 3068665 on 2016/07/28 by Ben.Marsh

	Delete any DLLs in output folders which share names with build products. The Windows loader reads DLLs from the first location it finds a file with a matching name, so we need to ensure that it doesn't load stale DLLs when output directories are changed (moving a module into a plugin, for example).

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

	CoreUObject: Replace header guards with #pragma once directives.

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

	CoreUObject: Manually untangle a few circular includes around ObjectBase.h and Class.h to allow making them into IWYU-style headers.

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

	GitHub #2646: Always allow programs to build as part of non-game solution configurations.

Change 3075123 on 2016/08/03 by Richard.Fawcett

	Ensure that zip files created outside of Ionic Zip can be unzipped with CommandUtils.UnzipFiles

	Zip files created with 7-zip, WinRAR, and Windows Explorer all contain entities for directories, not just the files in them.  Code in CommandUtils.UnzipFiles made the assumption that all entities in the zip file were files, and an exception was being thrown on encountering a directory.

Change 3075848 on 2016/08/03 by Ben.Marsh

	UBT: Fix a few cases where it's possible to construct a non-canonical DirectoryReference - root directories on Windows must always have a terminating slash, but any other directories must note. DirectoryInfo and Path.GetFullPath() do not enforce this requirement.

Change 3075850 on 2016/08/03 by Ben.Marsh

	UBT: Fix UHT failures when running with -nopch.

Change 3077058 by Ben.Marsh

	UHT: Remove the auto-generated ObjectBase.h include from generated header files. Was originally added to allow doxygen to parse headers more easily, but was switched to parsing the file only as part of parent files instead.

[CL 3077308 by Ben Marsh in Main branch]
2016-08-04 10:41:07 -04:00

130 lines
3.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using UnrealBuildTool;
namespace AutomationTool.Tasks
{
/// <summary>
/// Parameters for the version task
/// </summary>
public class SetVersionTaskParameters
{
/// <summary>
/// The changelist to set in the version files
/// </summary>
[TaskParameter]
public int Change;
/// <summary>
/// The engine compatible changelist to set in the version files
/// </summary>
[TaskParameter(Optional = true)]
public int CompatibleChange;
/// <summary>
/// The branch string
/// </summary>
[TaskParameter]
public string Branch;
/// <summary>
/// The build version string
/// </summary>
[TaskParameter(Optional = true)]
public string Build;
/// <summary>
/// Whether to set the IS_LICENSEE_VERSION flag to true
/// </summary>
[TaskParameter(Optional = true)]
public bool Licensee;
/// <summary>
/// If set, don't actually write to the files - just return the version files that would be updated. Useful for local builds.
/// </summary>
[TaskParameter(Optional = true)]
public bool SkipWrite;
/// <summary>
/// Tag to be applied to build products of this task
/// </summary>
[TaskParameter(Optional = true, ValidationType = TaskParameterValidationType.TagList)]
public string Tag;
}
/// <summary>
/// Task which updates the version files in the current branch
/// </summary>
[TaskElement("SetVersion", typeof(SetVersionTaskParameters))]
public class SetVersionTask : CustomTask
{
/// <summary>
/// Parameters for the task
/// </summary>
SetVersionTaskParameters Parameters;
/// <summary>
/// Construct a version task
/// </summary>
/// <param name="InParameters">Parameters for this task</param>
public SetVersionTask(SetVersionTaskParameters InParameters)
{
Parameters = InParameters;
}
/// <summary>
/// Execute the task.
/// </summary>
/// <param name="Job">Information about the current job</param>
/// <param name="BuildProducts">Set of build products produced by this node.</param>
/// <param name="TagNameToFileSet">Mapping from tag names to the set of files they include</param>
/// <returns>True if the task succeeded</returns>
public override bool Execute(JobContext Job, HashSet<FileReference> BuildProducts, Dictionary<string, HashSet<FileReference>> TagNameToFileSet)
{
// Update the version files
List<string> FileNames = UE4Build.StaticUpdateVersionFiles(Parameters.Change, Parameters.CompatibleChange, Parameters.Branch, Parameters.Build, Parameters.Licensee, !Parameters.SkipWrite);
List<FileReference> VersionFiles = FileNames.Select(x => new FileReference(x)).ToList();
// Apply the optional tag to them
foreach(string TagName in FindTagNamesFromList(Parameters.Tag))
{
FindOrAddTagSet(TagNameToFileSet, TagName).UnionWith(VersionFiles);
}
// Add them to the list of build products
BuildProducts.UnionWith(VersionFiles);
return true;
}
/// <summary>
/// Output this task out to an XML writer.
/// </summary>
public override void Write(XmlWriter Writer)
{
Write(Writer, Parameters);
}
/// <summary>
/// Find all the tags which are used as inputs to this task
/// </summary>
/// <returns>The tag names which are read by this task</returns>
public override IEnumerable<string> FindConsumedTagNames()
{
yield break;
}
/// <summary>
/// Find all the tags which are modified by this task
/// </summary>
/// <returns>The tag names which are modified by this task</returns>
public override IEnumerable<string> FindProducedTagNames()
{
return FindTagNamesFromList(Parameters.Tag);
}
}
}