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 d5f3181e672..24f0d80f346 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.'; @@ -117,11 +117,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, ) { @@ -137,43 +132,17 @@ 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'); + print('Linting ${podspec.basename}'); - // 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); + 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 { - final 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', - ]; + Future _runPodLint(String podspecPath) async { + final arguments = ['lib', 'lint', podspecPath, '--quick']; print('Running "pod ${arguments.join(' ')}"'); return processRunner.run( diff --git a/script/tool/test/podspec_check_command_test.dart b/script/tool/test/podspec_check_command_test.dart index b3a879e2a32..dbd7fe9b276 100644 --- a/script/tool/test/podspec_check_command_test.dart +++ b/script/tool/test/podspec_check_command_test.dart @@ -156,19 +156,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), ]), ); @@ -205,19 +193,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,39 +259,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 {