gdnative-book icon indicating copy to clipboard operation
gdnative-book copied to clipboard

Provide instructions on how to update `api.json` while using a custom Godot build

Open necrashter opened this issue 1 year ago • 2 comments

In "Using custom builds of Godot" section, the book should provide instructions on how to update the automatically generated api.json file after upgrading the custom build.

I solved this problem by going to ~/.cargo/git/checkouts/godot-rust-1005fa777d499fc2/ and executing

find -name "api.json" -delete

After that, I removed the target folder in my Rust project to trigger a clean build from scratch. Not sure whether this is the best method. Please let me know if there's a better alternative.

necrashter avatar May 19 '23 14:05 necrashter

You should not need to manually delete the api.json.

It's possible that an engine update (change of binary file) is not picked up, but in that case it should suffice to recompile gdnative (cargo clean), which will re-generate the JSON file from the engine binary.

Does this not work in your case?

Bromeon avatar May 19 '23 15:05 Bromeon

I confirm that running cargo clean and cargo build updates the gdnative-bindings/api.json file. Thanks!

However, I still think we should mention this in the book because running cargo build does not detect an engine update if there were no changes in the Rust GDNative library. (I'm using $GODOT_BIN environment variable method if that makes a difference.)

necrashter avatar May 19 '23 15:05 necrashter