Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/BuildGraph/Tasks/SetVersionTask.cs
ben marsh 2c90ac5090 Fix assets created with 4.24.1 builds not being compatible with 4.24.0 release.
CompatibleChangelist number was being overridden as part of the build process due to CL 9823639. The desired effect here was to ensure that Epic's compatible changelist number was cleared out for licensee builds; instead of just forcing it to be set, we clear it out if we're changing the licensee flag.

#jira UE-85874
#rb none

#ROBOMERGE-SOURCE: CL 10727491 in //UE4/Release-4.24/...
#ROBOMERGE-BOT: RELEASE (Release-4.24 -> Main) (v610-10636431)

[CL 10727503 by ben marsh in Main branch]
2019-12-14 10:23:19 -05:00

136 lines
3.9 KiB
C#

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using Tools.DotNETCommon;
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>
/// Whether to set the ENGINE_IS_PROMOTED_BUILD flag to true.
/// </summary>
[TaskParameter(Optional = true)]
public bool Promoted = true;
/// <summary>
/// If set, do not 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>
/// Updates the local version files (Engine/Source/Runtime/Launch/Resources/Version.h, Engine/Build/Build.version, and Engine/Source/Programs/DotNETCommon/Metadata.cs) with the given version information.
/// </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>
public override void Execute(JobContext Job, HashSet<FileReference> BuildProducts, Dictionary<string, HashSet<FileReference>> TagNameToFileSet)
{
// Update the version files
List<FileReference> VersionFiles = UE4Build.StaticUpdateVersionFiles(Parameters.Change, Parameters.CompatibleChange, Parameters.Branch, Parameters.Build, Parameters.Licensee, Parameters.Promoted, !Parameters.SkipWrite);
// 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);
}
/// <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);
}
}
}