@@ -239,7 +239,7 @@ void main() {
239
239
Platform : () => macPlatform,
240
240
});
241
241
242
- group ('copy and thin engine Flutter.framework' , () {
242
+ group ('copy, thin, and bitcode strip engine Flutter.framework' , () {
243
243
Directory outputDir;
244
244
FakeCommand copyPhysicalFrameworkCommand;
245
245
@@ -269,6 +269,7 @@ void main() {
269
269
defines: < String , String > {
270
270
kIosArchs: 'x86_64' ,
271
271
kSdkRoot: 'path/to/iPhoneSimulator.sdk' ,
272
+ kBitcodeFlag: 'true' ,
272
273
},
273
274
);
274
275
@@ -308,7 +309,7 @@ void main() {
308
309
expect (processManager.hasRemainingExpectations, isFalse);
309
310
});
310
311
311
- testWithoutContext ('thinning fails when frameworks missing' , () async {
312
+ testWithoutContext ('fails when frameworks missing' , () async {
312
313
final Environment environment = Environment .test (
313
314
fileSystem.currentDirectory,
314
315
processManager: processManager,
@@ -319,10 +320,11 @@ void main() {
319
320
defines: < String , String > {
320
321
kIosArchs: 'arm64' ,
321
322
kSdkRoot: 'path/to/iPhoneOS.sdk' ,
323
+ kBitcodeFlag: '' ,
322
324
},
323
325
);
324
326
processManager.addCommand (copyPhysicalFrameworkCommand);
325
- expect (
327
+ await expectLater (
326
328
const DebugUnpackIOS ().build (environment),
327
329
throwsA (isA <Exception >().having (
328
330
(Exception exception) => exception.toString (),
@@ -331,7 +333,7 @@ void main() {
331
333
)));
332
334
});
333
335
334
- testWithoutContext ('thinning fails when requested archs missing from framework' , () async {
336
+ testWithoutContext ('fails when requested archs missing from framework' , () async {
335
337
final File binary = outputDir.childDirectory ('Flutter.framework' ).childFile ('Flutter' )..createSync (recursive: true );
336
338
337
339
final Environment environment = Environment .test (
@@ -344,6 +346,7 @@ void main() {
344
346
defines: < String , String > {
345
347
kIosArchs: 'arm64 armv7' ,
346
348
kSdkRoot: 'path/to/iPhoneOS.sdk' ,
349
+ kBitcodeFlag: '' ,
347
350
},
348
351
);
349
352
@@ -366,7 +369,7 @@ void main() {
366
369
], exitCode: 1 ),
367
370
);
368
371
369
- expect (
372
+ await expectLater (
370
373
const DebugUnpackIOS ().build (environment),
371
374
throwsA (isA <Exception >().having (
372
375
(Exception exception) => exception.toString (),
@@ -375,7 +378,7 @@ void main() {
375
378
)));
376
379
});
377
380
378
- testWithoutContext ('thinning fails when lipo extract fails' , () async {
381
+ testWithoutContext ('fails when lipo extract fails' , () async {
379
382
final File binary = outputDir.childDirectory ('Flutter.framework' ).childFile ('Flutter' )..createSync (recursive: true );
380
383
381
384
final Environment environment = Environment .test (
@@ -388,6 +391,7 @@ void main() {
388
391
defines: < String , String > {
389
392
kIosArchs: 'arm64 armv7' ,
390
393
kSdkRoot: 'path/to/iPhoneOS.sdk' ,
394
+ kBitcodeFlag: '' ,
391
395
},
392
396
);
393
397
@@ -424,7 +428,7 @@ void main() {
424
428
stderr: 'lipo error' ),
425
429
);
426
430
427
- expect (
431
+ await expectLater (
428
432
const DebugUnpackIOS ().build (environment),
429
433
throwsA (isA <Exception >().having (
430
434
(Exception exception) => exception.toString (),
@@ -433,7 +437,7 @@ void main() {
433
437
)));
434
438
});
435
439
436
- testWithoutContext ('skips thin frameworks ' , () async {
440
+ testWithoutContext ('skips thin framework ' , () async {
437
441
final File binary = outputDir.childDirectory ('Flutter.framework' ).childFile ('Flutter' )..createSync (recursive: true );
438
442
439
443
final Environment environment = Environment .test (
@@ -446,6 +450,7 @@ void main() {
446
450
defines: < String , String > {
447
451
kIosArchs: 'arm64' ,
448
452
kSdkRoot: 'path/to/iPhoneOS.sdk' ,
453
+ kBitcodeFlag: 'true' ,
449
454
},
450
455
);
451
456
@@ -473,7 +478,7 @@ void main() {
473
478
expect (processManager.hasRemainingExpectations, isFalse);
474
479
});
475
480
476
- testWithoutContext ('thins fat frameworks ' , () async {
481
+ testWithoutContext ('thins fat framework ' , () async {
477
482
final File binary = outputDir.childDirectory ('Flutter.framework' ).childFile ('Flutter' )..createSync (recursive: true );
478
483
479
484
final Environment environment = Environment .test (
@@ -486,6 +491,7 @@ void main() {
486
491
defines: < String , String > {
487
492
kIosArchs: 'arm64 armv7' ,
488
493
kSdkRoot: 'path/to/iPhoneOS.sdk' ,
494
+ kBitcodeFlag: 'true' ,
489
495
},
490
496
);
491
497
@@ -524,5 +530,100 @@ void main() {
524
530
await const DebugUnpackIOS ().build (environment);
525
531
expect (processManager.hasRemainingExpectations, isFalse);
526
532
});
533
+
534
+ testWithoutContext ('fails when bitcode strip fails' , () async {
535
+ final File binary = outputDir.childDirectory ('Flutter.framework' ).childFile ('Flutter' )..createSync (recursive: true );
536
+
537
+ final Environment environment = Environment .test (
538
+ fileSystem.currentDirectory,
539
+ processManager: processManager,
540
+ artifacts: artifacts,
541
+ logger: logger,
542
+ fileSystem: fileSystem,
543
+ outputDir: outputDir,
544
+ defines: < String , String > {
545
+ kIosArchs: 'arm64' ,
546
+ kSdkRoot: 'path/to/iPhoneOS.sdk' ,
547
+ kBitcodeFlag: '' ,
548
+ },
549
+ );
550
+
551
+ processManager.addCommands (< FakeCommand > [
552
+ copyPhysicalFrameworkCommand,
553
+ FakeCommand (command: < String > [
554
+ 'lipo' ,
555
+ '-info' ,
556
+ binary.path,
557
+ ], stdout: 'Non-fat file:' ),
558
+ FakeCommand (command: < String > [
559
+ 'lipo' ,
560
+ binary.path,
561
+ '-verify_arch' ,
562
+ 'arm64' ,
563
+ ]),
564
+ FakeCommand (command: < String > [
565
+ 'xcrun' ,
566
+ 'bitcode_strip' ,
567
+ binary.path,
568
+ '-m' ,
569
+ '-o' ,
570
+ binary.path,
571
+ ], exitCode: 1 , stderr: 'bitcode_strip error' ),
572
+ ]);
573
+
574
+ await expectLater (
575
+ const DebugUnpackIOS ().build (environment),
576
+ throwsA (isA <Exception >().having (
577
+ (Exception exception) => exception.toString (),
578
+ 'description' ,
579
+ contains ('Failed to strip bitcode for output/Flutter.framework/Flutter.\n bitcode_strip error' ),
580
+ )));
581
+
582
+ expect (processManager.hasRemainingExpectations, isFalse);
583
+ });
584
+
585
+ testWithoutContext ('strips framework' , () async {
586
+ final File binary = outputDir.childDirectory ('Flutter.framework' ).childFile ('Flutter' )..createSync (recursive: true );
587
+
588
+ final Environment environment = Environment .test (
589
+ fileSystem.currentDirectory,
590
+ processManager: processManager,
591
+ artifacts: artifacts,
592
+ logger: logger,
593
+ fileSystem: fileSystem,
594
+ outputDir: outputDir,
595
+ defines: < String , String > {
596
+ kIosArchs: 'arm64' ,
597
+ kSdkRoot: 'path/to/iPhoneOS.sdk' ,
598
+ kBitcodeFlag: '' ,
599
+ },
600
+ );
601
+
602
+ processManager.addCommands (< FakeCommand > [
603
+ copyPhysicalFrameworkCommand,
604
+ FakeCommand (command: < String > [
605
+ 'lipo' ,
606
+ '-info' ,
607
+ binary.path,
608
+ ], stdout: 'Non-fat file:' ),
609
+ FakeCommand (command: < String > [
610
+ 'lipo' ,
611
+ binary.path,
612
+ '-verify_arch' ,
613
+ 'arm64' ,
614
+ ]),
615
+ FakeCommand (command: < String > [
616
+ 'xcrun' ,
617
+ 'bitcode_strip' ,
618
+ binary.path,
619
+ '-m' ,
620
+ '-o' ,
621
+ binary.path,
622
+ ]),
623
+ ]);
624
+ await const DebugUnpackIOS ().build (environment);
625
+
626
+ expect (processManager.hasRemainingExpectations, isFalse);
627
+ });
527
628
});
528
629
}
0 commit comments