diff --git a/.ci/targets/macos_repo_checks.yaml b/.ci/targets/macos_repo_checks.yaml index 95fa5774f69..8a349dec1c7 100644 --- a/.ci/targets/macos_repo_checks.yaml +++ b/.ci/targets/macos_repo_checks.yaml @@ -13,5 +13,5 @@ tasks: always: true - name: validate iOS and macOS podspecs script: .ci/scripts/tool_runner.sh - args: ["podspec-check", "--exclude=script/configs/exclude_xcode_deprecation.yaml"] + args: ["podspec-check"] always: true diff --git a/script/tool/lib/src/podspec_check_command.dart b/script/tool/lib/src/podspec_check_command.dart index 7cbb3108788..e768a5168c5 100644 --- a/script/tool/lib/src/podspec_check_command.dart +++ b/script/tool/lib/src/podspec_check_command.dart @@ -36,7 +36,7 @@ class PodspecCheckCommand extends PackageLoopingCommand { @override final String description = - 'Runs "pod lib lint" on all iOS and macOS plugin podspecs, as well as ' + 'Runs "pod lib lint --quick" on all iOS and macOS plugin podspecs, as well as ' 'making sure the podspecs follow repository standards.\n\n' 'This command requires "pod" and "flutter" to be in your path. Runs on macOS only.'; @@ -111,11 +111,6 @@ class PodspecCheckCommand extends PackageLoopingCommand { } Future> _podspecsToLint(RepositoryPackage package) async { - // Since the pigeon platform tests podspecs require generated files that are not included in git, - // the podspec lint fails. - if (package.path.contains('packages/pigeon/platform_tests/')) { - return []; - } final List podspecs = await getFilesForPackage(package).where((File entity) { final String filename = entity.basename; @@ -130,36 +125,21 @@ class PodspecCheckCommand extends PackageLoopingCommand { } Future _lintPodspec(File podspec) async { - // Do not run the static analyzer on plugins with known analyzer issues. - final String podspecPath = podspec.path; - - final String podspecBasename = podspec.basename; - print('Linting $podspecBasename'); - - // Lint plugin as framework (use_frameworks!). - final ProcessResult frameworkResult = - await _runPodLint(podspecPath, libraryLint: true); - print(frameworkResult.stdout); - print(frameworkResult.stderr); + print('Linting ${podspec.basename}'); - // Lint plugin as library. - final ProcessResult libraryResult = - await _runPodLint(podspecPath, libraryLint: false); - print(libraryResult.stdout); - print(libraryResult.stderr); + final ProcessResult lintResult = await _runPodLint(podspec.path); + print(lintResult.stdout); + print(lintResult.stderr); - return frameworkResult.exitCode == 0 && libraryResult.exitCode == 0; + return lintResult.exitCode == 0; } - Future _runPodLint(String podspecPath, - {required bool libraryLint}) async { + Future _runPodLint(String podspecPath) async { final List arguments = [ 'lib', 'lint', podspecPath, - '--configuration=Debug', // Release targets unsupported arm64 simulators. Use Debug to only build against targeted x86_64 simulator devices. - '--skip-tests', - if (libraryLint) '--use-libraries' + '--quick', ]; print('Running "pod ${arguments.join(' ')}"'); diff --git a/script/tool/test/podspec_check_command_test.dart b/script/tool/test/podspec_check_command_test.dart index 0ba71840dd1..0ff19b76aa8 100644 --- a/script/tool/test/podspec_check_command_test.dart +++ b/script/tool/test/podspec_check_command_test.dart @@ -153,22 +153,7 @@ void main() { .platformDirectory(FlutterPlatform.ios) .childFile('plugin1.podspec') .path, - '--configuration=Debug', - '--skip-tests', - '--use-libraries' - ], - packagesDir.path), - ProcessCall( - 'pod', - [ - 'lib', - 'lint', - plugin - .platformDirectory(FlutterPlatform.ios) - .childFile('plugin1.podspec') - .path, - '--configuration=Debug', - '--skip-tests', + '--quick', ], packagesDir.path), ]), @@ -207,22 +192,7 @@ void main() { .platformDirectory(FlutterPlatform.macos) .childFile('plugin1.podspec') .path, - '--configuration=Debug', - '--skip-tests', - '--use-libraries' - ], - packagesDir.path), - ProcessCall( - 'pod', - [ - 'lib', - 'lint', - plugin - .platformDirectory(FlutterPlatform.macos) - .childFile('plugin1.podspec') - .path, - '--configuration=Debug', - '--skip-tests', + '--quick', ], packagesDir.path), ]), @@ -283,35 +253,6 @@ void main() { )); }); - test('fails if linting as a static library fails', () async { - final RepositoryPackage plugin = createFakePlugin('plugin1', packagesDir); - _writeFakePodspec(plugin, 'ios'); - - // Simulate failure from the second call to `pod`. - processRunner.mockProcessesForExecutable['pod'] = [ - FakeProcessInfo(MockProcess()), - FakeProcessInfo(MockProcess(exitCode: 1)), - ]; - - Error? commandError; - final List output = await runCapturingPrint( - runner, ['podspec-check'], errorHandler: (Error e) { - commandError = e; - }); - - expect(commandError, isA()); - - expect( - output, - containsAllInOrder( - [ - contains('The following packages had errors:'), - contains('plugin1:\n' - ' plugin1.podspec') - ], - )); - }); - test('fails if an iOS Swift plugin is missing the search paths workaround', () async { final RepositoryPackage plugin = createFakePlugin(