Newbie question #1913
Replies: 2 comments 1 reply
-
Bazel doesn't implicitly add dependencies to your BUILD files, you need to tell Bazel that you want your dependencies to be added. There's a macro to request "all dependencies from the adjacent Cargo.toml file" you can use to make this easier. See rules_rust/examples/crate_universe/cargo_local/BUILD.bazel Lines 9 to 10 in 4663ff6 |
Beta Was this translation helpful? Give feedback.
-
Thanks for pointing me. My curious question: What is crate_universe means? I would appreciate if someone who is maintainer of this repo to publish a nice how-to blog post about this. This is an awesome project and rust ecosystem is growing. I am sure there are lot of folks who are in same boat as me scratching head on how to start. |
Beta Was this translation helpful? Give feedback.
-
I have multi crate repo where one crate is depends on another. Here is high level structure of my repo:
├── BUILD.bazel
├── Cargo.lock
├── Cargo.toml
├── config
├── muspell-server.iml
├── README.md
├── src
│ ├── binaries
│ │ ├── cache
│ │ │ ├── Cargo.toml
│ │ │ └── src
│ │ │ └── main.rs
│ │ └── server
│ │ ├── BUILD.bazel
│ │ ├── Cargo.toml
│ │ └── src
│ │ └── main.rs
│ ├── common
│ │ ├── BUILD.bazel
│ │ ├── Cargo.toml
│ │ └── src
│ │ └── lib.rs
│ └── query
│ ├── analytics
│ │ ├── Cargo.toml
│ │ └── src
│ │ └── lib.rs
│ ├── postgres
│ │ ├── Cargo.toml
│ │ └── src
│ │ └── lib.rs
│ ├── redis
│ │ ├── Cargo.toml
│ │ └── src
│ │ └── lib.rs
│ └── resources
│ ├── Cargo.toml
│ └── src
│ └── lib.rs
└── WORKSPACE
My binaries use the other crates as dependencies. When I tried with simple Bazel.build file the binary is not building. It didn't pickup it's own Cargo.toml for dependencies.
Here is my BUILD.bazel for one of the binary:
I get compilation error
Can someone points me where I was doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions