From acf500d693e6031559b220b131f6cadca5d399af Mon Sep 17 00:00:00 2001 From: Victoria Ashworth <vashworth@google.com> Date: Wed, 1 May 2024 17:26:12 -0500 Subject: [PATCH 1/2] Skip podspec Swift Search Path validation if only swift file is Package.swift for darwin plugins --- .../tool/lib/src/podspec_check_command.dart | 6 ++++++ .../tool/test/podspec_check_command_test.dart | 21 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/script/tool/lib/src/podspec_check_command.dart b/script/tool/lib/src/podspec_check_command.dart index aa3448b0af0d..96df0db31d90 100644 --- a/script/tool/lib/src/podspec_check_command.dart +++ b/script/tool/lib/src/podspec_check_command.dart @@ -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); @@ -178,6 +183,7 @@ class PodspecCheckCommand extends PackageLoopingCommand { } final String filePath = entity.path; return filePath != iosSwiftPackageManifestPath && + filePath != darwinSwiftPackageManifestPath && path.extension(filePath) == '.swift'; }); } diff --git a/script/tool/test/podspec_check_command_test.dart b/script/tool/test/podspec_check_command_test.dart index cf5938a4ae42..291da42d7fcf 100644 --- a/script/tool/test/podspec_check_command_test.dart +++ b/script/tool/test/podspec_check_command_test.dart @@ -405,6 +405,27 @@ 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, From 69698c4e0ccc7c7f42364fde2a266c6a40574222 Mon Sep 17 00:00:00 2001 From: Victoria Ashworth <vashworth@google.com> Date: Wed, 1 May 2024 17:28:34 -0500 Subject: [PATCH 2/2] fix formatting --- script/tool/test/podspec_check_command_test.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/tool/test/podspec_check_command_test.dart b/script/tool/test/podspec_check_command_test.dart index 291da42d7fcf..5ffa4bf2cb13 100644 --- a/script/tool/test/podspec_check_command_test.dart +++ b/script/tool/test/podspec_check_command_test.dart @@ -405,7 +405,8 @@ void main() { )); }); - test('does not require the search paths workaround for darwin Package.swift', + test( + 'does not require the search paths workaround for darwin Package.swift', () async { final RepositoryPackage plugin = createFakePlugin( 'plugin1',