godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.14k stars 21.19k forks source link

C# glue code generation ignores disabled modules #77320

Closed bartimaeusnek closed 1 year ago

bartimaeusnek commented 1 year ago

Godot version

809a98216267f3066b9fec2f02b2042bdc9d3e0d

System information

OS: Windows 10 WSL Ubuntu 22.04.2 LTS, CPU: AMD Ryzen 5 5600x, x86_64 architecture

Issue description

When building Godot with i. E. module_multiplayer_enabled=no the C# glue code still generate definitions Godot.MultiplayerApi for it. This also applys to other modules, like XR. I'm cross-compiling for Windows only. I have cleaned my build cache prior to building godot by deleting the /godot-build-scripts/out and /godot-build-scripts/mono-glue folders.

my options in /godot-build-scripts/build-mono-glue:

export OPTIONS="debug_symbols=no use_static_cpp=no production=yes arch=x86_64 dev_build=false optimize=speed lto=full module_openxr_enabled=no module_enet_enabled=no module_mobile_vr_enabled=no module_multiplayer_enabled=no module_websocket_enabled=no module_webxr_enabled=no module_webrtc_enabled=no module_webp_enabled=no module_noise_enabled=no module_mbedtls_enabled=no module_upnp_enabled=no"

my options in /godot-build-scripts/build-windows:

export OPTIONS="production=yes arch=x86_64 dev_build=false optimize=speed lto=full module_openxr_enabled=no module_enet_enabled=no module_mobile_vr_enabled=no module_multiplayer_enabled=no module_websocket_enabled=no module_webxr_enabled=no module_webrtc_enabled=no module_webp_enabled=no module_noise_enabled=no module_mbedtls_enabled=no module_upnp_enabled=no"

Logs: mono-glue.log windows.log

Steps to reproduce

  1. Get a devenv for the build (i used godot-build-scripts)
  2. modify the build command to include module_multiplayer_enabled=no
  3. execute and wait
  4. generate glue code; call godot.editor.mono --headless --generate-mono-glue <path>
  5. mono-glue\GodotSharp\GodotSharp\Generated\GodotObjects already contains multiplayer api (MultiplayerApi.cs) definitions
  6. rebuild with headers
  7. Check the output .nupkg by unzipping the GodotSharp.dll and decompile that with i.E. dotPeek, ILSpy, dnSpy or something similar
  8. youll see the definitions for the multiplayer api (Godot.MultiplayerApi) are still present in the glue code.

Minimal reproduction project

N/A

RedworkDE commented 1 year ago

Can not confirm. When disabling the multiplayer module, classes defined in it will no longer show up in the glue. Notable MultiplayerAPI is defined in core, not the multiplayer module, so its continued existence is expected. Only MultiplayerSpawner, MultiplayerSynchronizer, SceneMultiplayer, SceneReplicationConfig and OfflineMultiplayerPeer are actually defined in the multiplayer module.