bazel-contrib / bazel-gazelle

Gazelle is a Bazel build file generator for Bazel projects. It natively supports Go and protobuf, and it may be extended to support new languages and custom rule sets.
Apache License 2.0
1.21k stars 382 forks source link

Feature Request: Record Service and Message names in Proto's fileInfo #1843

Open ckilian867 opened 4 months ago

ckilian867 commented 4 months ago

Currently, while the proto extension parses the proto file, it uses regex to find certain information about the file, including package, options, and imports.

One of the things being parsed is services. However, this is currently just to track a boolean on whether there are any services in the current file.

For determining Java imports, we'd need to know the Java package option (already available) as well as the names of the messages and services being generated.

This feature request would be to add two new fields to FileInfo: ServiceNames and MessageNames (or something similar). In addition to the current information parsed from the proto file, we'd record this information and return it to the caller for later use.

We'd be happy to implement this and raise a PR, but wanted to understand any concerns with this approach before spending cycles on implementation.