From 2175837f3355db189e8f1f93d3abede8a36911f8 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 19 Dec 2024 13:07:59 +0100 Subject: [PATCH] Add XCode version parsing --- .../Tools/Flax.Build/Platforms/Apple/XCode.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Source/Tools/Flax.Build/Platforms/Apple/XCode.cs b/Source/Tools/Flax.Build/Platforms/Apple/XCode.cs index ef1070191..2a7bd7560 100644 --- a/Source/Tools/Flax.Build/Platforms/Apple/XCode.cs +++ b/Source/Tools/Flax.Build/Platforms/Apple/XCode.cs @@ -32,16 +32,32 @@ namespace Flax.Build.Platforms return; try { + // Get path RootPath = Utilities.ReadProcessOutput("xcode-select", "--print-path"); if (string.IsNullOrEmpty(RootPath) || !Directory.Exists(RootPath)) return; IsValid = true; Version = new Version(1, 0); - Log.Verbose(string.Format("Found XCode at {0}", RootPath)); + + // Get version (optional) + var versionText = Utilities.ReadProcessOutput("xcodebuild", "-version"); + var versionLines = versionText?.Split('\n') ?? null; + if (versionLines != null && versionLines.Length != 0) + { + versionText = versionLines[0].Trim(); + var versionParts = versionText.Split(' '); + if (versionParts != null && versionParts.Length > 1) + { + versionText = versionParts[1].Trim(); + if (Version.TryParse(versionText, out var v)) + Version = v; + } + } } catch { } + Log.Verbose(string.Format("Found XCode {1} at {0}", RootPath, Version)); } } }