I've got an issue where I want to publish a crate, but I want it to be usable for both the latest release of Bevy, which right now is 0.4 and the latest git version of Bevy ( 0.5, but unreleased ) I tried something like this in my Cargo.toml, but it doesn't like the Git repo dep:
From what I've seen this is impossible because crates.io doesn't tolerate the Git dependency, but I wanted to post here just to make sure nobody has ever managed this first.
Write the dependency normally without the git marker. The users of your crate can then use a [patch.crates-io] section in their Cargo.toml to override your dependency to the git one.
Is there some chance that this might be an XY Problem?
You say you want your published crate...
to be usable for both [versions of bevy]
(my emphasis) Does that imply that bevy will be calling your published crate? In that case is bevy in the Cargo.toml you show above, really more of a dev-dependency? Or is there some other way that you can break the seemingly circular dependency?
@dekellum my crate is a Bevy plugin, so Bevy will be using it, and it will be using Bevy. The user using my crate will have something like this in the Cargo TOML, in the case that they want to use master version of Bevy:
Yes, because I need to use bevy's types and such in the Plugin, for instance I need to implement the BevyPlugin trait.
Maybe it could be split out to an interface, but technically that'd have the same issue, because the interface could still have breaking changes just like the crate itself.
It's fine that they have to do a weird patch thing anyway, I think, because if they are using Bevy from master, they're already going off the beaten road a bit.