File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -346,6 +346,8 @@ class FormatCommand extends PackageCommand {
346346 pathFragmentForDirectories (< String > ['example' , 'build' ])) &&
347347 // Ignore files in Pods, which are not part of the repository.
348348 ! path.contains (pathFragmentForDirectories (< String > ['Pods' ])) &&
349+ // See https://github.com/flutter/flutter/issues/144039
350+ ! path.endsWith ('GeneratedPluginRegistrant.swift' ) &&
349351 // Ignore .dart_tool/, which can have various intermediate files.
350352 ! path.contains (pathFragmentForDirectories (< String > ['.dart_tool' ])))
351353 .toList ();
Original file line number Diff line number Diff line change @@ -737,6 +737,52 @@ void main() {
737737 ]));
738738 });
739739
740+ test ('skips GeneratedPluginRegistrant.swift' , () async {
741+ const String sourceFile = 'macos/Classes/Foo.swift' ;
742+ final RepositoryPackage plugin = createFakePlugin (
743+ 'a_plugin' ,
744+ packagesDir,
745+ extraFiles: < String > [
746+ sourceFile,
747+ 'example/macos/Flutter/GeneratedPluginRegistrant.swift' ,
748+ ],
749+ );
750+
751+ await runCapturingPrint (runner, < String > [
752+ 'format' ,
753+ '--swift' ,
754+ '--swift-format-path=/path/to/swift-format'
755+ ]);
756+
757+ expect (
758+ processRunner.recordedCalls,
759+ orderedEquals (< ProcessCall > [
760+ const ProcessCall (
761+ '/path/to/swift-format' ,
762+ < String > ['--version' ],
763+ null ,
764+ ),
765+ ProcessCall (
766+ '/path/to/swift-format' ,
767+ < String > [
768+ '-i' ,
769+ ...getPackagesDirRelativePaths (plugin, < String > [sourceFile])
770+ ],
771+ packagesDir.path,
772+ ),
773+ ProcessCall (
774+ '/path/to/swift-format' ,
775+ < String > [
776+ 'lint' ,
777+ '--parallel' ,
778+ '--strict' ,
779+ ...getPackagesDirRelativePaths (plugin, < String > [sourceFile]),
780+ ],
781+ packagesDir.path,
782+ ),
783+ ]));
784+ });
785+
740786 test ('fails if files are changed with --fail-on-change' , () async {
741787 const List <String > files = < String > [
742788 'linux/foo_plugin.cc' ,
You can’t perform that action at this time.
0 commit comments