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

Prebuilt Godot artifacts #211

Merged
merged 10 commits into from Apr 2, 2023
Merged

Prebuilt Godot artifacts #211

merged 10 commits into from Apr 2, 2023

Conversation

Bromeon
Copy link
Member

@Bromeon Bromeon commented Apr 1, 2023

Closes #12
Closes #107

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:

  1. Significantly fewer dependencies, as bindgen is no longer needed, and thus smaller compile times.
  2. Most CI jobs no longer need the Godot binary (clippy, test), speeding up CI in addition to (1).
  3. It's possible to change the Godot API behind gdext without manually rebuilding the artifacts.
  4. 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).

…ivate)

Rename opaque pointer types to highlight their private nature.
Needs an update in packed_array.rs because it accidentally uses private implementation details.
Also update artifacts repo + branch version to "4.0.1"
…ic analysis)

A directory /.generated in the repo root seems to _mostly_ work, but on CLion it needs an extra "Cargo sync" in fresh/cleaned projects.
This creates extra friction that a crate-local `gen` directory doesn't have. Maybe reconsider this once IDEs handle things better.
@Bromeon Bromeon added quality-of-life No new functionality, but improves ergonomics/internals c: tooling CI, automation, tools labels Apr 1, 2023
@Bromeon Bromeon changed the title Prebuild Godot artifacts Prebuilt Godot artifacts Apr 1, 2023
@Bromeon
Copy link
Member Author

Bromeon commented Apr 1, 2023

bors try

bors bot added a commit that referenced this pull request Apr 1, 2023
@bors
Copy link
Contributor

bors bot commented Apr 1, 2023

try

Build failed:

@Bromeon
Copy link
Member Author

Bromeon commented Apr 1, 2023

bors try

bors bot added a commit that referenced this pull request Apr 1, 2023
@bors
Copy link
Contributor

bors bot commented Apr 1, 2023

try

Build succeeded:

@Bromeon
Copy link
Member Author

Bromeon commented Apr 2, 2023

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 2, 2023

Build succeeded:

  • full-ci

@bors bors bot merged commit e0d45a3 into master Apr 2, 2023
5 checks passed
@bors bors bot deleted the feature/reuse-artifacts branch April 2, 2023 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: tooling CI, automation, tools quality-of-life No new functionality, but improves ergonomics/internals
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Godot compatibility guidelines Pre-generate bindgen file
1 participant