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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature flag for custom Godot version #833

Merged
merged 6 commits into from Jan 1, 2022

Conversation

Bromeon
Copy link
Member

@Bromeon Bromeon commented Dec 20, 2021

Enables the use of custom Godot builds in a straightforward way.
This includes older versions such as Godot 3.2, for which api.json is no longer shipped along.

Previous process (see also book):

  • create a local copy of godot-rust
  • Run godot --gdnative-generate-json-api
  • replace api.json inside gdnative-binding

New process:

  • enable feature custom-godot
  • make sure godot executable is in path OR set GODOT_BIN env var
  • done

This supersedes the previous bindings feature, which is now removed.

I also added CI support for previous Godot version 3.3.1, so far only for integration tests. Originally I wanted to use Godot 3.2 (the oldest supported version), however godotengine/godot#36582 prevented headless versions from generating api.json reliably without crashing. This has been fixed for versions >= 3.3.1.

There is still testing to be done; feedback is always appreciated! 馃檪

Closes #640. Thanks for the great ideas in that issue.

@Bromeon Bromeon added feature Adds functionality to the library c: bindings Component: GDNative bindings (mod api) c: tools Component: tooling, tests, IDEs, Cargo, Rust ecosystem c: ci Component: CI and automation labels Dec 20, 2021
@Bromeon Bromeon added this to the v0.10.0 milestone Dec 20, 2021
The main use case was to support custom versions of Godot through a convoluted build process.
With the new feature 'custom-godot', the user can directly generate bindings from a Godot version of choice.
However, godot-rust is not designed to be used without the GDNative API, so there is not much point in keeping that feature.
@Bromeon
Copy link
Member Author

Bromeon commented Dec 21, 2021

bors try

bors bot added a commit that referenced this pull request Dec 21, 2021
@bors
Copy link
Contributor

bors bot commented Dec 21, 2021

try

Build succeeded:

Copy link
Contributor

@jacobsky jacobsky left a comment

Choose a reason for hiding this comment

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

It looks good to me! I like that you also took the time to make things a bit more consistent with the flags whatever the "a-b-c" format is for the flags.

More in line with the package names. User-facing existing ones on 'gdnative' are not affected.
Reason: --features on a workspace level is not supported before.
Further complicating CI scripts, while we already have Rust 1.57, is questionable.

Also removes the custom-built clamp(), which was introduced as f32::clamp() in Rust 1.50.
@Bromeon
Copy link
Member Author

Bromeon commented Jan 1, 2022

bors r+

@bors
Copy link
Contributor

bors bot commented Jan 1, 2022

Build succeeded!

And happy new year! 馃帀

@bors bors bot merged commit 66b2dd7 into godot-rust:master Jan 1, 2022
@Bromeon Bromeon deleted the feature/custom-godot branch January 1, 2022 10:54
bors bot added a commit that referenced this pull request Jan 1, 2022
839: Fix regression in sync-doc CI job r=Bromeon a=Bromeon

Fixes a small regression introduced during #833 (commit 1e907a2), regarding expansion of environment variables in the job that auto-publishes documentation.

Also slightly improves the crate-level docs.

bors r+

Co-authored-by: Jan Haller <bromeon@gmail.com>
bors bot added a commit that referenced this pull request Jan 1, 2022
839: Fix regression in sync-doc CI job r=Bromeon a=Bromeon

Fixes a small regression introduced during #833 (commit 1e907a2), regarding expansion of environment variables in the job that auto-publishes documentation.

Also slightly improves the crate-level docs.

bors r+

Co-authored-by: Jan Haller <bromeon@gmail.com>
bors bot added a commit that referenced this pull request Jan 8, 2022
838: Godot version check + workaround for API generation bug r=Bromeon a=Bromeon

As mentioned in #833, Godot versions < 3.3.1 were subject to [a bug](godotengine/godot#48081) that caused non-deterministic crashes during the command:
```
godot --gdnative-generate-json-api api.json
```

For users working with affected Godot versions (e.g. 3.2), this makes the feature flag `custom-godot` annoying to use, since they can't rely on the API generation to succeed -- let alone use it for automation/CI. This PR works around that by retrying the command up to 10 times (magic number). I changed the minimum supported Godot version in our own CI again to 3.2, meaning that if it _doesn't_ work, we have to suffer, too 馃槵

Additionally, this PR parses the Godot version and emits a meaningful error message if an unsupported version is detected (3.1 or 4.0).

Co-authored-by: Jan Haller <bromeon@gmail.com>
bors bot added a commit that referenced this pull request Jan 8, 2022
838: Godot version check + workaround for API generation bug r=Bromeon a=Bromeon

As mentioned in #833, Godot versions < 3.3.1 were subject to [a bug](godotengine/godot#48081) that caused non-deterministic crashes during the command:
```
godot --gdnative-generate-json-api api.json
```

For users working with affected Godot versions (e.g. 3.2), this makes the feature flag `custom-godot` annoying to use, since they can't rely on the API generation to succeed -- let alone use it for automation/CI. This PR works around that by retrying the command up to 10 times (magic number). I changed the minimum supported Godot version in our own CI again to 3.2, meaning that if it _doesn't_ work, we have to suffer, too 馃槵

Additionally, this PR parses the Godot version and emits a meaningful error message if an unsupported version is detected (3.1 or 4.0).

Co-authored-by: Jan Haller <bromeon@gmail.com>
@parasyte parasyte mentioned this pull request Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: bindings Component: GDNative bindings (mod api) c: ci Component: CI and automation c: tools Component: tooling, tests, IDEs, Cargo, Rust ecosystem feature Adds functionality to the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Discussion] Simplify custom bindings generation for custom builds
2 participants