Unverified Commit 74ddda51 authored by xster's avatar xster Committed by GitHub

Reduce noise in xcodebuild stdout (#14586)

* Reduce noise in xcodebuild stdout

* Reduce output from cleaning, from non failing xcode outputs and from script

* Check xcodebuild clean's exit code

* Revert "Reduce noise in xcodebuild stdout"

This reverts commit 222a26f55f2a3fc7b115e8a65e55c9be36f241bd.
parent ab4506ca
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
# found in the LICENSE file. # found in the LICENSE file.
RunCommand() { RunCommand() {
echo "♦ $*" if [[ -n "$VERBOSE_SCRIPT_LOGGING" ]]; then
echo "♦ $*"
fi
"$@" "$@"
return $? return $?
} }
......
...@@ -277,16 +277,40 @@ Future<XcodeBuildResult> buildXcodeProject({ ...@@ -277,16 +277,40 @@ Future<XcodeBuildResult> buildXcodeProject({
); );
} }
final Status cleanStatus =
logger.startProgress('Running Xcode clean...', expectSlowOperation: true);
final RunResult cleanResult = await runAsync(
<String>[
'/usr/bin/env',
'xcrun',
'xcodebuild',
'clean',
],
workingDirectory: app.appDirectory,
);
cleanStatus.stop();
if (cleanResult.exitCode != 0) {
throwToolExit('Xcode failed to clean\n${cleanResult.stderr}');
}
final List<String> commands = <String>[ final List<String> commands = <String>[
'/usr/bin/env', '/usr/bin/env',
'xcrun', 'xcrun',
'xcodebuild', 'xcodebuild',
'clean',
'build', 'build',
'-configuration', configuration, '-configuration', configuration,
'ONLY_ACTIVE_ARCH=YES', 'ONLY_ACTIVE_ARCH=YES',
]; ];
if (logger.isVerbose) {
// An environment variable to be passed to xcode_backend.sh determining
// whether to echo back executed commands.
commands.add('VERBOSE_SCRIPT_LOGGING=YES');
} else {
// This will print warnings and errors only.
commands.add('-quiet');
}
if (developmentTeam != null) if (developmentTeam != null)
commands.add('DEVELOPMENT_TEAM=$developmentTeam'); commands.add('DEVELOPMENT_TEAM=$developmentTeam');
...@@ -318,27 +342,28 @@ Future<XcodeBuildResult> buildXcodeProject({ ...@@ -318,27 +342,28 @@ Future<XcodeBuildResult> buildXcodeProject({
); );
} }
final Status status = logger.startProgress('Running Xcode build...', expectSlowOperation: true); final Status buildStatus =
final RunResult result = await runAsync( logger.startProgress('Running Xcode build...', expectSlowOperation: true);
final RunResult buildResult = await runAsync(
commands, commands,
workingDirectory: app.appDirectory, workingDirectory: app.appDirectory,
allowReentrantFlutter: true allowReentrantFlutter: true
); );
status.stop(); buildStatus.stop();
if (result.exitCode != 0) { if (buildResult.exitCode != 0) {
printStatus('Failed to build iOS app'); printStatus('Failed to build iOS app');
if (result.stderr.isNotEmpty) { if (buildResult.stderr.isNotEmpty) {
printStatus('Error output from Xcode build:\n↳'); printStatus('Error output from Xcode build:\n↳');
printStatus(result.stderr, indent: 4); printStatus(buildResult.stderr, indent: 4);
} }
if (result.stdout.isNotEmpty) { if (buildResult.stdout.isNotEmpty) {
printStatus('Xcode\'s output:\n↳'); printStatus('Xcode\'s output:\n↳');
printStatus(result.stdout, indent: 4); printStatus(buildResult.stdout, indent: 4);
} }
return new XcodeBuildResult( return new XcodeBuildResult(
success: false, success: false,
stdout: result.stdout, stdout: buildResult.stdout,
stderr: result.stderr, stderr: buildResult.stderr,
xcodeBuildExecution: new XcodeBuildExecution( xcodeBuildExecution: new XcodeBuildExecution(
commands, commands,
app.appDirectory, app.appDirectory,
...@@ -348,7 +373,7 @@ Future<XcodeBuildResult> buildXcodeProject({ ...@@ -348,7 +373,7 @@ Future<XcodeBuildResult> buildXcodeProject({
} else { } else {
// Look for 'clean build/<configuration>-<sdk>/Runner.app'. // Look for 'clean build/<configuration>-<sdk>/Runner.app'.
final RegExp regexp = new RegExp(r' clean (.*\.app)$', multiLine: true); final RegExp regexp = new RegExp(r' clean (.*\.app)$', multiLine: true);
final Match match = regexp.firstMatch(result.stdout); final Match match = regexp.firstMatch(buildResult.stdout);
String outputDir; String outputDir;
if (match != null) { if (match != null) {
final String actualOutputDir = match.group(1).replaceAll('\\ ', ' '); final String actualOutputDir = match.group(1).replaceAll('\\ ', ' ');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment