22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
44
5- // @dart = 2.8
6-
75import 'package:file_testing/file_testing.dart' ;
86import 'package:flutter_tools/src/base/file_system.dart' ;
97import 'package:flutter_tools/src/base/io.dart' ;
@@ -15,11 +13,12 @@ import '../src/darwin_common.dart';
1513
1614void main () {
1715 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;
2322
2423 setUpAll (() {
2524 flutterRoot = getFlutterRoot ();
@@ -30,6 +29,29 @@ void main() {
3029 'flutter' ,
3130 );
3231
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+
3355 // Test a plugin example app to allow plugins validation.
3456 processManager.runSync (< String > [
3557 flutterBin,
@@ -47,22 +69,24 @@ void main() {
4769 });
4870
4971 tearDownAll (() {
72+ tryToDelete (hiddenFile);
5073 tryToDelete (tempDir);
5174 });
5275
5376 for (final BuildMode buildMode in < BuildMode > [BuildMode .debug, BuildMode .release]) {
5477 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;
6387
6488 setUpAll (() {
65- processManager.runSync (< String > [
89+ buildResult = processManager.runSync (< String > [
6690 flutterBin,
6791 ...getLocalEngineArguments (),
6892 'build' ,
@@ -94,6 +118,11 @@ void main() {
94118 });
95119
96120 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+
97126 expect (outputPluginFrameworkBinary, exists);
98127
99128 expect (outputAppFrameworkBinary, exists);
0 commit comments