Skip to content

Commit

Permalink
Skip podspec Swift Search Path validation if only swift file is Packa…
Browse files Browse the repository at this point in the history
…ge.swift for darwin plugins (#6635)

Fix for iOS was added in #6627, but neglected to handle when plugin uses darwin directory.

Supplemental fix for flutter/flutter#147548.
  • Loading branch information
vashworth authored May 2, 2024
1 parent 1856a6e commit 62c08f4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
6 changes: 6 additions & 0 deletions script/tool/lib/src/podspec_check_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ class PodspecCheckCommand extends PackageLoopingCommand {
.childDirectory(package.directory.basename)
.childFile('Package.swift')
.path;
final String darwinSwiftPackageManifestPath = package.directory
.childDirectory('darwin')
.childDirectory(package.directory.basename)
.childFile('Package.swift')
.path;
return getFilesForPackage(package).any((File entity) {
final String relativePath =
getRelativePosixPath(entity, from: package.directory);
Expand All @@ -178,6 +183,7 @@ class PodspecCheckCommand extends PackageLoopingCommand {
}
final String filePath = entity.path;
return filePath != iosSwiftPackageManifestPath &&
filePath != darwinSwiftPackageManifestPath &&
path.extension(filePath) == '.swift';
});
}
Expand Down
22 changes: 22 additions & 0 deletions script/tool/test/podspec_check_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,28 @@ void main() {
));
});

test(
'does not require the search paths workaround for darwin Package.swift',
() async {
final RepositoryPackage plugin = createFakePlugin(
'plugin1',
packagesDir,
extraFiles: <String>['darwin/plugin1/Package.swift'],
);
_writeFakePodspec(plugin, 'darwin');

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,
Expand Down

0 comments on commit 62c08f4

Please sign in to comment.