Skip to content

Support for a workspace that uses Cargo.toml files as the source of truth #5

@joneshf

Description

@joneshf

I'm having some troubles with a Cargo workspace that uses Cargo.toml files as the source of truth. Gazelle will generate third-party dependencies fine. But, I can't seem to get Gazelle to automatically generate the deps attributes properly for other workspace members.

Let's say I have a some Cargo.tomls like this:

# Cargo.toml
[workspace]
members = ["foo", "bar"]
resolver = "2"
# foo/Cargo.toml
[package]
name = "foo"
version = "0.1.0"
edition = "2021"

[dependencies]
bar = { version = "0.1.0", path = "../bar" }
# bar/Cargo.toml
[package]
name = "bar"
version = "0.1.0"
edition = "2021"

[dependencies]

And I import bar in foo:

// foo/src/lib.rs

use bar::*;

Whenever I run Gazelle, it does not find the dependency for bar:

$ bazel run //:gazelle
<snip>
gazelle: @test_workspace//foo/src:lib: no match for bar

I'm not 100% sure I've got the workspace setup properly. As mentioned, Gazelle can find third-party dependencies alright (I use things like clap and tracing in the actual workspace). But, that might be handled differently from first-party dependencies.

Looking at the examples/tests, nothing seems to use Cargo.toml files as the source of truth with gazelle_rust. Is it that this use case hasn't been fleshed out yet? If not, any thoughts on what the issue could be?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions