@@ -21,7 +21,7 @@ final List<String> flutterTestArgs = <String>[];
21
21
const Map <String , ShardRunner > _kShards = < String , ShardRunner > {
22
22
'tests' : _runTests,
23
23
'tool_tests' : _runToolTests,
24
- 'aot_build_tests ' : _runAotBuildTests ,
24
+ 'build_tests ' : _runBuildTests ,
25
25
'coverage' : _runCoverage,
26
26
};
27
27
@@ -150,25 +150,76 @@ Future<void> _runToolTests() async {
150
150
print ('${bold }DONE: All tests successful.$reset ' );
151
151
}
152
152
153
- /// Verifies that AOT builds of some examples apps finish
154
- /// without crashing. It does not actually launch the AOT-built
155
- /// apps. That happens later in the devicelab. This is just
156
- /// a smoke-test.
157
- Future <void > _runAotBuildTests () async {
158
- await _flutterBuildAot (path.join ('examples' , 'hello_world' ));
159
- await _flutterBuildAot (path.join ('examples' , 'flutter_gallery' ));
160
- await _flutterBuildAot (path.join ('examples' , 'flutter_view' ));
153
+ /// Verifies that AOT, APK, and IPA (if on macOS) builds of some
154
+ /// examples apps finish without crashing. It does not actually
155
+ /// launch the apps. That happens later in the devicelab. This is
156
+ /// just a smoke-test. In particular, this will verify we can build
157
+ /// when there are spaces in the path name for the Flutter SDK and
158
+ /// target app.
159
+ Future <void > _runBuildTests () async {
160
+ final List <String > paths = < String > [
161
+ path.join ('examples' , 'hello_world' ),
162
+ path.join ('examples' , 'flutter_gallery' ),
163
+ path.join ('examples' , 'flutter_view' ),
164
+ ];
165
+ for (String path in paths) {
166
+ await _flutterBuildAot (path);
167
+ await _flutterBuildApk (path);
168
+ await _flutterBuildIpa (path);
169
+ }
170
+
171
+ print ('${bold }DONE: All build tests successful.$reset ' );
172
+ }
173
+
174
+ Future <void > _flutterBuildAot (String relativePathToApplication) async {
175
+ print ('Running AOT build tests...' );
176
+ await runCommand (flutter,
177
+ < String > ['build' , 'aot' , '-v' ],
178
+ workingDirectory: path.join (flutterRoot, relativePathToApplication),
179
+ expectNonZeroExit: false ,
180
+ timeout: _kShortTimeout,
181
+ );
182
+ print ('Done.' );
183
+ }
161
184
162
- print ('${bold }DONE: All AOT build tests successful.$reset ' );
185
+ Future <void > _flutterBuildApk (String relativePathToApplication) async {
186
+ // TODO(dnfield): See if we can get Android SDK on all Cirrus platforms.
187
+ if (Platform .environment['ANDROID_HOME' ]? .isEmpty ?? true ) {
188
+ return ;
189
+ }
190
+ print ('Running APK build tests...' );
191
+ await runCommand (flutter,
192
+ < String > ['build' , 'apk' , '--debug' , '-v' ],
193
+ workingDirectory: path.join (flutterRoot, relativePathToApplication),
194
+ expectNonZeroExit: false ,
195
+ timeout: _kShortTimeout,
196
+ );
197
+ print ('Done.' );
163
198
}
164
199
165
- Future <void > _flutterBuildAot (String relativePathToApplication) {
166
- return runCommand (flutter,
167
- < String > ['build' , 'aot' ],
200
+ Future <void > _flutterBuildIpa (String relativePathToApplication) async {
201
+ if (! Platform .isMacOS) {
202
+ return ;
203
+ }
204
+ print ('Running IPA build tests...' );
205
+ // Install Cocoapods. We don't have these checked in for the examples,
206
+ // and build ios doesn't take care of it automatically.
207
+ final File podfile = File (path.join (flutterRoot, relativePathToApplication, 'ios' , 'Podfile' ));
208
+ if (podfile.existsSync ()) {
209
+ await runCommand ('pod' ,
210
+ < String > ['install' ],
211
+ workingDirectory: podfile.parent.path,
212
+ expectNonZeroExit: false ,
213
+ timeout: _kShortTimeout,
214
+ );
215
+ }
216
+ await runCommand (flutter,
217
+ < String > ['build' , 'ios' , '--no-codesign' , '--debug' , '-v' ],
168
218
workingDirectory: path.join (flutterRoot, relativePathToApplication),
169
219
expectNonZeroExit: false ,
170
220
timeout: _kShortTimeout,
171
221
);
222
+ print ('Done.' );
172
223
}
173
224
174
225
Future <void > _runTests () async {
0 commit comments