@@ -277,17 +277,46 @@ Future<XcodeBuildResult> buildXcodeProject({
277277 );
278278 }
279279
280+ final Status cleanStatus =
281+ logger.startProgress ('Running Xcode clean...' , expectSlowOperation: true );
282+ final RunResult cleanResult = await runAsync (
283+ < String > [
284+ '/usr/bin/env' ,
285+ 'xcrun' ,
286+ 'xcodebuild' ,
287+ 'clean' ,
288+ '-configuration' , configuration,
289+ ],
290+ workingDirectory: app.appDirectory,
291+ );
292+ cleanStatus.stop ();
293+ if (cleanResult.exitCode != 0 ) {
294+ throwToolExit ('Xcode failed to clean\n ${cleanResult .stderr }' );
295+ }
296+
280297 final List <String > commands = < String > [
281298 '/usr/bin/env' ,
282299 'xcrun' ,
283300 'xcodebuild' ,
284- 'clean' ,
285301 'build' ,
286302 '-configuration' , configuration,
287303 'ONLY_ACTIVE_ARCH=YES' ,
288304 ];
289305
306+ <<<<<< < HEAD
290307 if (developmentTeam != null ) {
308+ ====== =
309+ if (logger.isVerbose) {
310+ // An environment variable to be passed to xcode_backend.sh determining
311+ // whether to echo back executed commands.
312+ commands.add ('VERBOSE_SCRIPT_LOGGING=YES' );
313+ } else {
314+ // This will print warnings and errors only.
315+ commands.add ('-quiet' );
316+ }
317+
318+ if (developmentTeam != null )
319+ >>>>>> > Revert "Revert " Reduce xcodebuild noise #2 " (#14641)"
291320 commands.add ('DEVELOPMENT_TEAM=$developmentTeam ' );
292321 commands.add ('-allowProvisioningUpdates' );
293322 commands.add ('-allowProvisioningDeviceRegistration' );
@@ -321,27 +350,28 @@ Future<XcodeBuildResult> buildXcodeProject({
321350 );
322351 }
323352
324- final Status status = logger.startProgress ('Running Xcode build...' , expectSlowOperation: true );
325- final RunResult result = await runAsync (
353+ final Status buildStatus =
354+ logger.startProgress ('Running Xcode build...' , expectSlowOperation: true );
355+ final RunResult buildResult = await runAsync (
326356 commands,
327357 workingDirectory: app.appDirectory,
328358 allowReentrantFlutter: true
329359 );
330- status .stop ();
331- if (result .exitCode != 0 ) {
360+ buildStatus .stop ();
361+ if (buildResult .exitCode != 0 ) {
332362 printStatus ('Failed to build iOS app' );
333- if (result .stderr.isNotEmpty) {
363+ if (buildResult .stderr.isNotEmpty) {
334364 printStatus ('Error output from Xcode build:\n ↳' );
335- printStatus (result .stderr, indent: 4 );
365+ printStatus (buildResult .stderr, indent: 4 );
336366 }
337- if (result .stdout.isNotEmpty) {
367+ if (buildResult .stdout.isNotEmpty) {
338368 printStatus ('Xcode\' s output:\n ↳' );
339- printStatus (result .stdout, indent: 4 );
369+ printStatus (buildResult .stdout, indent: 4 );
340370 }
341371 return new XcodeBuildResult (
342372 success: false ,
343- stdout: result .stdout,
344- stderr: result .stderr,
373+ stdout: buildResult .stdout,
374+ stderr: buildResult .stderr,
345375 xcodeBuildExecution: new XcodeBuildExecution (
346376 commands,
347377 app.appDirectory,
@@ -351,7 +381,7 @@ Future<XcodeBuildResult> buildXcodeProject({
351381 } else {
352382 // Look for 'clean build/<configuration>-<sdk>/Runner.app'.
353383 final RegExp regexp = new RegExp (r' clean (.*\.app)$' , multiLine: true );
354- final Match match = regexp.firstMatch (result .stdout);
384+ final Match match = regexp.firstMatch (buildResult .stdout);
355385 String outputDir;
356386 if (match != null ) {
357387 final String actualOutputDir = match.group (1 ).replaceAll ('\\ ' , ' ' );
0 commit comments