@@ -164,6 +164,56 @@ void main() {
164164 ]));
165165 });
166166
167+ test ('building for iOS with Swift Package Manager' , () async {
168+ mockPlatform.isMacOS = true ;
169+ final RepositoryPackage plugin = createFakePlugin ('plugin' , packagesDir,
170+ platformSupport: < String , PlatformDetails > {
171+ platformIOS: const PlatformDetails (PlatformSupport .inline),
172+ });
173+
174+ final Directory pluginExampleDirectory = getExampleDir (plugin);
175+
176+ final List <String > output = await runCapturingPrint (runner, < String > [
177+ 'build-examples' ,
178+ '--ios' ,
179+ '--enable-experiment=exp1' ,
180+ '--swift-package-manager' ,
181+ ]);
182+
183+ expect (
184+ output,
185+ containsAllInOrder (< String > [
186+ '\n BUILDING plugin/example for iOS' ,
187+ ]),
188+ );
189+
190+ expect (
191+ processRunner.recordedCalls,
192+ orderedEquals (< ProcessCall > [
193+ ProcessCall (
194+ getFlutterCommand (mockPlatform),
195+ const < String > ['config' , '--enable-swift-package-manager' ],
196+ null ,
197+ ),
198+ ProcessCall (
199+ getFlutterCommand (mockPlatform),
200+ const < String > ['clean' ],
201+ pluginExampleDirectory.path,
202+ ),
203+ ProcessCall (
204+ getFlutterCommand (mockPlatform),
205+ const < String > [
206+ 'build' ,
207+ 'ios' ,
208+ '--no-codesign' ,
209+ '--enable-experiment=exp1'
210+ ],
211+ pluginExampleDirectory.path,
212+ ),
213+ ]),
214+ );
215+ });
216+
167217 test (
168218 'building for Linux when plugin is not set up for Linux results in no-op' ,
169219 () async {
@@ -261,6 +311,50 @@ void main() {
261311 ]));
262312 });
263313
314+ test ('building for macOS with Swift Package Manager' , () async {
315+ mockPlatform.isMacOS = true ;
316+ final RepositoryPackage plugin = createFakePlugin ('plugin' , packagesDir,
317+ platformSupport: < String , PlatformDetails > {
318+ platformMacOS: const PlatformDetails (PlatformSupport .inline),
319+ });
320+
321+ final Directory pluginExampleDirectory = getExampleDir (plugin);
322+
323+ final List <String > output = await runCapturingPrint (runner,
324+ < String > ['build-examples' , '--macos' , '--swift-package-manager' ]);
325+
326+ expect (
327+ output,
328+ containsAllInOrder (< String > [
329+ '\n BUILDING plugin/example for macOS' ,
330+ ]),
331+ );
332+
333+ expect (
334+ processRunner.recordedCalls,
335+ orderedEquals (< ProcessCall > [
336+ ProcessCall (
337+ getFlutterCommand (mockPlatform),
338+ const < String > ['config' , '--enable-swift-package-manager' ],
339+ null ,
340+ ),
341+ ProcessCall (
342+ getFlutterCommand (mockPlatform),
343+ const < String > ['clean' ],
344+ pluginExampleDirectory.path,
345+ ),
346+ ProcessCall (
347+ getFlutterCommand (mockPlatform),
348+ const < String > [
349+ 'build' ,
350+ 'macos' ,
351+ ],
352+ pluginExampleDirectory.path,
353+ ),
354+ ]),
355+ );
356+ });
357+
264358 test ('building for web with no implementation results in no-op' , () async {
265359 createFakePlugin ('plugin' , packagesDir);
266360
0 commit comments