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