-
Notifications
You must be signed in to change notification settings - Fork 112
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
Use standard Bazel proto toolchain #232
Conversation
Currently, @com_google_protobuf_java is defined by the protobuf-java jars published on Maven Central, imported into rules_closure by the java_import_external() Skylark rule. Meanwhile, the protobuf repository is a Bazel repository. Its //:protobuf_java target provides the same functionality as the protobuf-java jars. Importing the protobuf repo via http_archive is the officially recommended way of using protos in Bazel (https://blog.bazel.build/2017/02/27/protocol-buffers.html). This commit changes the definition of rules_closure's @com_google_protobuf_java from the maven jar-based approach to a real http_archive. This will allow downstream repos that currently have the recommended proto setup to use rules_closure.
Bazel has shipped with a java_proto_library rule since 0.4.5 (March 2017). It is the officially recommended way to use protos with Java (https://blog.bazel.build/2017/02/27/protocol-buffers.html). Meanwhile, rules_closure has had a private java_proto_library macro since mid-2016. The provenance of this macro is unclear (the commit adding it, 9dd5f9, doesn't explain where it came from), but based on the copyright notice at the top of the file, it was probably forked from the Bazel repo before the native java_proto_library was publicly available. There don't seem to be any advantages for rules_closure to continue maintaining its idiosyncratic proto rules. This commit therefore removes java_proto_library.bzl and changes all java_proto_library targets in the repo to conform to the official API.
Currently, rules_closure has special logic for downloading and invoking the protoc binary. The protobuf repository also exposes a Bazel target for protoc (@com_google_protobuf//:protoc), which is the recommended way of invoking protoc from Bazel. This commit changes rules_closure and its one proto rule (closure_js_proto_library) to use the standard protoc toolchain. As a result, the special logic for dealing directly with protoc can be removed.
Can one of the admins verify this patch? |
sha256 = "0cc6607e2daa675101e9b7398a436f09167dffb8ca0489b0307ff7260498c13c", | ||
strip_prefix = "protobuf-3.5.0", | ||
urls = [ | ||
"https://mirror.bazel.build/github.com/google/protobuf/archive/v3.5.0.tar.gz", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bumps the protoc version from 3.3 to 3.5. (Because of some changes in the JSPB runtime, this requires a similar bump to com_google_protobuf_js below.) If you prefer, I can stick with 3.3 in this PR and bump the versions later.
Could you please send this as an internal CL? Otherwise I'll have to patch this by hand into the internal repo and re-export it. |
This CL switches rules_closure to use Bazel's built-in java_proto_library rule instead of a custom Skylark rule. It also switches the protoc binary to the standard @com_google_protobuf//:protoc instead of a custom-downloaded dependency. This CL is a port that fixes #231 and #232. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=177367734
This CL switches rules_closure to use Bazel's built-in java_proto_library rule instead of a custom Skylark rule. It also switches the protoc binary to the standard @com_google_protobuf//:protoc instead of a custom-downloaded dependency. This CL is a port that fixes bazelbuild#231 and bazelbuild#232. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=177367734
This PR switches rules_closure to use Bazel's built-in java_proto_library rule instead of a custom Skylark rule. It also switches the protoc binary to the standard @com_google_protobuf//:protoc instead of a custom-downloaded dependency. See the commit descriptions for more details.
(Note that 73e9f1d is part of a separate PR, so that diff should disappear from this PR once it is merged.)