I use bevy and I want to use the git version, as there is a bugfix that I need.
The version in git is "0.15.0-dev".
I have "bevy_common_assets" and "bevy_egui" as dependencies, and they both require "0.15.0".
If I just write
bevy = { git = "https://github.com/bevyengine/bevy.git", rev = "ae16a648d7204971c8c2c731fd4cec65785b3ca9" }
I will end up with two separate bevy versions used: "0.15.0" used with "bevy_common_assets" and "0.15.0-dev" for my own code.
I tried overriding it using "patch"
bevy = { version = "0.15", features = [
"webp",
"jpeg",
] }
[patch.crates-io]
bevy = { git = "https://github.com/bevyengine/bevy.git", rev = "ae16a648d7204971c8c2c731fd4cec65785b3ca9" }
But it refuses to use it because in "bevy_common_assets" the requirement is exactly "0.15.0" which does not match "0.15.0-dev"
warning: Patch `bevy v0.15.0-dev (https://github.com/bevyengine/bevy.git?rev=ae16a648d7204971c8c2c731fd4cec65785b3ca9#ae16a648)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
Also, I tried "replace":
[replace]
# temporary switch to github until 0.15.1 is released, fixes bug with 9 slices
"bevy:0.15.0" = { git = "https://github.com/bevyengine/bevy.git", rev = "ae16a648d7204971c8c2c731fd4cec65785b3ca9" }
But this also did not work. As it also requires exact version match.
error: failed to get `bevy` as a dependency
Caused by:
no matching package for override `https://github.com/rust-lang/crates.io-index#bevy@0.15.0` found
location searched: https://github.com/bevyengine/bevy.git?rev=ae16a648d7204971c8c2c731fd4cec65785b3ca9
version required: =0.15.0
I solved this issue for now, but editing version back to 0.15.0 in my fork and using it, but this does not feel right. Also, because bevy actually consists of multiple crates and some dependencies require them directly I had to override it for each sub crate.
[patch.crates-io]
# temporary switch to github until 0.15.1 is released, fixes bug with 9 slices
"bevy" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_a11y" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_app" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_asset" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_derive" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_ecs" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_hierarchy" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_image" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_input" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_log" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_macro_utils" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_math" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_reflect" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_render" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_tasks" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_time" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_utils" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_window" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }
"bevy_winit" = { git = "https://github.com/romamik/bevy.git", rev = "14b0a5311622ef756c0ea24558b14819930a1cb8" }