Skip to content

Commit d3d10b5

Browse files
committed
Merge pull request godotengine#90422 from bruvzg/net_no_native_embed
[.NET] Disable output embedding on macOS, move it to the advanced options on other platforms.
2 parents 78fade3 + bf558ad commit d3d10b5

File tree

8 files changed

+42
-116
lines changed

8 files changed

+42
-116
lines changed

modules/mono/csharp_script.cpp

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -410,115 +410,6 @@ ScriptLanguage::ScriptNameCasing CSharpLanguage::preferred_file_name_casing() co
410410
}
411411

412412
#ifdef TOOLS_ENABLED
413-
struct VariantCsName {
414-
Variant::Type variant_type;
415-
const String cs_type;
416-
};
417-
418-
static String variant_type_to_managed_name(const String &p_var_type_name) {
419-
if (p_var_type_name.is_empty()) {
420-
return "Variant";
421-
}
422-
423-
if (ClassDB::class_exists(p_var_type_name)) {
424-
return pascal_to_pascal_case(p_var_type_name);
425-
}
426-
427-
if (p_var_type_name == Variant::get_type_name(Variant::OBJECT)) {
428-
return "GodotObject";
429-
}
430-
431-
if (p_var_type_name == Variant::get_type_name(Variant::INT)) {
432-
return "long";
433-
}
434-
435-
if (p_var_type_name == Variant::get_type_name(Variant::FLOAT)) {
436-
return "double";
437-
}
438-
439-
if (p_var_type_name == Variant::get_type_name(Variant::STRING)) {
440-
return "string"; // I prefer this one >:[
441-
}
442-
443-
if (p_var_type_name == Variant::get_type_name(Variant::DICTIONARY)) {
444-
return "Collections.Dictionary";
445-
}
446-
447-
if (p_var_type_name.begins_with(Variant::get_type_name(Variant::ARRAY) + "[")) {
448-
String element_type = p_var_type_name.trim_prefix(Variant::get_type_name(Variant::ARRAY) + "[").trim_suffix("]");
449-
return "Collections.Array<" + variant_type_to_managed_name(element_type) + ">";
450-
}
451-
452-
if (p_var_type_name == Variant::get_type_name(Variant::ARRAY)) {
453-
return "Collections.Array";
454-
}
455-
456-
if (p_var_type_name == Variant::get_type_name(Variant::PACKED_BYTE_ARRAY)) {
457-
return "byte[]";
458-
}
459-
if (p_var_type_name == Variant::get_type_name(Variant::PACKED_INT32_ARRAY)) {
460-
return "int[]";
461-
}
462-
if (p_var_type_name == Variant::get_type_name(Variant::PACKED_INT64_ARRAY)) {
463-
return "long[]";
464-
}
465-
if (p_var_type_name == Variant::get_type_name(Variant::PACKED_FLOAT32_ARRAY)) {
466-
return "float[]";
467-
}
468-
if (p_var_type_name == Variant::get_type_name(Variant::PACKED_FLOAT64_ARRAY)) {
469-
return "double[]";
470-
}
471-
if (p_var_type_name == Variant::get_type_name(Variant::PACKED_STRING_ARRAY)) {
472-
return "string[]";
473-
}
474-
if (p_var_type_name == Variant::get_type_name(Variant::PACKED_VECTOR2_ARRAY)) {
475-
return "Vector2[]";
476-
}
477-
if (p_var_type_name == Variant::get_type_name(Variant::PACKED_VECTOR3_ARRAY)) {
478-
return "Vector3[]";
479-
}
480-
if (p_var_type_name == Variant::get_type_name(Variant::PACKED_COLOR_ARRAY)) {
481-
return "Color[]";
482-
}
483-
484-
if (p_var_type_name == Variant::get_type_name(Variant::SIGNAL)) {
485-
return "Signal";
486-
}
487-
488-
const VariantCsName var_types[] = {
489-
{ Variant::BOOL, "bool" },
490-
{ Variant::INT, "long" },
491-
{ Variant::VECTOR2, "Vector2" },
492-
{ Variant::VECTOR2I, "Vector2I" },
493-
{ Variant::RECT2, "Rect2" },
494-
{ Variant::RECT2I, "Rect2I" },
495-
{ Variant::VECTOR3, "Vector3" },
496-
{ Variant::VECTOR3I, "Vector3I" },
497-
{ Variant::TRANSFORM2D, "Transform2D" },
498-
{ Variant::VECTOR4, "Vector4" },
499-
{ Variant::VECTOR4I, "Vector4I" },
500-
{ Variant::PLANE, "Plane" },
501-
{ Variant::QUATERNION, "Quaternion" },
502-
{ Variant::AABB, "Aabb" },
503-
{ Variant::BASIS, "Basis" },
504-
{ Variant::TRANSFORM3D, "Transform3D" },
505-
{ Variant::PROJECTION, "Projection" },
506-
{ Variant::COLOR, "Color" },
507-
{ Variant::STRING_NAME, "StringName" },
508-
{ Variant::NODE_PATH, "NodePath" },
509-
{ Variant::RID, "Rid" },
510-
{ Variant::CALLABLE, "Callable" },
511-
};
512-
513-
for (unsigned int i = 0; i < sizeof(var_types) / sizeof(VariantCsName); i++) {
514-
if (p_var_type_name == Variant::get_type_name(var_types[i].variant_type)) {
515-
return var_types[i].cs_type;
516-
}
517-
}
518-
519-
return "Variant";
520-
}
521-
522413
String CSharpLanguage::make_function(const String &, const String &p_name, const PackedStringArray &p_args) const {
523414
// The make_function() API does not work for C# scripts.
524415
// It will always append the generated function at the very end of the script. In C#, it will break compilation by

modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ private void _ExportBeginImpl(string[] features, bool isDebug, string path, long
209209

210210
List<string> outputPaths = new();
211211

212-
bool embedBuildResults = (bool)GetOption("dotnet/embed_build_outputs") || platform == OS.Platforms.Android;
212+
bool embedBuildResults = ((bool)GetOption("dotnet/embed_build_outputs") || platform == OS.Platforms.Android) && platform != OS.Platforms.MacOS;
213213

214214
foreach (PublishConfig config in targets)
215215
{

modules/mono/mono_gd/gd_mono.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ class GDMono {
7777
void _try_load_project_assembly();
7878
#endif
7979

80+
#ifdef DEBUG_METHODS_ENABLED
8081
uint64_t api_core_hash = 0;
82+
#endif
8183
#ifdef TOOLS_ENABLED
8284
uint64_t api_editor_hash = 0;
8385
#endif

platform/android/export/export_plugin.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,6 +1939,12 @@ bool EditorExportPlatformAndroid::get_export_option_visibility(const EditorExpor
19391939
// The APK templates are ignored if Gradle build is enabled.
19401940
return advanced_options_enabled && !bool(p_preset->get("gradle_build/use_gradle_build"));
19411941
}
1942+
1943+
// Hide .NET embedding option (always enabled).
1944+
if (p_option == "dotnet/embed_build_outputs") {
1945+
return false;
1946+
}
1947+
19421948
return true;
19431949
}
19441950

platform/ios/export/export_plugin.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ void EditorExportPlatformIOS::_notification(int p_what) {
135135
}
136136

137137
bool EditorExportPlatformIOS::get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option) const {
138+
// Hide unsupported .NET embedding option.
139+
if (p_option == "dotnet/embed_build_outputs") {
140+
return false;
141+
}
142+
138143
return true;
139144
}
140145

platform/linuxbsd/export/export_plugin.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,19 @@ List<String> EditorExportPlatformLinuxBSD::get_binary_extensions(const Ref<Edito
146146
}
147147

148148
bool EditorExportPlatformLinuxBSD::get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option) const {
149-
if (p_preset) {
150-
// Hide SSH options.
151-
bool ssh = p_preset->get("ssh_remote_deploy/enabled");
152-
if (!ssh && p_option != "ssh_remote_deploy/enabled" && p_option.begins_with("ssh_remote_deploy/")) {
153-
return false;
154-
}
149+
if (p_preset == nullptr) {
150+
return true;
151+
}
152+
153+
bool advanced_options_enabled = p_preset->are_advanced_options_enabled();
154+
155+
// Hide SSH options.
156+
bool ssh = p_preset->get("ssh_remote_deploy/enabled");
157+
if (!ssh && p_option != "ssh_remote_deploy/enabled" && p_option.begins_with("ssh_remote_deploy/")) {
158+
return false;
159+
}
160+
if (p_option == "dotnet/embed_build_outputs") {
161+
return advanced_options_enabled;
155162
}
156163
return true;
157164
}

platform/macos/export/export_plugin.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,12 @@ bool EditorExportPlatformMacOS::get_export_option_visibility(const EditorExportP
333333
return false;
334334
}
335335
}
336+
337+
// Hide unsupported .NET embedding option.
338+
if (p_option == "dotnet/embed_build_outputs") {
339+
return false;
340+
}
341+
336342
return true;
337343
}
338344

platform/windows/export/export_plugin.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,11 +367,17 @@ String EditorExportPlatformWindows::get_export_option_warning(const EditorExport
367367
}
368368

369369
bool EditorExportPlatformWindows::get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option) const {
370+
if (p_preset == nullptr) {
371+
return true;
372+
}
373+
370374
// This option is not supported by "osslsigncode", used on non-Windows host.
371375
if (!OS::get_singleton()->has_feature("windows") && p_option == "codesign/identity_type") {
372376
return false;
373377
}
374378

379+
bool advanced_options_enabled = p_preset->are_advanced_options_enabled();
380+
375381
// Hide codesign.
376382
bool codesign = p_preset->get("codesign/enable");
377383
if (!codesign && p_option != "codesign/enable" && p_option.begins_with("codesign/")) {
@@ -390,6 +396,9 @@ bool EditorExportPlatformWindows::get_export_option_visibility(const EditorExpor
390396
return false;
391397
}
392398

399+
if (p_option == "dotnet/embed_build_outputs") {
400+
return advanced_options_enabled;
401+
}
393402
return true;
394403
}
395404

0 commit comments

Comments
 (0)