From 069af23bdbd2d8b3bca5376c60d654ebf8ec08a3 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Mon, 8 Jul 2019 15:22:51 +0200 Subject: [PATCH] Mono: Fix build errors with tools=no --- modules/mono/csharp_script.cpp | 12 ++++++++++-- modules/mono/csharp_script.h | 4 +++- modules/mono/mono_gd/gd_mono.cpp | 2 ++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 06a5c65d3c3..7492816f186 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -876,13 +876,17 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) { const StringName &class_namespace = script->tied_class_namespace_for_reload; const StringName &class_name = script->tied_class_name_for_reload; GDMonoAssembly *project_assembly = gdmono->get_project_assembly(); - GDMonoAssembly *tools_assembly = gdmono->get_tools_assembly(); // Search in project and tools assemblies first as those are the most likely to have the class GDMonoClass *script_class = (project_assembly ? project_assembly->get_class(class_namespace, class_name) : NULL); + +#ifdef TOOLS_ENABLED if (!script_class) { + GDMonoAssembly *tools_assembly = gdmono->get_tools_assembly(); script_class = (tools_assembly ? tools_assembly->get_class(class_namespace, class_name) : NULL); } +#endif + if (!script_class) { script_class = gdmono->get_class(class_namespace, class_name); } @@ -1202,7 +1206,9 @@ CSharpLanguage::CSharpLanguage() { scripts_metadata_invalidated = true; +#ifdef TOOLS_ENABLED godotsharp_editor = NULL; +#endif } CSharpLanguage::~CSharpLanguage() { @@ -2143,7 +2149,6 @@ void CSharpScript::_update_exports_values(Map &values, List propnames.push_back(E->get()); } } -#endif void CSharpScript::_update_member_info_no_exports() { @@ -2190,6 +2195,7 @@ void CSharpScript::_update_member_info_no_exports() { } } } +#endif bool CSharpScript::_update_exports() { @@ -2743,7 +2749,9 @@ void CSharpScript::initialize_for_managed_type(Ref p_script, GDMon } p_script->load_script_signals(p_script->script_class, p_script->native); +#ifdef TOOLS_ENABLED p_script->_update_member_info_no_exports(); +#endif } bool CSharpScript::can_instance() const { diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index 76c7976285d..eb168f344df 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -121,6 +121,7 @@ class CSharpScript : public Script { bool placeholder_fallback_enabled; bool exports_invalidated; void _update_exports_values(Map &values, List &propnames); + void _update_member_info_no_exports(); virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder); #endif @@ -131,7 +132,6 @@ class CSharpScript : public Script { void load_script_signals(GDMonoClass *p_class, GDMonoClass *p_native_class); bool _get_signal(GDMonoClass *p_class, GDMonoClass *p_delegate, Vector ¶ms); - void _update_member_info_no_exports(); bool _update_exports(); #ifdef TOOLS_ENABLED bool _get_member_export(IMonoClassMember *p_member, bool p_inspect_export, PropertyInfo &r_prop_info, bool &r_exported); @@ -355,7 +355,9 @@ public: _FORCE_INLINE_ static CSharpLanguage *get_singleton() { return singleton; } +#ifdef TOOLS_ENABLED _FORCE_INLINE_ EditorPlugin *get_godotsharp_editor() const { return godotsharp_editor; } +#endif static void release_script_gchandle(Ref &p_gchandle); static void release_script_gchandle(MonoObject *p_expected_obj, Ref &p_gchandle); diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index 5c63359d881..06fbae019ca 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -564,6 +564,7 @@ bool GDMono::_load_corlib_assembly() { return success; } +#ifdef TOOLS_ENABLED static bool copy_api_assembly(const String &p_src_dir, const String &p_dst_dir, const String &p_assembly_name, APIAssembly::Type p_api_type) { // Create destination directory if needed @@ -607,6 +608,7 @@ static bool copy_api_assembly(const String &p_src_dir, const String &p_dst_dir, return true; } +#endif bool GDMono::_load_core_api_assembly() {