Skip to content

Commit 97c47da

Browse files
vashworthTecHaxter
authored andcommitted
Skip podspec Swift Search Path validation if only swift file is Package.swift for darwin plugins (flutter#6635)
Fix for iOS was added in flutter#6627, but neglected to handle when plugin uses darwin directory. Supplemental fix for flutter/flutter#147548.
1 parent 9b966c3 commit 97c47da

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

script/tool/lib/src/podspec_check_command.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ class PodspecCheckCommand extends PackageLoopingCommand {
169169
.childDirectory(package.directory.basename)
170170
.childFile('Package.swift')
171171
.path;
172+
final String darwinSwiftPackageManifestPath = package.directory
173+
.childDirectory('darwin')
174+
.childDirectory(package.directory.basename)
175+
.childFile('Package.swift')
176+
.path;
172177
return getFilesForPackage(package).any((File entity) {
173178
final String relativePath =
174179
getRelativePosixPath(entity, from: package.directory);
@@ -178,6 +183,7 @@ class PodspecCheckCommand extends PackageLoopingCommand {
178183
}
179184
final String filePath = entity.path;
180185
return filePath != iosSwiftPackageManifestPath &&
186+
filePath != darwinSwiftPackageManifestPath &&
181187
path.extension(filePath) == '.swift';
182188
});
183189
}

script/tool/test/podspec_check_command_test.dart

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,28 @@ void main() {
405405
));
406406
});
407407

408+
test(
409+
'does not require the search paths workaround for darwin Package.swift',
410+
() async {
411+
final RepositoryPackage plugin = createFakePlugin(
412+
'plugin1',
413+
packagesDir,
414+
extraFiles: <String>['darwin/plugin1/Package.swift'],
415+
);
416+
_writeFakePodspec(plugin, 'darwin');
417+
418+
final List<String> output =
419+
await runCapturingPrint(runner, <String>['podspec-check']);
420+
421+
expect(
422+
output,
423+
containsAllInOrder(
424+
<Matcher>[
425+
contains('Ran for 1 package(s)'),
426+
],
427+
));
428+
});
429+
408430
test('does not require the search paths workaround for macOS plugins',
409431
() async {
410432
final RepositoryPackage plugin = createFakePlugin('plugin1', packagesDir,

0 commit comments

Comments
 (0)