Skip to content

feat(deps): reference git instead of package - #44

Closed
sator-imaging wants to merge 2 commits into
crabtalk:mainfrom
sator-imaging:main
Closed

sator-imaging wants to merge 2 commits into
crabtalk:mainfrom
sator-imaging:main

Conversation

@sator-imaging

@sator-imaging sator-imaging commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

This PR makes GPUI types interchangeable across multiple libraries.

For example, a consumer can use multiple libraries that depend on GPUI while overriding all of their GPUI dependencies to the same fork:

bezel = ...
bezel-editor = ...
other-gpui-lib = ...
gpui          = { git = "https://github.com/crabtalk/zed", version = ">=0.2.2" }
gpui_platform = { git = "https://github.com/crabtalk/zed", version = ">=0.1.0", features = ["font-kit"] }

# Override GPUI references to use the same fork.
[patch.crates-io]
gpui          = { git = "https://github.com/crabtalk/zed", version = ">=0.2.2" }
gpui_platform = { git = "https://github.com/crabtalk/zed", version = ">=0.1.0" }
gpui_web      = { git = "https://github.com/crabtalk/zed", version = ">=0.1.0" }

Problem / Motivation

[patch.crates-io] can override a dependency with another source, but it cannot redirect one crate name to a package with a different name (ex. gpui = { package = "bezel-gpui", ... }). Also, Cargo does not allow multiple patches for the same source with different package names (gpui = { git = SAME } bezel-gpui = { git = SAME }).

As a result, when multiple libraries use different GPUI-compatible crates, there is currently no way for consumers to make their GPUI types interchangeable, even when their APIs are otherwise compatible.

With this PR, a single window can contain controls from multiple libraries.


cargo nextest run is passed.

@cla-bot cla-bot Bot added the cla-signed Contributor has signed the CLA label Sep 24, 2026

@clearloop clearloop left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this will be dangerous and won't work ))

our gpui fork and bezel are being bumped together always, e.g. bezel is the only cause of the version bump of bezel-gpui

if you are working on a fork, the better solution is either merging bezel from the official or do the git dep bump in the fork since most of bezel-gpui version bumps will break the old version of bezel, that's why we publish all of them to crates-io.


The other case would be that bezel is moving fast at 0.1.x, if that affects the downstream heavily atm, I'll do better version control for bezel, e.g. bump the minor version once there are breaking changes always, but I hope we can defer this for maybe one week, since that will slow down my development a lot )))

@sator-imaging

Copy link
Copy Markdown
Contributor Author

I see. Right, the best solution is Cargo supports patching the multiple libraries instead of providing extension point in crate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed Contributor has signed the CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants