@@ -164,6 +164,98 @@ void main() {
164
164
]));
165
165
});
166
166
167
+ test ('building for iOS with Swift Package Manager on master channel' ,
168
+ () async {
169
+ mockPlatform.isMacOS = true ;
170
+ mockPlatform.environment['CHANNEL' ] = 'master' ;
171
+
172
+ final RepositoryPackage plugin = createFakePlugin ('plugin' , packagesDir,
173
+ platformSupport: < String , PlatformDetails > {
174
+ platformIOS: const PlatformDetails (PlatformSupport .inline),
175
+ });
176
+
177
+ final Directory pluginExampleDirectory = getExampleDir (plugin);
178
+
179
+ final List <String > output = await runCapturingPrint (runner, < String > [
180
+ 'build-examples' ,
181
+ '--ios' ,
182
+ '--enable-experiment=exp1' ,
183
+ '--swift-package-manager' ,
184
+ ]);
185
+
186
+ expect (
187
+ output,
188
+ containsAllInOrder (< String > [
189
+ '\n BUILDING plugin/example for iOS' ,
190
+ ]),
191
+ );
192
+
193
+ expect (
194
+ processRunner.recordedCalls,
195
+ orderedEquals (< ProcessCall > [
196
+ ProcessCall (
197
+ getFlutterCommand (mockPlatform),
198
+ const < String > ['config' , '--enable-swift-package-manager' ],
199
+ null ,
200
+ ),
201
+ ProcessCall (
202
+ getFlutterCommand (mockPlatform),
203
+ const < String > [
204
+ 'build' ,
205
+ 'ios' ,
206
+ '--no-codesign' ,
207
+ '--enable-experiment=exp1'
208
+ ],
209
+ pluginExampleDirectory.path,
210
+ ),
211
+ ]),
212
+ );
213
+ });
214
+
215
+ test (
216
+ 'building for iOS with Swift Package Manager on stable channel does not enable SPM' ,
217
+ () async {
218
+ mockPlatform.isMacOS = true ;
219
+ mockPlatform.environment['CHANNEL' ] = 'stable' ;
220
+
221
+ final RepositoryPackage plugin = createFakePlugin ('plugin' , packagesDir,
222
+ platformSupport: < String , PlatformDetails > {
223
+ platformIOS: const PlatformDetails (PlatformSupport .inline),
224
+ });
225
+
226
+ final Directory pluginExampleDirectory = getExampleDir (plugin);
227
+
228
+ final List <String > output = await runCapturingPrint (runner, < String > [
229
+ 'build-examples' ,
230
+ '--ios' ,
231
+ '--enable-experiment=exp1' ,
232
+ '--swift-package-manager' ,
233
+ ]);
234
+
235
+ expect (
236
+ output,
237
+ containsAllInOrder (< String > [
238
+ '\n BUILDING plugin/example for iOS' ,
239
+ ]),
240
+ );
241
+
242
+ expect (
243
+ processRunner.recordedCalls,
244
+ orderedEquals (< ProcessCall > [
245
+ ProcessCall (
246
+ getFlutterCommand (mockPlatform),
247
+ const < String > [
248
+ 'build' ,
249
+ 'ios' ,
250
+ '--no-codesign' ,
251
+ '--enable-experiment=exp1'
252
+ ],
253
+ pluginExampleDirectory.path,
254
+ ),
255
+ ]),
256
+ );
257
+ });
258
+
167
259
test (
168
260
'building for Linux when plugin is not set up for Linux results in no-op' ,
169
261
() async {
@@ -261,6 +353,86 @@ void main() {
261
353
]));
262
354
});
263
355
356
+ test ('building for macOS with Swift Package Manager on master channel' ,
357
+ () async {
358
+ mockPlatform.isMacOS = true ;
359
+ mockPlatform.environment['CHANNEL' ] = 'master' ;
360
+
361
+ final RepositoryPackage plugin = createFakePlugin ('plugin' , packagesDir,
362
+ platformSupport: < String , PlatformDetails > {
363
+ platformMacOS: const PlatformDetails (PlatformSupport .inline),
364
+ });
365
+
366
+ final Directory pluginExampleDirectory = getExampleDir (plugin);
367
+
368
+ final List <String > output = await runCapturingPrint (runner,
369
+ < String > ['build-examples' , '--macos' , '--swift-package-manager' ]);
370
+
371
+ expect (
372
+ output,
373
+ containsAllInOrder (< String > [
374
+ '\n BUILDING plugin/example for macOS' ,
375
+ ]),
376
+ );
377
+
378
+ expect (
379
+ processRunner.recordedCalls,
380
+ orderedEquals (< ProcessCall > [
381
+ ProcessCall (
382
+ getFlutterCommand (mockPlatform),
383
+ const < String > ['config' , '--enable-swift-package-manager' ],
384
+ null ,
385
+ ),
386
+ ProcessCall (
387
+ getFlutterCommand (mockPlatform),
388
+ const < String > [
389
+ 'build' ,
390
+ 'macos' ,
391
+ ],
392
+ pluginExampleDirectory.path,
393
+ ),
394
+ ]),
395
+ );
396
+ });
397
+
398
+ test (
399
+ 'building for macOS with Swift Package Manager on stable channel does not enable SPM' ,
400
+ () async {
401
+ mockPlatform.isMacOS = true ;
402
+ mockPlatform.environment['CHANNEL' ] = 'stable' ;
403
+
404
+ final RepositoryPackage plugin = createFakePlugin ('plugin' , packagesDir,
405
+ platformSupport: < String , PlatformDetails > {
406
+ platformMacOS: const PlatformDetails (PlatformSupport .inline),
407
+ });
408
+
409
+ final Directory pluginExampleDirectory = getExampleDir (plugin);
410
+
411
+ final List <String > output = await runCapturingPrint (runner,
412
+ < String > ['build-examples' , '--macos' , '--swift-package-manager' ]);
413
+
414
+ expect (
415
+ output,
416
+ containsAllInOrder (< String > [
417
+ '\n BUILDING plugin/example for macOS' ,
418
+ ]),
419
+ );
420
+
421
+ expect (
422
+ processRunner.recordedCalls,
423
+ orderedEquals (< ProcessCall > [
424
+ ProcessCall (
425
+ getFlutterCommand (mockPlatform),
426
+ const < String > [
427
+ 'build' ,
428
+ 'macos' ,
429
+ ],
430
+ pluginExampleDirectory.path,
431
+ ),
432
+ ]),
433
+ );
434
+ });
435
+
264
436
test ('building for web with no implementation results in no-op' , () async {
265
437
createFakePlugin ('plugin' , packagesDir);
266
438
0 commit comments