bazelbuild / rules_proto

Protocol buffer rules for Bazel
Apache License 2.0
167 stars 69 forks source link

build error when a.proto import b.proto, and the protos under same dir #198

Open sky92zwq opened 10 months ago

sky92zwq commented 10 months ago

here is my dir layout: a.proto depends on b.proto, so import b.proto in a.proto.

├── proto
│   ├── BUILD
│   ├── CMakeLists.txt
│   ├── a.proto
│   └── b.proto
├── src
│   ├── BUILD
│   └── main.cc
├── test
│   ├── BUILD
│   ├── main.cc
├── BUILD
├── CMakeLists.txt
├── README.md
└──WORKSPACE

bazel build got error:

proto/a.proto:5:1: Import "b.proto" was not found or had errors.

but cmake works fine. why should I add import proto/b.proto in a.proto, but just import b.proto?

comius commented 10 months ago

@alexeagle, @thesayyn can you triage?

thesayyn commented 10 months ago

why should I add import proto/b.proto in a.proto, but just import b.proto

afaik every import statement has to be relative to the workspace root if you are not using strip_import_prefix so this works as intended.