Support Xcode patch version comparison (#61484)
diff --git a/packages/flutter_tools/lib/src/ios/xcodeproj.dart b/packages/flutter_tools/lib/src/ios/xcodeproj.dart index 8b09b35..7d0c532 100644 --- a/packages/flutter_tools/lib/src/ios/xcodeproj.dart +++ b/packages/flutter_tools/lib/src/ios/xcodeproj.dart
@@ -261,13 +261,15 @@ return; } try { - final RunResult result = _processUtils.runSync( - <String>[_executable, '-version'], - ); - if (result.exitCode != 0) { - return; + if (_versionText == null) { + final RunResult result = _processUtils.runSync( + <String>[_executable, '-version'], + ); + if (result.exitCode != 0) { + return; + } + _versionText = result.stdout.trim().replaceAll('\n', ', '); } - _versionText = result.stdout.trim().replaceAll('\n', ', '); final Match match = _versionRegex.firstMatch(versionText); if (match == null) { return; @@ -275,7 +277,8 @@ final String version = match.group(1); final List<String> components = version.split('.'); _majorVersion = int.parse(components[0]); - _minorVersion = components.length == 1 ? 0 : int.parse(components[1]); + _minorVersion = components.length < 2 ? 0 : int.parse(components[1]); + _patchVersion = components.length < 3 ? 0 : int.parse(components[2]); } on ProcessException { // Ignored, leave values null. } @@ -307,6 +310,14 @@ return _minorVersion; } + int _patchVersion; + int get patchVersion { + if (_patchVersion == null) { + _updateVersion(); + } + return _patchVersion; + } + /// Asynchronously retrieve xcode build settings. This one is preferred for /// new call-sites. ///