Skip to content

[tool] Don't lint Flutter shim podspecs #5007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions script/tool/lib/src/podspec_check_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ class PodspecCheckCommand extends PackageLoopingCommand {
Future<List<File>> _podspecsToLint(RepositoryPackage package) async {
final List<File> podspecs =
await getFilesForPackage(package).where((File entity) {
final String filePath = entity.path;
return path.extension(filePath) == '.podspec';
final String filename = entity.basename;
return path.extension(filename) == '.podspec' &&
filename != 'Flutter.podspec' &&
filename != 'FlutterMacOS.podspec';
}).toList();

podspecs.sort((File a, File b) => a.basename.compareTo(b.basename));
Expand Down
54 changes: 54 additions & 0 deletions script/tool/test/podspec_check_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,60 @@ void main() {
expect(output, contains('Bar'));
});

test('skips shim podspecs for the Flutter framework', () async {
final RepositoryPackage plugin = createFakePlugin(
'plugin1',
packagesDir,
extraFiles: <String>[
'example/ios/Flutter/Flutter.podspec',
'example/macos/Flutter/ephemeral/FlutterMacOS.podspec',
],
);
_writeFakePodspec(plugin, 'macos');

final List<String> output =
await runCapturingPrint(runner, <String>['podspec-check']);

expect(output, isNot(contains('FlutterMacOS.podspec')));
expect(
processRunner.recordedCalls,
orderedEquals(<ProcessCall>[
ProcessCall('which', const <String>['pod'], packagesDir.path),
ProcessCall(
'pod',
<String>[
'lib',
'lint',
plugin
.platformDirectory(FlutterPlatform.macos)
.childFile('plugin1.podspec')
.path,
'--configuration=Debug',
'--skip-tests',
'--allow-warnings',
'--use-modular-headers',
'--use-libraries'
],
packagesDir.path),
ProcessCall(
'pod',
<String>[
'lib',
'lint',
plugin
.platformDirectory(FlutterPlatform.macos)
.childFile('plugin1.podspec')
.path,
'--configuration=Debug',
'--skip-tests',
'--allow-warnings',
'--use-modular-headers',
],
packagesDir.path),
]),
);
});

test('fails if pod is missing', () async {
final RepositoryPackage plugin = createFakePlugin('plugin1', packagesDir);
_writeFakePodspec(plugin, 'ios');
Expand Down