-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create proto_toolchain rule #10937
Closed
Closed
Create proto_toolchain rule #10937
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Yannic
added a commit
to Yannic/rules_proto_bazelbuild
that referenced
this pull request
Mar 30, 2020
This change adds a proto toolchain configuration to `@rules_proto`. To stay compatible with versions that do not have `native.proto_toolchain` yet, this change also adds a API-compatible Starlark `proto_toolchain`. See bazelbuild/bazel#10937
This is ready for review now. |
What's the state of this PR? |
We're replacing the "WIP" label with the native GitHub "draft PRs". I thus converted this PR to a draft. Please mark this as ready for review when it's ready, or close it if you no longer intend to work on it. Thanks! 👍 |
Things have changed since opening this, so I'll close this and submit a new (updated) one. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change adds a new
proto_toolchain
rule which we will use later to resolvetools and options required to compile Protocol Buffers, thus eventually replacing
some of the command-line options from
ProtoConfiguration
.To preclude inconsistencies in the migration period, we will start with a
proto_toolchain
rule that doesn't have any arguments and populateits provider from the existing command-line options. After all consumers
have been migrated to resolve the tools from the toolchain instead of
reading the command-line, we will replace all proto-specific flags with
attributes on
proto_toolchain
(or similar, language-specific toolchainsfor flags that only affect a specific language).
This change also adds a dependency on the new toolchain type to
proto_library
,cc_proto_library
,java_proto_library
, andjava_lite_proto_library
.Unfortunately, there seems to be no existing way to add a dependency on a
toolchain based on the value of a flag. To avoid breaking everyone, we add
a (default)
proto_toolchain
target to@bazel_tools//tools/proto:toolchain
thatis registered in a workspace suffix and add a migration flag to disable them (thus
requiring users to upgrade to a compatible
@rules_proto
version. At this point,it is unclear whether we want to do this migration now (i.e. for Bazel 4.0) or
wait for a later release.
See bazelbuild/rules_proto#54
Updates #10005