@@ -9,10 +9,8 @@ import 'package:flutter_tools/src/base/platform.dart';
9
9
import 'package:flutter_tools/src/cache.dart' ;
10
10
import 'package:flutter_tools/src/commands/build.dart' ;
11
11
import 'package:flutter_tools/src/commands/build_ios.dart' ;
12
- import 'package:flutter_tools/src/ios/plist_parser.dart' ;
13
12
import 'package:flutter_tools/src/ios/xcodeproj.dart' ;
14
13
import 'package:flutter_tools/src/reporting/reporting.dart' ;
15
- import 'package:test/fake.dart' ;
16
14
17
15
import '../../general.shard/ios/xcresult_test_data.dart' ;
18
16
import '../../src/common.dart' ;
@@ -52,20 +50,10 @@ final Platform notMacosPlatform = FakePlatform(
52
50
}
53
51
);
54
52
55
- class FakePlistUtils extends Fake implements PlistParser {
56
- final Map <String , Map <String , Object >> fileContents = < String , Map <String , Object >> {};
57
-
58
- @override
59
- String ? getStringValueFromFile (String plistFilePath, String key) {
60
- return fileContents[plistFilePath]! [key] as String ? ;
61
- }
62
- }
63
-
64
53
void main () {
65
54
late FileSystem fileSystem;
66
55
late TestUsage usage;
67
56
late FakeProcessManager fakeProcessManager;
68
- late FakePlistUtils plistUtils;
69
57
70
58
setUpAll (() {
71
59
Cache .disableLocking ();
@@ -75,7 +63,6 @@ void main() {
75
63
fileSystem = MemoryFileSystem .test ();
76
64
usage = TestUsage ();
77
65
fakeProcessManager = FakeProcessManager .empty ();
78
- plistUtils = FakePlistUtils ();
79
66
});
80
67
81
68
// Sets up the minimal mock project files necessary to look like a Flutter project.
@@ -259,7 +246,8 @@ void main() {
259
246
FileSystem : () => fileSystem,
260
247
ProcessManager : () => FakeProcessManager .any (),
261
248
Platform : () => macosPlatform,
262
- XcodeProjectInterpreter : () => FakeXcodeProjectInterpreterWithBuildSettings (),
249
+ XcodeProjectInterpreter : () =>
250
+ FakeXcodeProjectInterpreterWithBuildSettings (),
263
251
});
264
252
265
253
testUsingContext ('ipa build fails when --export-options-plist and --export-method are used together' , () async {
@@ -282,7 +270,8 @@ void main() {
282
270
FileSystem : () => fileSystem,
283
271
ProcessManager : () => FakeProcessManager .any (),
284
272
Platform : () => macosPlatform,
285
- XcodeProjectInterpreter : () => FakeXcodeProjectInterpreterWithBuildSettings (),
273
+ XcodeProjectInterpreter : () =>
274
+ FakeXcodeProjectInterpreterWithBuildSettings (),
286
275
});
287
276
288
277
testUsingContext ('ipa build reports when IPA fails' , () async {
@@ -532,7 +521,8 @@ void main() {
532
521
FileSystem : () => fileSystem,
533
522
ProcessManager : () => FakeProcessManager .any (),
534
523
Platform : () => macosPlatform,
535
- XcodeProjectInterpreter : () => FakeXcodeProjectInterpreterWithBuildSettings (),
524
+ XcodeProjectInterpreter : () =>
525
+ FakeXcodeProjectInterpreterWithBuildSettings (),
536
526
});
537
527
538
528
testUsingContext ('Performs code size analysis and sends analytics' , () async {
@@ -611,7 +601,8 @@ void main() {
611
601
FileSystem : () => fileSystem,
612
602
ProcessManager : () => fakeProcessManager,
613
603
Platform : () => macosPlatform,
614
- XcodeProjectInterpreter : () => FakeXcodeProjectInterpreterWithBuildSettings (),
604
+ XcodeProjectInterpreter : () =>
605
+ FakeXcodeProjectInterpreterWithBuildSettings (),
615
606
});
616
607
617
608
testUsingContext ('Trace error if xcresult is empty.' , () async {
@@ -744,97 +735,6 @@ void main() {
744
735
Platform : () => macosPlatform,
745
736
XcodeProjectInterpreter : () => FakeXcodeProjectInterpreterWithBuildSettings (),
746
737
});
747
-
748
- testUsingContext (
749
- 'Validate basic Xcode settings with missing settings' , () async {
750
-
751
- const String plistPath = 'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist' ;
752
- fakeProcessManager.addCommands (< FakeCommand > [
753
- xattrCommand,
754
- setUpFakeXcodeBuildHandler (onRun: () {
755
- fileSystem.file (plistPath).createSync (recursive: true );
756
- }),
757
- exportArchiveCommand (exportOptionsPlist: _exportOptionsPlist),
758
- ]);
759
-
760
- createMinimalMockProjectFiles ();
761
-
762
- plistUtils.fileContents[plistPath] = < String ,String > {
763
- 'CFBundleIdentifier' : 'io.flutter.someProject' ,
764
- };
765
-
766
- final BuildCommand command = BuildCommand ();
767
- await createTestCommandRunner (command).run (
768
- < String > ['build' , 'ipa' , '--no-pub' ]);
769
-
770
- expect (
771
- testLogger.statusText,
772
- contains (
773
- '┌─ App Settings ────────────────────────────────────────┐\n '
774
- '│ Version Number: Missing │\n '
775
- '│ Build Number: Missing │\n '
776
- '│ Display Name: Missing │\n '
777
- '│ Deployment Target: Missing │\n '
778
- '│ Bundle Identifier: io.flutter.someProject │\n '
779
- '│ │\n '
780
- '│ You must set up the missing settings │\n '
781
- '│ Instructions: https://docs.flutter.dev/deployment/ios │\n '
782
- '└───────────────────────────────────────────────────────┘'
783
- )
784
- );
785
- }, overrides: < Type , Generator > {
786
- FileSystem : () => fileSystem,
787
- ProcessManager : () => fakeProcessManager,
788
- Platform : () => macosPlatform,
789
- XcodeProjectInterpreter : () => FakeXcodeProjectInterpreterWithBuildSettings (),
790
- PlistParser : () => plistUtils,
791
- });
792
-
793
- testUsingContext (
794
- 'Validate basic Xcode settings with full settings' , () async {
795
- const String plistPath = 'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist' ;
796
- fakeProcessManager.addCommands (< FakeCommand > [
797
- xattrCommand,
798
- setUpFakeXcodeBuildHandler (onRun: () {
799
- fileSystem.file (plistPath).createSync (recursive: true );
800
- }),
801
- exportArchiveCommand (exportOptionsPlist: _exportOptionsPlist),
802
- ]);
803
-
804
- createMinimalMockProjectFiles ();
805
-
806
- plistUtils.fileContents[plistPath] = < String ,String > {
807
- 'CFBundleIdentifier' : 'io.flutter.someProject' ,
808
- 'CFBundleDisplayName' : 'Awesome Gallery' ,
809
- 'MinimumOSVersion' : '11.0' ,
810
- 'CFBundleVersion' : '666' ,
811
- 'CFBundleShortVersionString' : '12.34.56' ,
812
- };
813
-
814
- final BuildCommand command = BuildCommand ();
815
- await createTestCommandRunner (command).run (
816
- < String > ['build' , 'ipa' , '--no-pub' ]);
817
-
818
- expect (
819
- testLogger.statusText,
820
- contains (
821
- '┌─ App Settings ────────────────────────────┐\n '
822
- '│ Version Number: 12.34.56 │\n '
823
- '│ Build Number: 666 │\n '
824
- '│ Display Name: Awesome Gallery │\n '
825
- '│ Deployment Target: 11.0 │\n '
826
- '│ Bundle Identifier: io.flutter.someProject │\n '
827
- '└───────────────────────────────────────────┘\n '
828
- )
829
- );
830
- }, overrides: < Type , Generator > {
831
- FileSystem : () => fileSystem,
832
- ProcessManager : () => fakeProcessManager,
833
- Platform : () => macosPlatform,
834
- XcodeProjectInterpreter : () => FakeXcodeProjectInterpreterWithBuildSettings (),
835
- PlistParser : () => plistUtils,
836
- });
837
-
838
738
}
839
739
840
740
const String _xcBundleFilePath = '/.tmp_rand0/flutter_ios_build_temp_dirrand0/temporary_xcresult_bundle' ;
0 commit comments