// the error reporting below is applied to as much code as possible
CommandLineActionFactory actionFactory = createActionFactory();
Action<ExecutionListener> action = actionFactory.convert(Arrays.asList(args));
action.execute(buildCompleter);
} catch (Throwable e) {
BuildExceptionReporter exceptionReporter = new BuildExceptionReporter(new StreamingStyledTextOutputFactory(System.err), new StartParameter(), new GradleLauncherMetaData());
exceptionReporter.reportException(e);
buildCompleter.onFailure(e);
}
buildCompleter.exit();
}