Merge pull request #25917 from neikeq/zz

Mono: Get rid of irrelevant error and fix export template build errors
This commit is contained in:
Ignacio Etcheverry 2019-02-15 20:08:41 +01:00 committed by GitHub
commit f5477ee36f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 14 deletions

View File

@ -99,7 +99,6 @@ public:
String sln_filepath; String sln_filepath;
String csproj_filepath; String csproj_filepath;
String data_mono_bin_dir;
String data_editor_tools_dir; String data_editor_tools_dir;
String data_editor_prebuilt_api_dir; String data_editor_prebuilt_api_dir;
#endif #endif
@ -107,6 +106,10 @@ public:
String data_mono_etc_dir; String data_mono_etc_dir;
String data_mono_lib_dir; String data_mono_lib_dir;
#ifdef WINDOWS_ENABLED
String data_mono_bin_dir;
#endif
private: private:
_GodotSharpDirs() { _GodotSharpDirs() {
res_data_dir = "res://.mono"; res_data_dir = "res://.mono";
@ -146,10 +149,13 @@ private:
data_editor_prebuilt_api_dir = data_dir_root.plus_file("Api"); data_editor_prebuilt_api_dir = data_dir_root.plus_file("Api");
String data_mono_root_dir = data_dir_root.plus_file("Mono"); String data_mono_root_dir = data_dir_root.plus_file("Mono");
data_mono_bin_dir = data_mono_root_dir.plus_file("bin");
data_mono_etc_dir = data_mono_root_dir.plus_file("etc"); data_mono_etc_dir = data_mono_root_dir.plus_file("etc");
data_mono_lib_dir = data_mono_root_dir.plus_file("lib"); data_mono_lib_dir = data_mono_root_dir.plus_file("lib");
#ifdef WINDOWS_ENABLED
data_mono_bin_dir = data_mono_root_dir.plus_file("bin");
#endif
#ifdef OSX_ENABLED #ifdef OSX_ENABLED
if (!DirAccess::exists(data_editor_tools_dir)) { if (!DirAccess::exists(data_editor_tools_dir)) {
data_editor_tools_dir = exe_dir.plus_file("../Frameworks/GodotSharp/Tools"); data_editor_tools_dir = exe_dir.plus_file("../Frameworks/GodotSharp/Tools");
@ -160,7 +166,6 @@ private:
} }
if (!DirAccess::exists(data_mono_root_dir)) { if (!DirAccess::exists(data_mono_root_dir)) {
data_mono_bin_dir = exe_dir.plus_file("../Frameworks/GodotSharp/Mono/bin");
data_mono_etc_dir = exe_dir.plus_file("../Resources/GodotSharp/Mono/etc"); data_mono_etc_dir = exe_dir.plus_file("../Resources/GodotSharp/Mono/etc");
data_mono_lib_dir = exe_dir.plus_file("../Frameworks/GodotSharp/Mono/lib"); data_mono_lib_dir = exe_dir.plus_file("../Frameworks/GodotSharp/Mono/lib");
} }
@ -178,6 +183,10 @@ private:
data_mono_etc_dir = data_mono_root_dir.plus_file("etc"); data_mono_etc_dir = data_mono_root_dir.plus_file("etc");
data_mono_lib_dir = data_mono_root_dir.plus_file("lib"); data_mono_lib_dir = data_mono_root_dir.plus_file("lib");
#ifdef WINDOWS_ENABLED
data_mono_bin_dir = data_mono_root_dir.plus_file("bin");
#endif
#ifdef OSX_ENABLED #ifdef OSX_ENABLED
if (!DirAccess::exists(data_mono_root_dir)) { if (!DirAccess::exists(data_mono_root_dir)) {
data_mono_etc_dir = exe_dir.plus_file("../Resources/GodotSharp/Mono/etc"); data_mono_etc_dir = exe_dir.plus_file("../Resources/GodotSharp/Mono/etc");
@ -251,10 +260,6 @@ String get_project_csproj_path() {
return _GodotSharpDirs::get_singleton().csproj_filepath; return _GodotSharpDirs::get_singleton().csproj_filepath;
} }
String get_data_mono_bin_dir() {
return _GodotSharpDirs::get_singleton().data_mono_bin_dir;
}
String get_data_editor_tools_dir() { String get_data_editor_tools_dir() {
return _GodotSharpDirs::get_singleton().data_editor_tools_dir; return _GodotSharpDirs::get_singleton().data_editor_tools_dir;
} }
@ -272,4 +277,10 @@ String get_data_mono_lib_dir() {
return _GodotSharpDirs::get_singleton().data_mono_lib_dir; return _GodotSharpDirs::get_singleton().data_mono_lib_dir;
} }
#ifdef WINDOWS_ENABLED
String get_data_mono_bin_dir() {
return _GodotSharpDirs::get_singleton().data_mono_bin_dir;
}
#endif
} // namespace GodotSharpDirs } // namespace GodotSharpDirs

View File

@ -53,7 +53,6 @@ String get_build_logs_dir();
String get_project_sln_path(); String get_project_sln_path();
String get_project_csproj_path(); String get_project_csproj_path();
String get_data_mono_bin_dir();
String get_data_editor_tools_dir(); String get_data_editor_tools_dir();
String get_data_editor_prebuilt_api_dir(); String get_data_editor_prebuilt_api_dir();
#endif #endif
@ -61,6 +60,10 @@ String get_data_editor_prebuilt_api_dir();
String get_data_mono_etc_dir(); String get_data_mono_etc_dir();
String get_data_mono_lib_dir(); String get_data_mono_lib_dir();
#ifdef WINDOWS_ENABLED
String get_data_mono_bin_dir();
#endif
} // namespace GodotSharpDirs } // namespace GodotSharpDirs
#endif // GODOTSHARP_DIRS_H #endif // GODOTSHARP_DIRS_H

View File

@ -157,7 +157,17 @@ void GDMono::add_mono_shared_libs_dir_to_path() {
path_value += ';'; path_value += ';';
String bundled_bin_dir = GodotSharpDirs::get_data_mono_bin_dir(); String bundled_bin_dir = GodotSharpDirs::get_data_mono_bin_dir();
path_value += DirAccess::exists(bundled_bin_dir) ? bundled_bin_dir : mono_reg_info.bin_dir; #ifdef TOOLS_ENABLED
if (DirAccess::exists(bundled_bin_dir)) {
path_value += bundled_bin_dir;
} else {
path_value += mono_reg_info.bin_dir;
}
#else
if (DirAccess::exists(bundled_bin_dir))
path_value += bundled_bin_dir;
#endif // TOOLS_ENABLED
#else #else
path_value += ':'; path_value += ':';
@ -167,10 +177,10 @@ void GDMono::add_mono_shared_libs_dir_to_path() {
} else { } else {
// TODO: Do we need to add the lib dir when using the system installed Mono on Unix platforms? // TODO: Do we need to add the lib dir when using the system installed Mono on Unix platforms?
} }
#endif #endif // WINDOWS_ENABLED
OS::get_singleton()->set_environment(path_var, path_value); OS::get_singleton()->set_environment(path_var, path_value);
#endif #endif // WINDOWS_ENABLED || UNIX_ENABLED
} }
void GDMono::initialize() { void GDMono::initialize() {
@ -231,11 +241,21 @@ void GDMono::initialize() {
assembly_rootdir = bundled_assembly_rootdir; assembly_rootdir = bundled_assembly_rootdir;
config_dir = bundled_config_dir; config_dir = bundled_config_dir;
} }
#ifdef WINDOWS_ENABLED
if (assembly_rootdir.empty() || config_dir.empty()) {
// Assertion: if they are not set, then they weren't found in the registry
CRASH_COND(mono_reg_info.assembly_dir.length() > 0 || mono_reg_info.config_dir.length() > 0);
ERR_PRINT("Cannot find Mono in the registry");
}
#endif // WINDOWS_ENABLED
#else #else
// These are always the directories in export templates // These are always the directories in export templates
assembly_rootdir = bundled_assembly_rootdir; assembly_rootdir = bundled_assembly_rootdir;
config_dir = bundled_config_dir; config_dir = bundled_config_dir;
#endif #endif // TOOLS_ENABLED
// Leak if we call mono_set_dirs more than once // Leak if we call mono_set_dirs more than once
mono_set_dirs(assembly_rootdir.length() ? assembly_rootdir.utf8().get_data() : NULL, mono_set_dirs(assembly_rootdir.length() ? assembly_rootdir.utf8().get_data() : NULL,

View File

@ -158,8 +158,6 @@ MonoRegInfo find_mono() {
if (_find_mono_in_reg_old("Software\\Novell\\Mono", info) == ERROR_SUCCESS) if (_find_mono_in_reg_old("Software\\Novell\\Mono", info) == ERROR_SUCCESS)
return info; return info;
ERR_PRINT("Cannot find mono in the registry");
return MonoRegInfo(); return MonoRegInfo();
} }