bazelbuild / bazelbuild/bazel

Expose --proto_compiler to Starlark rules

Open
#8,485 9 comments 1 reaction 0 assignees View on GitHub
not stale P3 team-Rules-Server type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the problem / feature request:

Expose value of [`--proto_compiler`](https://docs.bazel.build/versions/master/command-line-reference.html#flag--proto_compiler) to starlark.

### Feature requests: what underlying problem are you trying to solve with this feature?

I'm trying to use a different protoc binary other than `@com_google_protobuf//:protoc` through the `--proto_compiler` bazel flag. This mostly works, except for in my go rules that depend on a separately defined default I cannot modify in

https://github.com/bazelbuild/rules_go/blob/f900a9e520e9fdb7b81511f9aa5de2e43da19e2a/proto/compiler.bzl#L174-L178

The rules_go maintainers would be open to reading the `--proto_compiler` setting if it is exposed through Starlark. Is there a way to do this today or an idea of exposing a proto toolchain to starlark rules?

### What operating system are you running Bazel on?

macOS

### What's the output of `bazel info release`?

release 0.25.2

### Have you found anything relevant by searching the web?
rules_go issue: https://github.com/bazelbuild/rules_go/issues/2018#issuecomment-496707237

### Any other information, logs, or outputs that you want to share?

Contributor guide

Open the contributing guide

Research direction

Start by reading the linked Bazel command-line reference for --proto_compiler and the rules_go compiler.bzl excerpt at lines 174-178. Trace how the flag is represented and whether Starlark can access it today. Done means a documented or implemented way for Starlark rules to use the selected proto compiler, with the rules_go use case working.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.