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

Update Bevy to 0.12 #61

Merged
merged 4 commits into from
Nov 13, 2023
Merged

Update Bevy to 0.12 #61

merged 4 commits into from
Nov 13, 2023

Conversation

sphw
Copy link
Contributor

@sphw sphw commented Nov 6, 2023

This PR updates the core plugin to Bevy 0.12. Some examples are not compiling since they rely on the bevy_spectator plugin, which hasn't been updated yet.

UPDATE: I've now updated bevy_spectator to the latest version, and all the examples seem to build

@VirxEC
Copy link
Contributor

VirxEC commented Nov 11, 2023

This branch works for me on bevy 0.12 👍

Copy link
Collaborator

@Shatur Shatur left a comment

Choose a reason for hiding this comment

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

Left a few suggestions and I will merge it and draft a new release.

src/pipeline.rs Outdated Show resolved Hide resolved
src/skybox.rs Outdated Show resolved Hide resolved
macros/src/model.rs Outdated Show resolved Hide resolved
src/pipeline.rs Outdated Show resolved Hide resolved
@sphw sphw requested a review from Shatur November 13, 2023 17:54
@Shatur
Copy link
Collaborator

Shatur commented Nov 13, 2023

Thanks! But why src/ is necessary? Isn't it /src/ by default?

@sphw
Copy link
Contributor Author

sphw commented Nov 13, 2023

Thanks! But why src/ is necessary? Isn't it /src/ by default?

The root issue is described in this ticket: bevyengine/bevy#10377. Internally embedded_asset calls file!() which if it is in an nested workspace returns something like crate_path/src/foo.rs, but if it is in a normal crate (not in a workspace) it returns src/foo.rs. The default /src/ assumes that the path will always contain that beginning /. My quick workaround was to just use src/.

@Shatur
Copy link
Collaborator

Shatur commented Nov 13, 2023

Oh, I get it, thanks for the explanation!
Could you fix lints and I will merge it?

@Shatur
Copy link
Collaborator

Shatur commented Nov 13, 2023

Thank you a lot!

@Shatur Shatur merged commit 452de2c into JonahPlusPlus:master Nov 13, 2023
4 checks passed
@Shatur
Copy link
Collaborator

Shatur commented Nov 13, 2023

@sphw this is odd, but when I trying cargo publish it fails with the following message:

error: couldn't read /mnt/Files/Code/bevy_atmosphere/target/package/bevy_atmosphere-0.8.0/src/../shaders/nishita.wgsl: No such file or directory (os error 2)
 --> src/collection/nishita.rs:7:10
  |
7 | #[derive(Atmospheric, ShaderType, Reflect, Debug, Clone)]
  |          ^^^^^^^^^^^
  |
  = note: this error originates in the macro `include_str` which comes from the expansion of the derive macro `Atmospheric` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read /mnt/Files/Code/bevy_atmosphere/target/package/bevy_atmosphere-0.8.0/src/../shaders/gradient.wgsl: No such file or directory (os error 2)
 --> src/collection/gradient.rs:7:10
  |
7 | #[derive(Atmospheric, ShaderType, Reflect, Debug, Clone)]
  |          ^^^^^^^^^^^
  |
  = note: this error originates in the macro `include_str` which comes from the expansion of the derive macro `Atmospheric` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `HandleUntyped` in `asset`
 --> src/collection/nishita.rs:7:10
  |
7 | #[derive(Atmospheric, ShaderType, Reflect, Debug, Clone)]
  |          ^^^^^^^^^^^ could not find `HandleUntyped` in `asset`
  |
  = note: this error originates in the derive macro `Atmospheric` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: could not find `HandleUntyped` in `asset`
 --> src/collection/gradient.rs:7:10
  |
7 | #[derive(Atmospheric, ShaderType, Reflect, Debug, Clone)]
  |          ^^^^^^^^^^^ could not find `HandleUntyped` in `asset`
  |
  = note: this error originates in the derive macro `Atmospheric` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `std::option::Option<&str>: From<&BindGroupDescriptor<'_>>` is not satisfied
  --> src/collection/nishita.rs:7:10
   |
7  | #[derive(Atmospheric, ShaderType, Reflect, Debug, Clone)]
   |          ^^^^^^^^^^^ the trait `From<&BindGroupDescriptor<'_>>` is not implemented for `std::option::Option<&str>`
   |
   = help: the following other types implement trait `From<T>`:
             <std::option::Option<Level> as From<LevelFilter>>
             <std::option::Option<bevy::utils::tracing::Id> as From<Span>>
             <std::option::Option<bevy::utils::tracing::Id> as From<tracing_core::span::Current>>
             <std::option::Option<bevy::utils::tracing::Id> as From<&'a Span>>
             <std::option::Option<bevy::utils::tracing::Id> as From<&'a EnteredSpan>>
             <std::option::Option<bevy::utils::tracing::Id> as From<&'a bevy::utils::tracing::Id>>
             <std::option::Option<bevy::utils::tracing::Id> as From<&'a tracing_core::span::Current>>
             <std::option::Option<&'a bevy::utils::tracing::Id> as From<&'a Span>>
           and 7 others
   = note: required for `&BindGroupDescriptor<'_>` to implement `Into<std::option::Option<&str>>`
note: required by a bound in `RenderDevice::create_bind_group`
  --> /home/gena/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.12.0/src/renderer/render_device.rs:89:21
   |
87 |     pub fn create_bind_group<'a>(
   |            ----------------- required by a bound in this associated function
88 |         &self,
89 |         label: impl Into<wgpu::Label<'a>>,
   |                     ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `RenderDevice::create_bind_group`
   = note: this error originates in the derive macro `Atmospheric` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0061]: this method takes 3 arguments but 1 argument was supplied
  --> src/collection/nishita.rs:7:10
   |
7  | #[derive(Atmospheric, ShaderType, Reflect, Debug, Clone)]
   |          ^^^^^^^^^^^ two arguments of type `&BindGroupLayout` and `&[BindGroupEntry<'_>]` are missing
   |
note: method defined here
  --> /home/gena/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.12.0/src/renderer/render_device.rs:87:12
   |
87 |     pub fn create_bind_group<'a>(
   |            ^^^^^^^^^^^^^^^^^
   = note: this error originates in the derive macro `Atmospheric` (in Nightly builds, run with -Z macro-backtrace for more info)
help: provide the arguments
   |
7  | #[derive(Atmospheric(Atmospheric, /* &BindGroupLayout */, /* &[BindGroupEntry<'_>] */), ShaderType, Reflect, Debug, Clone)]
   |                     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

error[E0599]: no associated item named `TYPE_UUID` found for struct `bevy::prelude::Shader` in the current scope
 --> src/collection/nishita.rs:7:10
  |
7 | #[derive(Atmospheric, ShaderType, Reflect, Debug, Clone)]
  |          ^^^^^^^^^^^ associated item not found in `Shader`
  |
  = note: this error originates in the derive macro `Atmospheric` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `std::option::Option<&str>: From<&BindGroupDescriptor<'_>>` is not satisfied
  --> src/collection/gradient.rs:7:10
   |
7  | #[derive(Atmospheric, ShaderType, Reflect, Debug, Clone)]
   |          ^^^^^^^^^^^ the trait `From<&BindGroupDescriptor<'_>>` is not implemented for `std::option::Option<&str>`
   |
   = help: the following other types implement trait `From<T>`:
             <std::option::Option<Level> as From<LevelFilter>>
             <std::option::Option<bevy::utils::tracing::Id> as From<Span>>
             <std::option::Option<bevy::utils::tracing::Id> as From<tracing_core::span::Current>>
             <std::option::Option<bevy::utils::tracing::Id> as From<&'a Span>>
             <std::option::Option<bevy::utils::tracing::Id> as From<&'a EnteredSpan>>
             <std::option::Option<bevy::utils::tracing::Id> as From<&'a bevy::utils::tracing::Id>>
             <std::option::Option<bevy::utils::tracing::Id> as From<&'a tracing_core::span::Current>>
             <std::option::Option<&'a bevy::utils::tracing::Id> as From<&'a Span>>
           and 7 others
   = note: required for `&BindGroupDescriptor<'_>` to implement `Into<std::option::Option<&str>>`
note: required by a bound in `RenderDevice::create_bind_group`
  --> /home/gena/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.12.0/src/renderer/render_device.rs:89:21
   |
87 |     pub fn create_bind_group<'a>(
   |            ----------------- required by a bound in this associated function
88 |         &self,
89 |         label: impl Into<wgpu::Label<'a>>,
   |                     ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `RenderDevice::create_bind_group`
   = note: this error originates in the derive macro `Atmospheric` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0061]: this method takes 3 arguments but 1 argument was supplied
  --> src/collection/gradient.rs:7:10
   |
7  | #[derive(Atmospheric, ShaderType, Reflect, Debug, Clone)]
   |          ^^^^^^^^^^^ two arguments of type `&BindGroupLayout` and `&[BindGroupEntry<'_>]` are missing
   |
note: method defined here
  --> /home/gena/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.12.0/src/renderer/render_device.rs:87:12
   |
87 |     pub fn create_bind_group<'a>(
   |            ^^^^^^^^^^^^^^^^^
   = note: this error originates in the derive macro `Atmospheric` (in Nightly builds, run with -Z macro-backtrace for more info)
help: provide the arguments
   |
7  | #[derive(Atmospheric(Atmospheric, /* &BindGroupLayout */, /* &[BindGroupEntry<'_>] */), ShaderType, Reflect, Debug, Clone)]
   |                     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

error[E0599]: no associated item named `TYPE_UUID` found for struct `bevy::prelude::Shader` in the current scope
 --> src/collection/gradient.rs:7:10
  |
7 | #[derive(Atmospheric, ShaderType, Reflect, Debug, Clone)]
  |          ^^^^^^^^^^^ associated item not found in `Shader`
  |
  = note: this error originates in the derive macro `Atmospheric` (in Nightly builds, run with -Z macro-backtrace for more info)

Some errors have detailed explanations: E0061, E0277, E0433, E0599.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `bevy_atmosphere` (lib) due to 10 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to verify package tarball

Do you have any idea why it might happen?
cargo check --examples works just fine...

@sphw
Copy link
Contributor Author

sphw commented Nov 13, 2023

@sphw this is odd, but when I trying cargo publish it fails with the following message:

I believe this problem is caused by using an outdated version of the derive macro crate. I think you first need to publish the derive macro crate, then bump the version in the primary crate. I've used this tool https://github.com/pksunkara/cargo-workspaces in the past to fix this issue, but that was years ago so I'm not sure it's still the best option.

@Shatur
Copy link
Collaborator

Shatur commented Nov 13, 2023

Oh, right, thank you!
Not the original author, just helping maintain the crate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants