Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Patching multiple versions of a package in a workspace
I am struggling to understand how to best handle this situation:
I have a monorepo that pulls in multiple different SQL libraries through transitive dependencies.
libsqlite3-sys@^0.35.0
.libsqlite3-sys@^0.30.1
libsqlite-sys@^0.31.0
via rusqliteThese are all carat dependencies but since these are 0.x
dependencies, they're incompatible.
When the repo only has 2 conflicting versions, I am able to work around this with the semver trick mentioned here, where you declare an alias for the crate at a version that forwards all exported symbols at the crate level (pub use libsqlite3_sys::*
) in my case.
I don't see a way to set multiple overrides for different versions of a package in my workspace's [patch]
section, though.
[patch.crates-io]
libsqlite3-sys = { path = "crates/semver-trick/libsqlite3-sys@0.30.1", version = "0.30.1" }
# this isn't legal toml, right?
libsqlite3-sys = { path = "crates/semver-trick/libsqlite3-sys@0.31.0", version = "0.31.0" }
From the rust book It seems like the proposed solution is to rename the dependency. But when I don't directly control those packages, I'm not able to redirect them to the new package.
The only workaround I can think of is vendoring and updating sqlx/sea-orm/rusqlite directly. Which seems like a huge maintenance pain. Is there a more elegant solution? Or is this just a edge case pain point in large rust workspaces that hasn't been addressed?
1 post - 1 participant
🏷️ Rust_feed