bevy_sprite_animation icon indicating copy to clipboard operation
bevy_sprite_animation copied to clipboard

Build Fails with default features disabled

Open juniperparsnips opened this issue 1 year ago • 2 comments

The build errors come in a few varieties:

  • Attempt to use optional dependency (usually ron or serde)
    • Default code depends on ron and serde
  • If the ron feature is disabled but the crate is still provided
    • seems to be a few small syntax things that never got updated
  • Not conditionally adding impls for traits functions/structs that are feature gated

I've tried to include an example of each below:

Importing optional dependency:

error[E0433]: failed to resolve: use of undeclared crate or module `ron`
 --> src\error.rs:3:5
  |
3 | use ron::error::Position;
  |     ^^^ use of undeclared crate or module `ron`

error[E0432]: unresolved import `crate::error::LoadError`
 --> src\nodes\variable_node.rs:1:5
  |
1 | use crate::error::LoadError;
  |     ^^^^^^^^^^^^^^^^^^^^^^^ no `LoadError` in `error`

Non-conditional implementation:

error[E0407]: method `serialize` is not a member of trait `AnimationNodeTrait`
   --> src\nodes\script_node.rs:147:5
    |
147 | /     fn serialize(
148 | |         &self,
149 | |         data: &mut String,
150 | |         _: &AssetServer,
...   |
168 | |         Ok(())
169 | |     }
    | |_____^ not a member of trait `AnimationNodeTrait`

error: cannot find macro `warn` in this scope
   --> src\nodes\script_node.rs:483:21
    |
483 |                     warn!("using ron(_) without ron feature enabled\n");
    |                     ^^^^
    |
    = help: consider importing one of these items:
            bevy::log::warn
            crate::warn
    = note: `warn` is in scope, but it is an attribute: `#[warn]`

juniperparsnips avatar Aug 01 '23 22:08 juniperparsnips

ok thanks ill look into fixing this, it was a bit of a rush job, is there a way to make tests for things like feature not enabled

PhaestusFox avatar Aug 03 '23 09:08 PhaestusFox

I'm not quite sure, but usually testing no features, default features, and all features should cover most cases. If you really want to test for all subsets of features it probably wouldn't be too bad to make a CI script to parse the cargo.toml and build for each subset

juniperparsnips avatar Aug 04 '23 00:08 juniperparsnips