Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.1 Mono Regression - Export via CLI is broken (not saving all required resources) #79159

Closed
DillonSteyl opened this issue Jul 7, 2023 · 13 comments · Fixed by #79173
Closed

Comments

@DillonSteyl
Copy link

Godot version

v4.1.stable.mono

System information

Windows 11

Issue description

The automated build system I set up (via Gitlab CI/CD) for exporting my game is no longer working in 4.1.

The .pck file generated during export is orders of magnitude smaller than I'd expect, and the game doesn't get past the first frame of the splash screen due to the lack of resources. I've noticed the savepack part of the export process seems to skip some steps...

savepack: begin: Packing steps: 102
        savepack: step 2: Storing File: res://build/springdash.ico
        savepack: step 102: Storing File: res://.godot/global_script_class_cache.cfg
        savepack: step 102: Storing File: res://icons/spring_dash.png
        savepack: step 102: Storing File: res://.godot/uid_cache.bin
        savepack: step 102: Storing File: res://project.binary

Exporting through the UI works as expected, but exporting via CLI (e.g. via something like godot4 --export-release windows-64bit export/test.exe) results in the issue described above.

Steps to reproduce

  • Setup a basic project that relies on some resources (e.g. an image) in Godot 4.1 (or use the one provided)
  • Export via the UI and notice that it works
  • Export via the CLI and notice that it doesn't, and the .pck file is either not present or much smaller than expected

Minimal reproduction project

export-cli.zip

@akien-mga
Copy link
Member

Tested locally on Linux with the MRP, it seems to export fine for me:

$ Godot_v4.1-stable_linux.x86_64 --headless --export-release "Windows Desktop" export/test.exe
Godot Engine v4.1.stable.official.970459615 - https://godotengine.org
 
WARNING: Custom cursor shape not supported by this display server.
     at: cursor_set_custom_image (servers/display_server.cpp:480)
reimport: begin: (Re)Importing Assets steps: 2
        reimport: step 1: icon.svg
WARNING: Resources Modification: Could not start rcedit executable. Configure rcedit path in the Editor Settings (Export > Windows > rcedit), or disable "Application > Modify Resources" in the export preset.
     at: add_message (editor/export/editor_export_platform.h:175)
savepack: begin: Packing steps: 102
        savepack: step 2: Storing File: res://.godot/exported/133200997/export-3070c538c03ee49b7677ff960a3f5195-main.scn
        savepack: step 52: Storing File: res://.godot/imported/angry_stoat.png-bfae575bd6d10b21bd2f792e5f0e0912.ctex
        savepack: step 52: Storing File: res://angry_stoat.png.import
        savepack: step 102: Storing File: res://main.tscn.remap
        savepack: step 102: Storing File: res://.godot/global_script_class_cache.cfg
        savepack: step 102: Storing File: res://icon.svg
        savepack: step 102: Storing File: res://.godot/uid_cache.bin
        savepack: step 102: Storing File: res://project.binary
savepack: end
WARNING: Project export for preset "Windows Desktop" completed with warnings.
     at: _fs_changed (editor/editor_node.cpp:1006)
reimport: end
ERROR: 3 RID allocations of type 'N18RendererCanvasCull4ItemE' were leaked at exit.
ERROR: 1 RID allocations of type 'PN13RendererDummy14TextureStorage12DummyTextureE' were leaked at exit.
ERROR: 6 RID allocations of type 'PN18TextServerAdvanced22ShapedTextDataAdvancedE' were leaked at exit.
ERROR: 1 RID allocations of type 'PN18TextServerAdvanced12FontAdvancedE' were leaked at exit.
WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
     at: cleanup (core/object/object.cpp:2045)
ERROR: Resources still in use at exit (run with --verbose for details).
   at: clear (core/io/resource.cpp:489)

The generated .exe and .pck seem to work as expected (I see the angry stoat :)).

@Calinou
Copy link
Member

Calinou commented Jul 7, 2023

@DillonSteyl Can you try the same steps on 4.1 dev/beta/RCs? You can download them here.

@DillonSteyl
Copy link
Author

That's interesting. I managed to get it to work using "Export selected resources (and dependencies)" as the export mode, and selecting all of the resources explicitly.

None of the other export modes I've tried will do it for me when I'm using the CLI, so maybe related to how resources are "discovered"?

@DillonSteyl
Copy link
Author

@akien-mga I can confirm this is only an issue for the MONO version of Godot 4.1. I will update to reflect this

@DillonSteyl DillonSteyl changed the title 4.1 Regression - Export via CLI is broken (not saving all required resources) 4.1 Mono Regression - Export via CLI is broken (not saving all required resources) Jul 7, 2023
@akien-mga
Copy link
Member

CC @godotengine/dotnet

@DillonSteyl
Copy link
Author

DillonSteyl commented Jul 7, 2023

@Calinou The regression was introduced in dev4. Exporting via the CLI works as expected in dev3 and prior.

@YuriSizov
Copy link
Contributor

dev4 only contains one C#/.NET related change of note: #72619

@RedworkDE
Copy link
Member

RedworkDE commented Jul 7, 2023

Reverting that seems to fix the issue, not sure how it is related.
Update: just removing the EditorFileSystem::update() calls also fixes it.

@raulsntos
Copy link
Member

raulsntos commented Jul 7, 2023

Update: just removing the EditorFileSystem::update() calls also fixes it.

That was going to be my guess. The MRP has the export filter EXPORT_SELECTED_SCENES which tries to find the dependencies from the selected scenes using EditorFileSystem, right? If so, maybe updating it causes it to somehow lose knowledge of other files.

But in the .NET module we are only calling EditorFileSystem::update_file with paths to script files (presumably only C# scripts). So I don't understand how this can affect PNG files.

Also, since the MRP doesn't contain a C# project or any C# scripts at all, what is even making those calls to EditorFileSystem::update_file?

@RedworkDE
Copy link
Member

it calls them probably for the editor tools scripts, notably for those scripts get_path() returns an empty string which then presumably breaks things in update_file

@raulsntos
Copy link
Member

I see, we should probably avoid calling it for editor scripts since they are not part of the project. And also, maybe EditorFileSystem::update_file should have ERR_FAIL_COND(p_file.is_empty());.

@RedworkDE
Copy link
Member

I don't think we can (easily) avoid that since this is also part of the initial load and these scripts still need to work like scripts, or the editor just breaks.

@raulsntos
Copy link
Member

I think what you've done in #79173 is good enough, since we only update EFS to update global classes and the only C# scripts that can be global classes must have a path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants