summaryrefslogtreecommitdiff
path: root/modules/mono/mono_gd
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2019-01-22 18:33:36 +0100
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2019-01-22 18:33:36 +0100
commitbc8b61bb069a9229dbceb61fedb8308c5d1e6a68 (patch)
treedae493d525675a140754ce3b21f9310f8188bb16 /modules/mono/mono_gd
parent077e48977384a1b1c2e527e5df9012b64b56e847 (diff)
Mono: Fix hot reload build errors and cleanup
Diffstat (limited to 'modules/mono/mono_gd')
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp18
-rw-r--r--modules/mono/mono_gd/gd_mono.h4
2 files changed, 18 insertions, 4 deletions
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index 42a6fe1ef8..900caefe1c 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -731,7 +731,9 @@ Error GDMono::_unload_scripts_domain() {
#endif
core_api_assembly_out_of_sync = false;
+#ifdef TOOLS_ENABLED
editor_api_assembly_out_of_sync = false;
+#endif
MonoDomain *domain = scripts_domain;
scripts_domain = NULL;
@@ -764,7 +766,7 @@ Error GDMono::_load_tools_domain() {
}
#endif
-#ifdef TOOLS_ENABLED
+#ifdef GD_MONO_HOT_RELOAD
Error GDMono::reload_scripts_domain() {
ERR_FAIL_COND_V(!runtime_initialized, ERR_BUG);
@@ -785,8 +787,12 @@ Error GDMono::reload_scripts_domain() {
#ifdef MONO_GLUE_ENABLED
if (!_load_api_assemblies()) {
- if ((core_api_assembly && (core_api_assembly_out_of_sync || !GDMonoUtils::mono_cache.godot_api_cache_updated)) ||
- (editor_api_assembly && editor_api_assembly_out_of_sync)) {
+ if ((core_api_assembly && (core_api_assembly_out_of_sync || !GDMonoUtils::mono_cache.godot_api_cache_updated))
+#ifdef TOOLS_ENABLED
+ || (editor_api_assembly && editor_api_assembly_out_of_sync)
+#endif
+ ) {
+#ifdef TOOLS_ENABLED
// The assembly was successfully loaded, but the full api could not be cached.
// This is most likely an outdated assembly loaded because of an invalid version in the
// metadata, so we invalidate the version in the metadata and unload the script domain.
@@ -810,6 +816,10 @@ Error GDMono::reload_scripts_domain() {
}
return ERR_CANT_RESOLVE;
+#else
+ ERR_PRINT("The loaded API assembly is invalid");
+ CRASH_NOW();
+#endif
} else {
return ERR_CANT_OPEN;
}
@@ -924,7 +934,9 @@ GDMono::GDMono() {
#endif
core_api_assembly_out_of_sync = false;
+#ifdef TOOLS_ENABLED
editor_api_assembly_out_of_sync = false;
+#endif
corlib_assembly = NULL;
core_api_assembly = NULL;
diff --git a/modules/mono/mono_gd/gd_mono.h b/modules/mono/mono_gd/gd_mono.h
index 6a00b287b0..13de3061b3 100644
--- a/modules/mono/mono_gd/gd_mono.h
+++ b/modules/mono/mono_gd/gd_mono.h
@@ -95,7 +95,9 @@ class GDMono {
#endif
bool core_api_assembly_out_of_sync;
+#ifdef TOOLS_ENABLED
bool editor_api_assembly_out_of_sync;
+#endif
GDMonoAssembly *corlib_assembly;
GDMonoAssembly *core_api_assembly;
@@ -193,7 +195,7 @@ public:
GDMonoClass *get_class(MonoClass *p_raw_class);
-#ifdef TOOLS_ENABLED
+#ifdef GD_MONO_HOT_RELOAD
Error reload_scripts_domain();
#endif