diff --git a/packages/flutter_tools/lib/src/macos/cocoapods.dart b/packages/flutter_tools/lib/src/macos/cocoapods.dart index db7cc7da69b..5a78d0bd096 100644 --- a/packages/flutter_tools/lib/src/macos/cocoapods.dart +++ b/packages/flutter_tools/lib/src/macos/cocoapods.dart @@ -162,6 +162,7 @@ class CocoaPods { if (!xcodeProject.podfile.existsSync()) { throwToolExit('Podfile missing'); } + _warnIfPodfileOutOfDate(xcodeProject); bool podsProcessed = false; if (_shouldRunPodInstall(xcodeProject, dependenciesChanged)) { if (!await _checkPodCondition()) { @@ -170,7 +171,6 @@ class CocoaPods { await _runPodInstall(xcodeProject, buildMode); podsProcessed = true; } - _warnIfPodfileOutOfDate(xcodeProject); return podsProcessed; } diff --git a/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart b/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart index 22b9e3da5c5..5b3fda7c68a 100644 --- a/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart +++ b/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart @@ -20,6 +20,7 @@ import 'package:test/fake.dart'; import '../../src/common.dart'; import '../../src/context.dart'; +import '../../src/fake_process_manager.dart'; typedef InvokeProcess = Future Function(); @@ -322,6 +323,7 @@ void main() { buildMode: BuildMode.debug, ), throwsToolExit(message: 'CocoaPods not installed or not in valid state')); expect(fakeProcessManager.hasRemainingExpectations, isFalse); + expect(fakeProcessManager, hasNoRemainingExpectations); }); testWithoutContext('throwsToolExit if CocoaPods install is broken', () async { @@ -332,17 +334,10 @@ void main() { buildMode: BuildMode.debug, ), throwsToolExit(message: 'CocoaPods not installed or not in valid state')); expect(fakeProcessManager.hasRemainingExpectations, isFalse); + expect(fakeProcessManager, hasNoRemainingExpectations); }); testWithoutContext('exits if Podfile creates the Flutter engine symlink', () async { - pretendPodIsInstalled(); - pretendPodVersionIs('1.10.0'); - fakeProcessManager.addCommand( - const FakeCommand( - command: ['pod', 'install', '--verbose'], - ), - ); - fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile')) ..createSync() ..writeAsStringSync('Existing Podfile'); @@ -355,17 +350,10 @@ void main() { xcodeProject: projectUnderTest.ios, buildMode: BuildMode.debug, ), throwsToolExit(message: 'Podfile is out of date')); + expect(fakeProcessManager, hasNoRemainingExpectations); }); testWithoutContext('exits if iOS Podfile parses .flutter-plugins', () async { - pretendPodIsInstalled(); - pretendPodVersionIs('1.10.0'); - fakeProcessManager.addCommand( - const FakeCommand( - command: ['pod', 'install', '--verbose'], - ), - ); - fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile')) ..createSync() ..writeAsStringSync('plugin_pods = parse_KV_file(\'../.flutter-plugins\')'); @@ -374,6 +362,7 @@ void main() { xcodeProject: projectUnderTest.ios, buildMode: BuildMode.debug, ), throwsToolExit(message: 'Podfile is out of date')); + expect(fakeProcessManager, hasNoRemainingExpectations); }); testWithoutContext('prints warning if macOS Podfile parses .flutter-plugins', () async { @@ -396,6 +385,7 @@ void main() { expect(logger.errorText, contains('Warning: Podfile is out of date')); expect(logger.errorText, contains('rm macos/Podfile')); + expect(fakeProcessManager, hasNoRemainingExpectations); }); testWithoutContext('throws, if Podfile is missing.', () async {