Merge pull request #12364 from neikeq/o

Mono: Fix and cleanup build start errors
This commit is contained in:
Ignacio Etcheverry 2017-10-24 01:17:36 +02:00 committed by GitHub
commit a897f7f606
3 changed files with 28 additions and 19 deletions

View File

@ -395,10 +395,11 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
} }
if (!exited) { if (!exited) {
ERR_PRINT("BuildProcess::start called, but process still running");
exited = true; exited = true;
build_tab->on_build_exec_failed("!exited"); String message = "Tried to start build process, but it is already running";
return; build_tab->on_build_exec_failed(message);
ERR_EXPLAIN(message);
ERR_FAIL();
} }
exited = false; exited = false;
@ -410,10 +411,12 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
if (d->file_exists(issues_file)) { if (d->file_exists(issues_file)) {
Error err = d->remove(issues_file); Error err = d->remove(issues_file);
if (err != OK) { if (err != OK) {
ERR_PRINTS("Cannot remove file: " + logs_dir.plus_file(issues_file));
exited = true; exited = true;
build_tab->on_build_exec_failed("Cannot remove file: " + issues_file); String file_path = ProjectSettings::get_singleton()->localize_path(logs_dir).plus_file(issues_file);
return; String message = "Cannot remove issues file: " + file_path;
build_tab->on_build_exec_failed(message);
ERR_EXPLAIN(message);
ERR_FAIL();
} }
} }
@ -434,7 +437,9 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
if (ex) { if (ex) {
exited = true; exited = true;
build_tab->on_build_exec_failed("The build constructor threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex)); String message = "The build constructor threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex);
build_tab->on_build_exec_failed(message);
ERR_EXPLAIN(message);
ERR_FAIL(); ERR_FAIL();
} }
@ -452,7 +457,9 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
if (ex) { if (ex) {
exited = true; exited = true;
build_tab->on_build_exec_failed("The build method threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex)); String message = "The build method threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex);
build_tab->on_build_exec_failed(message);
ERR_EXPLAIN(message);
ERR_FAIL(); ERR_FAIL();
} }

View File

@ -280,7 +280,11 @@ void MonoBuildTab::_update_issues_list() {
String tooltip; String tooltip;
tooltip += String("Message: ") + issue.message; tooltip += String("Message: ") + issue.message;
tooltip += String("\nCode: ") + issue.code;
if (issue.code.length()) {
tooltip += String("\nCode: ") + issue.code;
}
tooltip += String("\nType: ") + (issue.warning ? "warning" : "error"); tooltip += String("\nType: ") + (issue.warning ? "warning" : "error");
String text; String text;
@ -356,23 +360,21 @@ void MonoBuildTab::on_build_exit(BuildResult result) {
MonoBottomPanel::get_singleton()->raise_build_tab(this); MonoBottomPanel::get_singleton()->raise_build_tab(this);
} }
void MonoBuildTab::on_build_exec_failed(const String &p_cause, const String &p_detailed) { void MonoBuildTab::on_build_exec_failed(const String &p_cause) {
build_exited = true; build_exited = true;
build_result = RESULT_ERROR; build_result = RESULT_ERROR;
issues_list->clear(); issues_list->clear();
String tooltip; BuildIssue issue;
issue.message = p_cause;
issue.warning = false;
tooltip += "Message: " + (p_detailed.length() ? p_detailed : p_cause); error_count += 1;
tooltip += "\nType: error"; issues.push_back(issue);
int line_break_idx = p_cause.find("\n"); _update_issues_list();
issues_list->add_item(line_break_idx == -1 ? p_cause : p_cause.substr(0, line_break_idx),
get_icon("Error", "EditorIcons"));
int index = issues_list->get_item_count() - 1;
issues_list->set_item_tooltip(index, tooltip);
MonoBottomPanel::get_singleton()->raise_build_tab(this); MonoBottomPanel::get_singleton()->raise_build_tab(this);
} }

View File

@ -134,7 +134,7 @@ public:
void on_build_start(); void on_build_start();
void on_build_exit(BuildResult result); void on_build_exit(BuildResult result);
void on_build_exec_failed(const String &p_cause, const String &p_detailed = String()); void on_build_exec_failed(const String &p_cause);
void restart_build(); void restart_build();
void stop_build(); void stop_build();