bazelbuild / bazelbuild/rules_rust

Unable to generate proto bindings for proto files with the same name

Open
#179 3 comments 0 reactions 0 assignees View on GitHub
bug needs-triage proto
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

Hi, thanks for this project, I'm very excited at the prospect of building rust with Bazel!

I ran into the following problem.
When trying to generate proto bindings in a project, where there exists more than one file with the same name (in a different package), I get the following error:

Generating Rust protobuf stubs failed (Exit 1) protoc failed: error executing command
(cd //execroot/ && \
exec env - \

Execution platform: @bazel_tools//platforms:host_platform

Use --sandbox_debug to see verbose messages from the sandbox: protoc failed: error executing command
(cd //execroot/ && \
exec env - \

Execution platform: @bazel_tools//platforms:host_platform

Use --sandbox_debug to see verbose messages from the sandbox
.rs: Tried to write the same file twice.

It seems that the protoc rust plugin generates all files directly in the folder of the first output, regardless of the proto package, then when trying to write to the same file twice protoc throws an error.

This becomes increasingly hard to deal with if `com.example.a/example.proto` depends on `com.example.b/example.proto` since `com.example.b/example.proto` is included in the protoc command as an output (and is thus always generated for `com.example.a/example.proto`).

I am not very familiar with this project and rust protobuf so I don't know if I'm in the correct repository for the issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.