Prebuilt Godot artifacts by Bromeon · Pull Request #211 · godot-rust/gdext (original) (raw)
From now on, gdext by default fetches pre-generated versions of these files, published in the godot4-prebuilt repo:
extension_api.json
(from Godot binary)gdextension_interface.h
(from Godot binary)gdextension_interface.rs
(through bindgen -- currently supports 3 platforms)
This has several benefits:
- Significantly fewer dependencies, as bindgen is no longer needed, and thus smaller compile times.
- Most CI jobs no longer need the Godot binary (clippy, test), speeding up CI in addition to (1).
- It's possible to change the Godot API behind gdext without manually rebuilding the artifacts.
- Easy comparison between the Godot APIs of different released versions.
Using a custom Godot binary
It is still possible to generate those files locally like before, through the use of the custom-godot
feature on the godot
crate.
This is necessary for any platform/configuration different from the 3 main supported ones (because bindgen generates different Rust bindings), as well as any in-development or modified Godot versions.
Changing the Godot release
By default, the latest Godot release is used as input to gdext. Switching between different Godot versions is easily possible, although a bit cumbersome.
If you want to use an older version 4.0
, add this to your workspace (not sub-crate) Cargo.toml
:
We need to trick Cargo into seeing a different URL; https://github.com/rust-lang/cargo/issues/5478
[patch."https://github.com/godot-rust/godot4-prebuilt"] godot4-prebuilt = { git = "https://github.com//godot-rust/godot4-prebuilt", branch = "4.0"}
We're looking into ways to simplify this. In a crates.io release (#2), we would need to rethink this anyway, mapping Godot versions to Rust release versions (which is not trivial).