2
2
// Use of this source code is governed by a BSD-style license that can be
3
3
// found in the LICENSE file.
4
4
5
- // @dart = 2.8
6
-
7
5
import 'package:file_testing/file_testing.dart' ;
8
6
import 'package:flutter_tools/src/base/file_system.dart' ;
9
7
import 'package:flutter_tools/src/base/io.dart' ;
@@ -15,11 +13,12 @@ import '../src/darwin_common.dart';
15
13
16
14
void main () {
17
15
group ('iOS app validation' , () {
18
- String flutterRoot;
19
- Directory pluginRoot;
20
- String projectRoot;
21
- String flutterBin;
22
- Directory tempDir;
16
+ late String flutterRoot;
17
+ late Directory pluginRoot;
18
+ late String projectRoot;
19
+ late String flutterBin;
20
+ late Directory tempDir;
21
+ late File hiddenFile;
23
22
24
23
setUpAll (() {
25
24
flutterRoot = getFlutterRoot ();
@@ -30,6 +29,29 @@ void main() {
30
29
'flutter' ,
31
30
);
32
31
32
+ final Directory xcframeworkArtifact = fileSystem.directory (
33
+ fileSystem.path.join (
34
+ flutterRoot,
35
+ 'bin' ,
36
+ 'cache' ,
37
+ 'artifacts' ,
38
+ 'engine' ,
39
+ 'ios' ,
40
+ 'Flutter.xcframework' ,
41
+ ),
42
+ );
43
+
44
+ // Pre-cache iOS engine Flutter.xcframework artifacts.
45
+ processManager.runSync (< String > [
46
+ flutterBin,
47
+ ...getLocalEngineArguments (),
48
+ 'precache' ,
49
+ '--ios' ,
50
+ ], workingDirectory: tempDir.path);
51
+
52
+ // Pretend the SDK was on an external drive with stray "._" files in the xcframework
53
+ hiddenFile = xcframeworkArtifact.childFile ('._Info.plist' )..createSync ();
54
+
33
55
// Test a plugin example app to allow plugins validation.
34
56
processManager.runSync (< String > [
35
57
flutterBin,
@@ -47,22 +69,24 @@ void main() {
47
69
});
48
70
49
71
tearDownAll (() {
72
+ tryToDelete (hiddenFile);
50
73
tryToDelete (tempDir);
51
74
});
52
75
53
76
for (final BuildMode buildMode in < BuildMode > [BuildMode .debug, BuildMode .release]) {
54
77
group ('build in ${buildMode .name } mode' , () {
55
- Directory buildPath;
56
- Directory outputApp;
57
- Directory frameworkDirectory;
58
- Directory outputFlutterFramework;
59
- File outputFlutterFrameworkBinary;
60
- Directory outputAppFramework;
61
- File outputAppFrameworkBinary;
62
- File outputPluginFrameworkBinary;
78
+ late Directory buildPath;
79
+ late Directory outputApp;
80
+ late Directory frameworkDirectory;
81
+ late Directory outputFlutterFramework;
82
+ late File outputFlutterFrameworkBinary;
83
+ late Directory outputAppFramework;
84
+ late File outputAppFrameworkBinary;
85
+ late File outputPluginFrameworkBinary;
86
+ late ProcessResult buildResult;
63
87
64
88
setUpAll (() {
65
- processManager.runSync (< String > [
89
+ buildResult = processManager.runSync (< String > [
66
90
flutterBin,
67
91
...getLocalEngineArguments (),
68
92
'build' ,
@@ -94,6 +118,11 @@ void main() {
94
118
});
95
119
96
120
testWithoutContext ('flutter build ios builds a valid app' , () {
121
+ printOnFailure ('Output of flutter build ios:' );
122
+ printOnFailure (buildResult.stdout.toString ());
123
+ printOnFailure (buildResult.stderr.toString ());
124
+ expect (buildResult.exitCode, 0 );
125
+
97
126
expect (outputPluginFrameworkBinary, exists);
98
127
99
128
expect (outputAppFrameworkBinary, exists);
0 commit comments