Skip to content
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

Skip podspec Swift Search Path validation if only swift file is Package.swift for darwin plugins #6635

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: 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