Open bitwes opened 1 week ago
This is probably bad form but I couldn't think of better way of getting some good eyes on this. Sorry in advance. If I tagged you then you either had issues with .godot/global_script_class_cache.cfg
, CI/CD questions, or maintain a public pipeline that I found.
@Ajver @TheyLok @asciifaceman @Dracks @m21-cerutti @98teg @ngburke @char32 @croconut @ceceppa
Seems interesting but could be more convenient maybe with a folder instead of a list of script paths (I think when you said it could scan the whole projet that's the idea). Also seems to me more a bug about how works Godot in the first place, if the path of global_script_class_cache.cfg change or the format, even the solution of how Godot remember class_name change inside Godot, this script seems to be really easy to turn deprecate.
Here the list of relevant issues in Godot side for the sake of tracking: https://github.com/godotengine/godot/issues/69511 https://github.com/godotengine/godot/issues/72360 https://github.com/godotengine/godot/issues/77478 https://github.com/godotengine/godot/issues/81615 https://github.com/godotengine/godot/issues/82392 https://github.com/godotengine/godot/issues/85467 https://github.com/godotengine/godot/issues/87323 https://github.com/godotengine/godot/issues/92833
Seems also ther is an --import
now that could do the job ?
https://github.com/godotengine/godot/pull/90431
Or even better a fix ?
https://github.com/godotengine/godot/pull/92303
I agree with @m21-cerutti that it will be mutch better to be able to specify the directory to scan, rather than individual files, one by one. For bigger projects there may be a huge amount of scripts with class_name
, that would need to be cached, and it just doesn't scale well. Having a text file with listed directories to the scripts kind of simplifies running the command, but still requires manual update everytime one creates new script with class_name in it.
I also feel like this script is actually a hacky approach to solve godot-typical behavior. We shouldn't consider this as Gut issue (I know that my original issue #589 might have sound like it's gut problem, but turned out to be Godot specific thing).
For now I'm happily using godot --headless --import
in my automated CI build, and I think it's solid way of doing it. It is an extra step, but so is running the updater script.
But I can see one reason to use the standalone updater script: When I run the godot --import
command, it takes quite a while to scan the project (I tested it on fresh clone of Gut repo, without .godot folder) - it took almost a minute to complete on my laptop! Where the updater script takes less than a second to fill the cache file.
This is good feedback. I wasn't sure how well/reliable the godot --headless --import
was working. This is definitely a workaround for Godot behavior and not an issue with GUT. The issue got stuck in my head, so I threw this together.
I'm going to abandon further development for now. I'll leave the branch out there for a bit, just in case something changes. If development continues, I think the addition of scanning directories would be good.
Thanks everyone.
Maybe you can put the script into assets or as an snipped by itself? if it helps to generate this file generating it faster, maybe makes sense to keep it. (only an idea)
I'm looking for feedback on a standalone script I created to generate/update the global script class cache config file that seems to be a point of contention when running tests through a CI/CD pipeline. Any and all feedback is appreciated. I'm not even sure if this is needed, but it felt like it was.
This script is meant to replace having to load the project once
godot --headless --import
or having to have.godot/global_script_class_cache.cfg
under source control.The script takes a list of scripts to create class_name entries for. It will parse all the info to create the entries from the script itself. You just have to tell it which scripts have
class_name
in them. It will then create/update.godot/global_script_class_cache.cfg
without having to load the project.The script knows about all the GUT scripts that need to be added/updated. You only have to add any of your own scripts or the scripts of other plugins.
Maybe later it can just scan the whole project instead of having to be told.
The related code can be found in the (global_class_cache_updater)[https://github.com/bitwes/Gut/tree/global_class_cache_updater] branch.
global_script_class_cache_updater.gd
to parse options. This has been updated frommain
.Script help: