summaryrefslogtreecommitdiff
path: root/modules/mono
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mono')
-rw-r--r--modules/mono/csharp_script.cpp11
-rw-r--r--modules/mono/csharp_script.h1
-rw-r--r--modules/mono/editor/bindings_generator.cpp40
-rw-r--r--modules/mono/editor/godotsharp_builds.cpp23
-rw-r--r--modules/mono/editor/mono_bottom_panel.cpp22
-rw-r--r--modules/mono/editor/mono_bottom_panel.h2
6 files changed, 68 insertions, 31 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 7143177c3f..855f7e9670 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -286,11 +286,13 @@ Ref<Script> CSharpLanguage::get_template(const String &p_class_name, const Strin
"// }\n"
"//}\n";
- script_template = script_template.replace("%BASE_CLASS_NAME%", p_base_class_name).replace("%CLASS_NAME%", p_class_name);
+ script_template = script_template.replace("%BASE_CLASS_NAME%", p_base_class_name)
+ .replace("%CLASS_NAME%", p_class_name);
Ref<CSharpScript> script;
script.instance();
script->set_source_code(script_template);
+ script->set_name(p_class_name);
return script;
}
@@ -302,7 +304,12 @@ Script *CSharpLanguage::create_script() const {
bool CSharpLanguage::has_named_classes() const {
- return true;
+ return false;
+}
+
+bool CSharpLanguage::supports_builtin_mode() const {
+
+ return false;
}
static String variant_type_to_managed_name(const String &p_var_type_name) {
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index 6b8475fb61..8700b7fc5c 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -270,6 +270,7 @@ public:
/* TODO */ virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const { return true; }
virtual Script *create_script() const;
virtual bool has_named_classes() const;
+ virtual bool supports_builtin_mode() const;
/* TODO? */ virtual int find_function(const String &p_function, const String &p_code) const { return -1; }
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
/* TODO? */ Error complete_code(const String &p_code, const String &p_base_path, Object *p_owner, List<String> *r_options, String &r_call_hint) { return ERR_UNAVAILABLE; }
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 1d1bcfb03f..6cb4d09a51 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -438,6 +438,9 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_output_dir, bo
return sln_error;
}
+ if (verbose_output)
+ OS::get_singleton()->print("Core API solution and C# project generated successfully!\n");
+
return OK;
}
@@ -530,6 +533,9 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_output_dir,
return sln_error;
}
+ if (verbose_output)
+ OS::get_singleton()->print("Editor API solution and C# project generated successfully!\n");
+
return OK;
}
@@ -1389,13 +1395,20 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) {
cpp_file.push_back(CLOSE_BLOCK "}\n");
- return _save_file(path_join(p_output_dir, "mono_glue.gen.cpp"), cpp_file);
+ Error save_err = _save_file(path_join(p_output_dir, "mono_glue.gen.cpp"), cpp_file);
+ if (save_err != OK)
+ return save_err;
+
+ OS::get_singleton()->print("Mono glue generated successfully!\n");
+
+ return OK;
}
Error BindingsGenerator::_save_file(const String &p_path, const List<String> &p_content) {
FileAccessRef file = FileAccess::open(p_path, FileAccess::WRITE);
+ ERR_EXPLAIN("Cannot open file: " + p_path);
ERR_FAIL_COND_V(!file, ERR_FILE_CANT_WRITE);
for (const List<String>::Element *E = p_content.front(); E; E = E->next()) {
@@ -1471,7 +1484,8 @@ void BindingsGenerator::_populate_object_type_interfaces() {
itype.memory_own = itype.is_reference;
if (!ClassDB::is_class_exposed(type_cname)) {
- WARN_PRINTS("Ignoring type " + String(type_cname) + " because it's not exposed");
+ if (verbose_output)
+ WARN_PRINTS("Ignoring type " + String(type_cname) + " because it's not exposed");
class_list.pop_front();
continue;
}
@@ -1535,9 +1549,11 @@ void BindingsGenerator::_populate_object_type_interfaces() {
// which could actually will return something differnet.
// Let's put this to notify us if that ever happens.
if (itype.name != "Object" || imethod.name != "free") {
- WARN_PRINTS("Notification: New unexpected virtual non-overridable method found.\n"
- "We only expected Object.free, but found " +
- itype.name + "." + imethod.name);
+ if (verbose_output) {
+ WARN_PRINTS("Notification: New unexpected virtual non-overridable method found.\n"
+ "We only expected Object.free, but found " +
+ itype.name + "." + imethod.name);
+ }
}
} else {
ERR_PRINTS("Missing MethodBind for non-virtual method: " + itype.name + "." + imethod.name);
@@ -2043,7 +2059,8 @@ BindingsGenerator::BindingsGenerator() {
void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args) {
- int options_count = 3;
+ const int NUM_OPTIONS = 3;
+ int options_left = NUM_OPTIONS;
String mono_glue_option = "--generate-mono-glue";
String cs_core_api_option = "--generate-cs-core-api";
@@ -2053,7 +2070,7 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args)
const List<String>::Element *elem = p_cmdline_args.front();
- while (elem && options_count) {
+ while (elem && options_left) {
if (elem->get() == mono_glue_option) {
@@ -2066,7 +2083,7 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args)
ERR_PRINTS("--generate-mono-glue: No output directory specified");
}
- --options_count;
+ --options_left;
} else if (elem->get() == cs_core_api_option) {
@@ -2079,7 +2096,7 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args)
ERR_PRINTS(cs_core_api_option + ": No output directory specified");
}
- --options_count;
+ --options_left;
} else if (elem->get() == cs_editor_api_option) {
@@ -2096,13 +2113,16 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args)
ERR_PRINTS(cs_editor_api_option + ": No output directory specified");
}
- --options_count;
+ --options_left;
}
elem = elem->next();
}
verbose_output = false;
+
+ if (options_left != NUM_OPTIONS)
+ exit(0);
}
#endif
diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp
index 1bad8a3f85..d3808769fb 100644
--- a/modules/mono/editor/godotsharp_builds.cpp
+++ b/modules/mono/editor/godotsharp_builds.cpp
@@ -395,10 +395,11 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
}
if (!exited) {
- ERR_PRINT("BuildProcess::start called, but process still running");
exited = true;
- build_tab->on_build_exec_failed("!exited");
- return;
+ String message = "Tried to start build process, but it is already running";
+ build_tab->on_build_exec_failed(message);
+ ERR_EXPLAIN(message);
+ ERR_FAIL();
}
exited = false;
@@ -410,10 +411,12 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
if (d->file_exists(issues_file)) {
Error err = d->remove(issues_file);
if (err != OK) {
- ERR_PRINTS("Cannot remove file: " + logs_dir.plus_file(issues_file));
exited = true;
- build_tab->on_build_exec_failed("Cannot remove file: " + issues_file);
- return;
+ String file_path = ProjectSettings::get_singleton()->localize_path(logs_dir).plus_file(issues_file);
+ 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) {
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();
}
@@ -452,7 +457,9 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
if (ex) {
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();
}
diff --git a/modules/mono/editor/mono_bottom_panel.cpp b/modules/mono/editor/mono_bottom_panel.cpp
index 07109eaac7..8d6a618ee8 100644
--- a/modules/mono/editor/mono_bottom_panel.cpp
+++ b/modules/mono/editor/mono_bottom_panel.cpp
@@ -280,7 +280,11 @@ void MonoBuildTab::_update_issues_list() {
String tooltip;
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");
String text;
@@ -356,23 +360,21 @@ void MonoBuildTab::on_build_exit(BuildResult result) {
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_result = RESULT_ERROR;
issues_list->clear();
- String tooltip;
+ BuildIssue issue;
+ issue.message = p_cause;
+ issue.warning = false;
- tooltip += "Message: " + (p_detailed.length() ? p_detailed : p_cause);
- tooltip += "\nType: error";
+ error_count += 1;
+ issues.push_back(issue);
- int line_break_idx = p_cause.find("\n");
- 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);
+ _update_issues_list();
MonoBottomPanel::get_singleton()->raise_build_tab(this);
}
diff --git a/modules/mono/editor/mono_bottom_panel.h b/modules/mono/editor/mono_bottom_panel.h
index 909fa4b385..83da5b9809 100644
--- a/modules/mono/editor/mono_bottom_panel.h
+++ b/modules/mono/editor/mono_bottom_panel.h
@@ -134,7 +134,7 @@ public:
void on_build_start();
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 stop_build();