Skip podspec Swift Search Path validation if only swift file is Package.swift (#6627)

Usually when an iOS plugin uses Swift files, it requires a workaround in the podspec to add Swift to the search paths. Part of the `podspec-check` command is validating this workaround is found. However, when the only Swift file is the `Package.swift` (Swift Package Manager manifest), skip this validation since having this file does not indicate the plugin uses Swift files.

Fixes https://github.com/flutter/flutter/issues/147548.
This commit is contained in:
Victoria Ashworth
2024-04-30 18:43:18 -05:00
committed by GitHub
parent d5205191f8
commit aea93d2a51
3 changed files with 55 additions and 4 deletions

View File

@ -319,8 +319,14 @@ void main() {
test('fails if an iOS Swift plugin is missing the search paths workaround',
() async {
final RepositoryPackage plugin = createFakePlugin('plugin1', packagesDir,
extraFiles: <String>['ios/Classes/SomeSwift.swift']);
final RepositoryPackage plugin = createFakePlugin(
'plugin1',
packagesDir,
extraFiles: <String>[
'ios/Classes/SomeSwift.swift',
'ios/plugin1/Package.swift',
],
);
_writeFakePodspec(plugin, 'ios');
Error? commandError;
@ -378,6 +384,27 @@ void main() {
));
});
test('does not require the search paths workaround for iOS Package.swift',
() async {
final RepositoryPackage plugin = createFakePlugin(
'plugin1',
packagesDir,
extraFiles: <String>['ios/plugin1/Package.swift'],
);
_writeFakePodspec(plugin, 'ios');
final List<String> output =
await runCapturingPrint(runner, <String>['podspec-check']);
expect(
output,
containsAllInOrder(
<Matcher>[
contains('Ran for 1 package(s)'),
],
));
});
test('does not require the search paths workaround for macOS plugins',
() async {
final RepositoryPackage plugin = createFakePlugin('plugin1', packagesDir,