godotengine / godot

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

Using the new `--import` parameter in combination with `--build-solutions` or `--headless` shows still plugin loading errors #92833

Open MikeSchulze opened 5 months ago

MikeSchulze commented 5 months ago

Tested versions

v4.2.2.stable.mono.official [15073afe3]

System information

Windows

Issue description

I tested the new --import option to remove the Godot cache rebuild hack. But it shows still the same plugin loading errors when using in combination with --build-solutions $GODOT_BIN --path ./ --import --build-solutions --headless

Godot Engine v4.2.2.stable.mono.official.15073afe3 - https://godotengine.org

WARNING: Custom cursor shape not supported by this display server.
     at: cursor_set_custom_image (servers/display_server.cpp:505)
WARNING: Blend file import is enabled in the project settings, but no Blender path is configured in the editor settings. Blend files will not be imported.
     at: _editor_init (modules/gltf/register_types.cpp:63)
SCRIPT ERROR: Parse Error: Identifier "GdUnitSettings" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:21)
SCRIPT ERROR: Parse Error: Identifier "GdUnitSettings" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:31)
SCRIPT ERROR: Parse Error: Identifier "GdUnit4CSharpApiLoader" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:34)
SCRIPT ERROR: Parse Error: Identifier "GdUnit4CSharpApiLoader" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:35)
SCRIPT ERROR: Parse Error: Identifier "GodotVersionFixures" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:46)
ERROR: Failed to load script "res://addons/gdUnit4/plugin.gd" with error "Parse error".
   at: load (modules/gdscript/gdscript.cpp:2726)
SCRIPT ERROR: Parse Error: Identifier "GdUnitSettings" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:21)
SCRIPT ERROR: Parse Error: Identifier "GdUnitSettings" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:31)
SCRIPT ERROR: Parse Error: Identifier "GdUnit4CSharpApiLoader" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:34)
SCRIPT ERROR: Parse Error: Identifier "GdUnit4CSharpApiLoader" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:35)
SCRIPT ERROR: Parse Error: Identifier "GodotVersionFixures" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:46)
ERROR: Failed to load script "res://addons/gdUnit4/plugin.gd" with error "Parse error".
   at: load (modules/gdscript/gdscript.cpp:2726)
ERROR: Missing required editor-specific import metadata for a texture (please reimport it using the 'Import' tab): 'res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.editor.meta'
   at: (editor/import/resource_importer_texture.cpp:413)
ERROR: Condition "!EditorSettings::get_singleton() || !EditorSettings::get_singleton()->has_setting(p_setting)" is true. Returning: Variant()
   at: _EDITOR_GET (editor/editor_settings.cpp:1144)

Using the options in separate calls works without showing any errors.

 $GODOT_BIN --path ./ --import --headless
Godot Engine v4.2.2.stable.mono.official.15073afe3 - https://godotengine.org
Loading GdUnit4 Plugin success
Unload GdUnit4 Plugin success

 $GODOT_BIN --path ./ --build-solutions --headless
Godot Engine v4.2.2.stable.mono.official.15073afe3 - https://godotengine.org
Loading GdUnit4 Plugin success

And both option do loading the plugins, but it should only reimport resources or compile the c# classes. More critical is the usage of --build-solutions --headless it runs editor forever and needs to be manually killed. From the documentation:

--build-solutions Build the scripting solutions (e.g. for C# projects). Implies --editor and requires a valid project to edit.

It is not a build only it runs the editor too.

Steps to reproduce

run this command

 rm -rf .godot
 $GODOT_BIN --path ./ --import --build-solutions --headless

The editor finally hangs, I would expect the process to do only reimport and compile the c# classes. Even if it is expected that with --build-solutions the editor started it produces the errors and makes --import useless

 rm -rf .godot
 $GODOT_BIN --path ./ --import --build-solutions

 Godot Engine v4.2.2.stable.mono.official.15073afe3 - https://godotengine.org
Vulkan API 1.3.260 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 4070 Ti

WARNING: Blend file import is enabled in the project settings, but no Blender path is configured in the editor settings. Blend files will not be imported.
     at: _editor_init (modules/gltf/register_types.cpp:63)
SCRIPT ERROR: Parse Error: Identifier "GdUnitSettings" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:21)
SCRIPT ERROR: Parse Error: Identifier "GdUnitSettings" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:31)
SCRIPT ERROR: Parse Error: Identifier "GdUnit4CSharpApiLoader" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:34)
SCRIPT ERROR: Parse Error: Identifier "GdUnit4CSharpApiLoader" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:35)
SCRIPT ERROR: Parse Error: Identifier "GodotVersionFixures" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:46)
ERROR: Failed to load script "res://addons/gdUnit4/plugin.gd" with error "Parse error".
   at: load (modules/gdscript/gdscript.cpp:2726)
SCRIPT ERROR: Parse Error: Identifier "GdUnitSettings" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:21)
SCRIPT ERROR: Parse Error: Identifier "GdUnitSettings" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:31)
SCRIPT ERROR: Parse Error: Identifier "GdUnit4CSharpApiLoader" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:34)
SCRIPT ERROR: Parse Error: Identifier "GdUnit4CSharpApiLoader" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:35)
SCRIPT ERROR: Parse Error: Identifier "GodotVersionFixures" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:46)
ERROR: Failed to load script "res://addons/gdUnit4/plugin.gd" with error "Parse error".
   at: load (modules/gdscript/gdscript.cpp:2726)
ERROR: Missing required editor-specific import metadata for a texture (please reimport it using the 'Import' tab): 'res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.editor.meta'
   at: (editor/import/resource_importer_texture.cpp:413)
ERROR: Condition "!EditorSettings::get_singleton() || !EditorSettings::get_singleton()->has_setting(p_setting)" is true. Returning: Variant()
   at: _EDITOR_GET (editor/editor_settings.cpp:1144)

at least using --import --headless shows also the errors

$GODOT_BIN --path ./ --import --headless
Godot Engine v4.2.2.stable.mono.official.15073afe3 - https://godotengine.org

plugin cmd args ["--editor"]
It was recognized that GdUnit4 is running in a test environment, therefore the GdUnit4 plugin will not be activated!
plugin cmd args ["--editor"]
WARNING: Custom cursor shape not supported by this display server.
     at: cursor_set_custom_image (servers/display_server.cpp:505)
WARNING: Blend file import is enabled in the project settings, but no Blender path is configured in the editor settings. Blend files will not be imported.
     at: _editor_init (modules/gltf/register_types.cpp:63)
SCRIPT ERROR: Parse Error: Identifier "GdUnitSettings" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:21)
SCRIPT ERROR: Parse Error: Identifier "GdUnitSettings" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:31)
SCRIPT ERROR: Parse Error: Identifier "GdUnit4CSharpApiLoader" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:34)
SCRIPT ERROR: Parse Error: Identifier "GdUnit4CSharpApiLoader" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:35)
SCRIPT ERROR: Parse Error: Identifier "GodotVersionFixures" not declared in the current scope.
          at: GDScript::reload (res://addons/gdUnit4/plugin.gd:46)
ERROR: Failed to load script "res://addons/gdUnit4/plugin.gd" with error "Parse error".
   at: load (modules/gdscript/gdscript.cpp:2726)
ERROR: Missing required editor-specific import metadata for a texture (please reimport it using the 'Import' tab): 'res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.editor.meta'
   at: (editor/import/resource_importer_texture.cpp:413)
ERROR: Condition "!EditorSettings::get_singleton() || !EditorSettings::get_singleton()->has_setting(p_setting)" is true. Returning: Variant()
   at: _EDITOR_GET (editor/editor_settings.cpp:1144)

Minimal reproduction project (MRP)

n/a

Hilderin commented 5 months ago

After some testing, I was able to reproduce this problem. Just delete the .godot folder and execute the command line: --path ./ --import --build-solutions --headless

MRP project: TestGodotImportBuildCommandLine.zip

I'm pretty certain that the problem is caused by the fact that the global_script_class_cache.cfg file does not exist so global classes are not loaded when trying to import and compile all in one shot.

I tried the same project and command line with the fix from #92303 it worked perfectly.

MikeSchulze commented 5 months ago

@Hilderin thanks for the feedback 👍

DanielKinsman commented 3 months ago

I get the same behaviour with the plain gdscript version and the godot-jolt add on installed, it hangs forever the first time.

It also doesn't matter if I use godot --headless --editor --quit or godot --headless --import, same behaviour.

Hilderin commented 3 months ago

I tested on 4.3 master branch and I'm able to reproduce the problem with a bare project with only one scene and the godot-jolt addon.

I also tested the same project with the PR #93972 and removing the .godot folder and the command line does not hang anymore. I tested --headless --editor --quit and --headless --import on Windows 11 with the console.exe.

MRP (I removed the android and ios library of jolt to fit in a zip less then 25mo): test-godot-jolt-addon.zip