Skip to content
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

Fix custom callable no longer working on latest Godot master #465

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

lilizoey
Copy link
Member

Makes GDExtensionCallableCustomInfo use object_id instead of object.

Also adds a use-latest-preview-build feature since beta 3 was released yesterday so it's likely gonna be a week or two until the latest preview build actually has this commit included in it. So now if people wanna run gdext with beta 3 they can just add the use-latest-preview-build feature.

Ideally we'd have a CI set up to run integration tests using this feature on the latest preview build. But im not familiar enough with all the CI to set that up.

@GodotRust
Copy link

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

Copy link
Member

@Bromeon Bromeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I just did the same thing 😅 (before I triggered the nightly rebuild, after godotengine/godot#83800 was merged today)

But since you opened a PR, I'll merge this 🙂


Also adds a use-latest-preview-build feature since beta 3 was released yesterday so it's likely gonna be a week or two until the latest preview build actually has this commit included in it. So now if people wanna run gdext with beta 3 they can just add the use-latest-preview-build feature.

Per our compatibility guidelines, we do not officially maintain compatibility with preview builds:

We do not invest effort in maintaining compatibility with:

  1. Godot in-development versions, except for the latest master branch.
  2. Non-stable releases (alpha, beta, RC).

The conditional compilation is already complex enough to handle for multiple minor versions, and will only grow more complex over time (at least if we commit to supporting older versions). Also, this feature may be correct today but would instantly become obsolete on the next preview release, meaning we have to take immediate action again just to keep things working.

I think it's a fair trade-off to:

  • either expect users who need absolute cutting edge versions to use nightly Godot (we even build the artifacts for them), or recompile Godot themselves;
  • or, let users stay with a gdext version + Godot preview/stable builds for some time.

But providing the option to combine the two at any point in time comes at a high cost, given that dev builds are allowed to introduce breaking changes.

I know that 4.1 -> 4.2 is a huge jump because several major bugs were fixed and hot reloading is now supported. In general, I expect updates to be a bit less dramatic though, which would also mean there's less urge to use the latest version.

Comment on lines +14 to +17
codegen-lazy-fptrs = [
"godot-ffi/codegen-lazy-fptrs",
"godot-codegen/codegen-lazy-fptrs",
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this formatting changed by some tool?

Asking because we don't usually do this (see other lines in this file) 🙂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i can probably disable my formatter and save it as it was but still

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, which one do you use? Not that my CLion TOML plugin un-formats it again 😬

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think the change is fine, we'll see if my formatter will be happy with it 🙂

Comment on lines 56 to 71
#[cfg(since_api = "4.2")]
fn default_callable_custom_info() -> sys::GDExtensionCallableCustomInfo {
sys::GDExtensionCallableCustomInfo {
callable_userdata: ptr::null_mut(),
token: ptr::null_mut(),
// TODO: Remove when 4.2 beta 3 is no longer the latest preview build
#[cfg(feature = "use-latest-preview-build")]
object: ptr::null_mut(),
#[cfg(not(feature = "use-latest-preview-build"))]
object_id: 0,
call_func: None,
is_valid_func: None, // could be customized, but no real use case yet.
free_func: None,
hash_func: None,
equal_func: None,
// Op < is only used in niche scenarios and default is usually good enough, see https://github.com/godotengine/godot/issues/81901.
less_than_func: None,
to_string_func: None,
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactoring! 👍

@Bromeon Bromeon added the c: core Core components label Oct 25, 2023
Make `Callable` work with beta 2 under `use-latest-preview-build` feature
@Bromeon Bromeon added quality-of-life No new functionality, but improves ergonomics/internals status: upstream Depending on upstream fix (typically Godot) labels Oct 25, 2023
@lilizoey lilizoey force-pushed the fix/use-latest-preview-build branch from b7f5b02 to 79ed1bb Compare October 25, 2023 12:38
@Bromeon Bromeon removed the status: upstream Depending on upstream fix (typically Godot) label Oct 25, 2023
Comment on lines +14 to +17
codegen-lazy-fptrs = [
"godot-ffi/codegen-lazy-fptrs",
"godot-codegen/codegen-lazy-fptrs",
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think the change is fine, we'll see if my formatter will be happy with it 🙂

@Bromeon Bromeon added this pull request to the merge queue Oct 25, 2023
@Bromeon
Copy link
Member

Bromeon commented Oct 25, 2023

Re categorization: I was a bit unsure whether to mark this as bug or not. On one hand it no longer works with latest Godot (i.e. broken), on the other hand it's just an in-dev API change that needs to be followed, not an error on anyone's side. You saw also my indecisiveness regarding status: upstream 😁

Ultimately the main purpose of labels is to find things efficiently, and when looking for bug, I expect issues that were mistakes or broken behavior. So I think labeling small changes like this as quality-of-life is acceptable.

Merged via the queue into godot-rust:master with commit e6debc9 Oct 25, 2023
15 checks passed
@lilizoey lilizoey deleted the fix/use-latest-preview-build branch October 25, 2023 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: core Core components quality-of-life No new functionality, but improves ergonomics/internals
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants