@@ -17,6 +17,7 @@ const String _outputDirectoryFlag = 'output-dir';
17
17
18
18
const int _exitUpdateMacosPodfileFailed = 3 ;
19
19
const int _exitUpdateMacosPbxprojFailed = 4 ;
20
+ const int _exitGenNativeBuildFilesFailed = 5 ;
20
21
21
22
/// A command to create an application that builds all in a single application.
22
23
class CreateAllPluginsAppCommand extends PackageCommand {
@@ -66,10 +67,11 @@ class CreateAllPluginsAppCommand extends PackageCommand {
66
67
67
68
await _genPubspecWithAllPlugins ();
68
69
69
- /// Run `flutter pub get` to generate all native build files for macOS.
70
- final int genNativeBuildFilesExitCode = await _genNativeBuildFiles ();
71
- if (genNativeBuildFilesExitCode != 0 ) {
72
- throw ToolExit (genNativeBuildFilesExitCode);
70
+ /// Run `flutter pub get` to generate all native build files.
71
+ final bool didGenNativeBuildFilesSucceed = await _genNativeBuildFiles ();
72
+ if (! didGenNativeBuildFilesSucceed) {
73
+ printError ("Failed to generate native build files via 'flutter pub get'" );
74
+ throw ToolExit (_exitGenNativeBuildFilesFailed);
73
75
}
74
76
75
77
await Future .wait (< Future <void >> [
@@ -272,30 +274,29 @@ dev_dependencies:${_pubspecMapString(pubspec.devDependencies)}
272
274
return buffer.toString ();
273
275
}
274
276
275
- Future <int > _genNativeBuildFiles () async {
276
- final io. ProcessResult result = io. Process . runSync (
277
+ Future <bool > _genNativeBuildFiles () async {
278
+ final int exitCode = await processRunner. runAndStream (
277
279
flutterCommand,
278
280
< String > [
279
281
'pub' ,
280
282
'get' ,
281
283
],
282
- workingDirectory : _appDirectory.path ,
284
+ workingDir : _appDirectory,
283
285
);
284
-
285
- print (result.stdout);
286
- print (result.stderr);
287
- return result.exitCode;
286
+ return exitCode == 0 ;
288
287
}
289
288
290
289
Future <void > _updateMacosPodfile () async {
291
- // Only change the macOS deployment target if the host platform is macOS.
290
+ /// Only change the macOS deployment target if the host platform is macOS.
291
+ /// The Podfile is not generated on other platforms.
292
292
if (! io.Platform .isMacOS) {
293
293
return ;
294
294
}
295
295
296
296
final File podfileFile =
297
297
app.platformDirectory (FlutterPlatform .macos).childFile ('Podfile' );
298
298
if (! podfileFile.existsSync ()) {
299
+ printError ("Can't find Podfile for macOS" );
299
300
throw ToolExit (_exitUpdateMacosPodfileFailed);
300
301
}
301
302
@@ -317,6 +318,7 @@ dev_dependencies:${_pubspecMapString(pubspec.devDependencies)}
317
318
.childDirectory ('Runner.xcodeproj' )
318
319
.childFile ('project.pbxproj' );
319
320
if (! pbxprojFile.existsSync ()) {
321
+ printError ("Can't find project.pbxproj for macOS" );
320
322
throw ToolExit (_exitUpdateMacosPbxprojFailed);
321
323
}
322
324
0 commit comments