From 0ff5189fb5eea29d6ddefe969961bfb1ab7c3aa4 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Thu, 20 Nov 2025 16:15:30 -0500 Subject: [PATCH 1/2] [tool] Remove code analysis from podspec-check Replaces the full build-and-analyze version of `pod lib lint` with the `--quick` version. This means that this step no longer does native code analysis (which `analyze` covers), so it no longer needs an exclusion list for packages with warnings. As a result of this change, flutter/packages no longer has a dependency on the version of Flutter that was published to CocoaPods to facilitate podspec testing. Fixes https://github.com/flutter/flutter/issues/178806 --- .ci/targets/macos_repo_checks.yaml | 2 +- .../tool/lib/src/podspec_check_command.dart | 31 +++------ .../tool/test/podspec_check_command_test.dart | 63 +------------------ 3 files changed, 11 insertions(+), 85 deletions(-) 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..c126792743b 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; @@ -137,29 +132,19 @@ class PodspecCheckCommand extends PackageLoopingCommand { print('Linting $podspecBasename'); // Lint plugin as framework (use_frameworks!). - final ProcessResult frameworkResult = - await _runPodLint(podspecPath, libraryLint: true); - print(frameworkResult.stdout); - print(frameworkResult.stderr); - - // Lint plugin as library. - final ProcessResult libraryResult = - await _runPodLint(podspecPath, libraryLint: false); - print(libraryResult.stdout); - print(libraryResult.stderr); - - return frameworkResult.exitCode == 0 && libraryResult.exitCode == 0; + final ProcessResult lintResult = await _runPodLint(podspecPath); + print(lintResult.stdout); + print(lintResult.stderr); + + 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( From 42ccb60d7b45254e6158391e01d825f68d52eb94 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Thu, 20 Nov 2025 16:25:27 -0500 Subject: [PATCH 2/2] Minor cleanup --- script/tool/lib/src/podspec_check_command.dart | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/script/tool/lib/src/podspec_check_command.dart b/script/tool/lib/src/podspec_check_command.dart index c126792743b..e768a5168c5 100644 --- a/script/tool/lib/src/podspec_check_command.dart +++ b/script/tool/lib/src/podspec_check_command.dart @@ -125,14 +125,9 @@ 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; + print('Linting ${podspec.basename}'); - final String podspecBasename = podspec.basename; - print('Linting $podspecBasename'); - - // Lint plugin as framework (use_frameworks!). - final ProcessResult lintResult = await _runPodLint(podspecPath); + final ProcessResult lintResult = await _runPodLint(podspec.path); print(lintResult.stdout); print(lintResult.stderr);