Skip to content
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

Embed protobuf targets in Bazel #3155

Closed
abergmeier-dsfishlabs opened this issue Jun 9, 2017 · 5 comments
Closed

Embed protobuf targets in Bazel #3155

abergmeier-dsfishlabs opened this issue Jun 9, 2017 · 5 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) type: feature request

Comments

@abergmeier-dsfishlabs
Copy link
Contributor

Description of the problem / feature request / question:

For people to be able to implement workers, it would be good if targets like @io_bazel//src/main/protobuf:worker_protocol_cc_proto and @io_bazel//third_party/protobuf:protobuf_python would be embedded into Bazel.
Possibly as targets @io_bazel_worker//:cc_proto and @io_bazel_worker//:py_proto.

@meteorcloudy meteorcloudy added P2 We'll consider working on this in future. (Assignee optional) type: feature request labels Jun 12, 2017
@alexeagle
Copy link
Contributor

These targets do exist, eg
bazel build @bazel_tools//src/main/protobuf:worker_protocol.proto

however, there's a broken reference (at least in Bazel 0.5.1)

ERROR: error loading package '@bazel_tools//src/main/protobuf': Extension file not found. Unable to load package for '@bazel_tools//third_party/protobuf/3.2.0:protobuf.bzl': BUILD file not found on package path.

Looks like src/main/protobuf/BUILD contains load("//third_party/protobuf/3.2.0:protobuf.bzl", "cc_proto_library", "py_proto_library") but there is no protobuf directory under third_party.

@alexeagle
Copy link
Contributor

Same problem prevents implementing extra actions
https://docs.bazel.build/versions/master/be/extra-actions.html

alexeagle-macbookpro:rules_typescript alexeagle$ bazel info release
release 0.5.4-homebrew
alexeagle-macbookpro:rules_typescript alexeagle$ bazel build @bazel_tools//src/main/protobuf:extra_actions_base.proto
ERROR: error loading package '@bazel_tools//src/main/protobuf': Extension file not found. Unable to load file '@bazel_tools//tools/build_rules:genproto.bzl': file doesn't exist or isn't a file.
INFO: Elapsed time: 0.064s

@cgrushko cgrushko assigned lberki and unassigned cgrushko Oct 14, 2017
@ulfjack
Copy link
Contributor

ulfjack commented Mar 21, 2018

I am definitely against bundling any additional things into the bazel binary.

I could maybe be convinced to add another git repo that only contains a copy of the proto (maintained by us) so that you can declare it as a workspace dep. On the other hand, I think it's also fine if you copy the proto to where you need it.

@ulfjack
Copy link
Contributor

ulfjack commented Mar 21, 2018

Let me rephrase that: I'd prefer not to bundle more things into the Bazel binary. Protos are forward and backwards-compatible (as long as we only make certain kinds of changes), so it shouldn't be necessary to use exactly the same proto as Bazel is using.

bazel-io pushed a commit that referenced this issue Sep 20, 2019
Target patterns are to be read in the name space of the main
repository. This namespace, however, can also contain a mapping
of repository names, in particular that of the main repository
(#7130, #3155).

While there, also make an error message more informative. (This
message change is related as the modified evaluation order causes
another error to be found first in a test example.)

Change-Id: I022240e5c201d33e31f2a818f74a91af3b6f7b3d
PiperOrigin-RevId: 270240453
@aiuto
Copy link
Contributor

aiuto commented May 13, 2020

Closing this as will not implement.
@ulfjack's comments about adding more to the bazel binary from 2 years ago still stand. Since then, we have made a concerted effort to reduce size, and to reduce the number of bundled tools.
A bazelbuild/bazel-lib repo might be a good place for just the .proto files and rules around them. Maybe we could synthesize one as part of the bazel release build. But let's start fresh on that idea if there really is demand.

@aiuto aiuto closed this as completed May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) type: feature request
Projects
None yet
Development

No branches or pull requests

8 participants