bazelbuild / bazelbuild/rules_rust

rust_proto_library doesn't work with dots in the proto files name

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

Description

Hello!

It seems like `rust_proto_library` rule doesn't work with proto files which contain dots in the name. It wasn't mentioned anywhere in the docs (at least I didn't find it) and the build error is quite confusing. So unless its fairly straightforward to fix that behavior, maybe its good to mention that limitation somewhere?

A bit of a context - consider this simple proto file (lets name it `foo.bar.proto`):
```proto
syntax = "proto3";

package foo;
option java_package = "com.foo.bar";

message Foo {}
```

Writing some rules for it and trying to build:
```
proto_library(
name = "foobar_proto",
srcs = ["foo.bar.proto"],
)
rust_proto_library(
name = "foobar_rust_proto",
deps = [ ":foobar_proto" ]
)

sholokhov@nzxt:~/code/example$ bazel build //:foobar_rust_proto --verbose_failures=true
INFO: Invocation ID: a0de7d8c-541b-4028-914c-7efc70c86b6f
INFO: Analyzed target //:foobar_rust_proto (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/sholokhov/code/example/BUILD:12:19: output 'foobar_rust_proto.proto.rust/foo.rs' was not created
ERROR: /home/sholokhov/code/example/BUILD:12:19: Generating Rust protobuf stubs failed: not all outputs were created or valid
Target //:foobar_rust_proto failed to build
INFO: Elapsed time: 0.132s, Critical Path: 0.01s
INFO: 2 processes: 1 internal, 1 linux-sandbox.
FAILED: Build did NOT complete successfully
```

Simple changing the proto file name to `foo_bar.proto` (and updating the rule) results into successful build.

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.