Description
I'm trying to use the Godot 4 beta 16 that's currently in nixpkgs. Its godot --version
is 4.0.beta.custom_build
. However, the version regex in godot-codegen
expects a commit hash(?) following the last element if it is not official
:
https://github.com/godot-rust/gdextension/blob/b2f75f8c4b6725c77eccbb7fb637d4570562ed63/godot-codegen/src/godot_version.rs#L33
https://github.com/godot-rust/gdextension/blob/b2f75f8c4b6725c77eccbb7fb637d4570562ed63/godot-codegen/src/godot_version.rs#L80
My guess is that the nixpkgs godot version is not built within its git repo, but instead just within a directory containing all the source files, so there's no commit hash to embed in the version number.
From what I can tell, this is used to determine whether the godot version changed and things need to be regenerated because its API may have changed. While an occasional cargo clean
isn't that bad, allowing custom_build without commit hash may cause hard-to-track-down bugs for people unaware of this mechanic. On the other hand, even checking the commit hash is not sufficient if godot was built from a dirty working tree, though this is probably a fairly rare situation.
One possible solution might be to check a hash of the godot binary instead of or in addition to the version number? The version number would no longer require a commit hash to ensur proper rebuilding. I assume this hash would only be checked when cargo detects that the godot binary has changed thanks to cargo:rerun-if-changed
? This should also work for a custom godot compiled from a dirty working tree.
Another solution would be to somehow patch the nixpkgs godot build to include the commit hash.