Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Scripts/CheckXcodeVersion.cs
Ryan Durand 9ef3748747 Updating copyrights for Engine Programs.
#rnx
#rb none
#jira none

#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869242 in //Fortnite/Release-12.00/... via CL 10869536
#ROBOMERGE-BOT: FORTNITE (Main -> Dev-EngineMerge) (v613-10869866)

[CL 10870955 by Ryan Durand in Main branch]
2019-12-26 23:01:54 -05:00

43 lines
1.2 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace AutomationTool
{
[Help("Checks that the installed Xcode version is the version specified.")]
[Help("-Version", "The expected version number")]
class CheckXcodeVersion : BuildCommand
{
public override void ExecuteBuild()
{
string Version = ParseParamValue("Version");
if(Version == null)
{
throw new AutomationException("Missing -Version=... parameter");
}
IProcessResult Result = Run("xcodebuild", "-version");
if(Result.ExitCode != 0)
{
throw new AutomationException("Unable to query version number from xcodebuild (exit code={0})", Result.ExitCode);
}
Match Match = Regex.Match(Result.Output, "^Xcode ([0-9.]+)", RegexOptions.Multiline);
if(!Match.Success)
{
throw new AutomationException("Missing version number from xcodebuild output:\n{0}", Result.Output);
}
if(Match.Groups[1].Value != Version)
{
LogWarning("Installed Xcode version is {0} - expected {1}", Match.Groups[1].Value, Version);
}
}
}
}