Skip to content

Cargo feature to exclude deprecated GDExtension APIs #1208

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

Closed
wants to merge 1 commit into from

Conversation

beicause
Copy link

This allows using gdext with godot built with deprecated=no.

@Bromeon
Copy link
Member

Bromeon commented Jun 18, 2025

Thanks for your contribution.
Please provide a motivation for your pull request, in particular:

  1. Why the status quo is problematic and how the change benefits the user
  2. What it means for the long-term maintenance of the library
  3. How we can test this, including in CI

@Bromeon Bromeon added feature Adds functionality to the library c: tooling CI, automation, tools labels Jun 18, 2025
@Bromeon Bromeon changed the title Don't use deprecated methods and add no-deprecated feature Cargo feature to exclude deprecated GDExtension APIs Jun 18, 2025
@GodotRust
Copy link

API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-1208

@beicause
Copy link
Author

I think rather than having gdext support this, I'd prefer not to use deprecated=no. It's not easy to test, and even in Godot or godot-cpp, the deprecated=no build can sometimes be broken in master branch .

@beicause beicause closed this Jun 19, 2025
@Bromeon
Copy link
Member

Bromeon commented Jun 19, 2025

I think rather than having gdext support this, I'd prefer not to use deprecated=no. It's not easy to test, and even in Godot or godot-cpp, the deprecated=no build can sometimes be broken in master branch .

Yes, that's kind of my fear as well -- and if we support the Cargo feature, we're responsible for it to work. That means we have to check it in CI with a new Godot build (no-deprecated), and hunt down upstream issues related to it. I'm not sure I'm willing to commit that effort given that very few people benefit from this.

Our current policy is also that we don't support Godot versions with custom build flags, see book. However, we support api-custom and api-custom-json features for anyone who uses custom versions, so it should still be possible for someone using a no-deprecated Godot build to combine it with godot-rust. It might be that godot-rust still uses deprecated functions in a few places, but those can then be brought up in a pull request, like you did here 🙂


In that light, some parts of this PR are still valuable, namely using more modern equivalents of deprecated functions where possible:

  • classdb_construct_object -> classdb_construct_object2
    • appears 3 times, could be extracted into 1 function
  • get_godot_version -> get_godot_version2
  • string_new_with_utf8_chars_and_len -> string_new_with_utf8_chars_and_len2

Are you interested in reopening the PR and limit it to just those changes?

@beicause
Copy link
Author

classdb_construct_object -> classdb_construct_object2

I found it's not as simple as a direct replacement. It seems to be related to godotengine/godot#91018. I need to have a deeper look to solve it. I would appreciate it if you could give me a hint.

get_godot_version -> get_godot_version2

get_godot_version2 is added in 4.5, but 4.5.stable has not been released yet.

string_new_with_utf8_chars_and_len -> string_new_with_utf8_chars_and_len2

This should be a direct replacement. string_new_with_utf8_chars_and_len2 is just changed to return Error instead of void.

@beicause beicause deleted the allow-no-deprecated branch June 21, 2025 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: tooling CI, automation, tools feature Adds functionality to the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants