Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Scripts/CheckXcodeVersion.cs
Marc Audy af90b7bcd4 Copying //UE4/Fortnite-Staging to Dev-Main (//UE4/Dev-Main) @ 4395008
#rb
#rnx
#lockdown Nick.Penwarden

[CL 4395058 by Marc Audy in Main branch]
2018-09-25 10:11:35 -04:00

41 lines
1.1 KiB
C#

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);
}
}
}
}