Commit 24f63e2b authored by Devon Carew's avatar Devon Carew Committed by GitHub

show better errors for gradle build failures (#5374)

parent 3e27acd7
...@@ -106,8 +106,8 @@ Future<Null> main(List<String> args) async { ...@@ -106,8 +106,8 @@ Future<Null> main(List<String> args) async {
flutterUsage.sendException(error, chain); flutterUsage.sendException(error, chain);
if (Platform.environment.containsKey('FLUTTER_DEV') || isRunningOnBot) { if (isRunningOnBot) {
// If we're working on the tools themselves, just print the stack trace. // Print the stack trace on the bots - don't write a crash report.
stderr.writeln('$error'); stderr.writeln('$error');
stderr.writeln(chain.terse.toString()); stderr.writeln(chain.terse.toString());
} else { } else {
......
...@@ -130,15 +130,20 @@ Future<int> buildGradleProject(BuildMode buildMode) async { ...@@ -130,15 +130,20 @@ Future<int> buildGradleProject(BuildMode buildMode) async {
} }
// Run 'gradle wrapper'. // Run 'gradle wrapper'.
Status status = logger.startProgress('Running \'gradle wrapper\'...'); try {
int exitcode = await runCommandAndStreamOutput( Status status = logger.startProgress('Running \'gradle wrapper\'...');
<String>[gradle, 'wrapper'], int exitcode = await runCommandAndStreamOutput(
workingDirectory: 'android', <String>[gradle, 'wrapper'],
allowReentrantFlutter: true workingDirectory: 'android',
); allowReentrantFlutter: true
status.stop(showElapsedTime: true); );
if (exitcode != 0) status.stop(showElapsedTime: true);
return exitcode; if (exitcode != 0)
return exitcode;
} catch (error) {
printError('$error');
return 1;
}
gradlew = locateProjectGradlew(); gradlew = locateProjectGradlew();
if (gradlew == null) { if (gradlew == null) {
......
...@@ -6,6 +6,8 @@ import 'dart:async'; ...@@ -6,6 +6,8 @@ import 'dart:async';
import 'dart:convert' show ASCII; import 'dart:convert' show ASCII;
import 'dart:io'; import 'dart:io';
import 'package:stack_trace/stack_trace.dart';
final AnsiTerminal terminal = new AnsiTerminal(); final AnsiTerminal terminal = new AnsiTerminal();
abstract class Logger { abstract class Logger {
...@@ -55,7 +57,7 @@ class StdoutLogger extends Logger { ...@@ -55,7 +57,7 @@ class StdoutLogger extends Logger {
stderr.writeln(message); stderr.writeln(message);
if (stackTrace != null) if (stackTrace != null)
stderr.writeln(stackTrace); stderr.writeln(new Chain.forTrace(stackTrace).terse.toString());
} }
@override @override
......
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