Giter Club home page Giter Club logo

proto_library's People

Contributors

cgrushko avatar ejona86 avatar erickj avatar hoisie avatar ittaiz avatar yannic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

proto_library's Issues

example use of well known types

Given that this repo is the "official" example for using proto rules in bazel there should be a working example of including well known google/protobuf protos.

The FAQ at https://blog.bazel.build/2017/02/27/protocol-buffers.html referencing this repo has incorrect info regarding well known protos. I'll be filing a bug on https://github.com/bazelbuild/bazel-blog/ for that.

That post says:

"Q: How does one use well-known types? (e.g., any.proto, descriptor.proto)
A: Once protocolbuffers/protobuf#2763 is resolved, the following should be added to a .proto file: import google/protobuf/any.proto and the following: @com_google_protobuf//:well_known_types_protos to one's proto_library rule."

However, with bazel 0.8.0, and fresh clone of this repository performing, it's apparent that this can't be correct:

$ bazel query @com_google_protobuf//:well_known_types_protos ERROR: no such target '@com_google_protobuf//:well_known_types_protos': target 'well_known_types_protos' not declared in package '' defined by /home/erick/.cache/bazel/_bazel_erick/b1f9fa8319238652d95ee6d19999542c/external/com_google_protobuf/BUILD

Looking at https://github.com/google/protobuf/ it's unclear when target :well_known_types_protos ever existed, however since protocolbuffers/protobuf@699c0eb each well known type has it's own proto_library rule for use as a dep in proto_library rules:

$ bazel query 'visible(//:*, kind(proto_library, @com_google_protobuf//:all))'
@com_google_protobuf//:wrappers_proto
@com_google_protobuf//:timestamp_proto
@com_google_protobuf//:struct_proto
@com_google_protobuf//:field_mask_proto
@com_google_protobuf//:empty_proto
@com_google_protobuf//:duration_proto
@com_google_protobuf//:compiler_plugin_proto
@com_google_protobuf//:descriptor_proto
@com_google_protobuf//:api_proto
@com_google_protobuf//:type_proto
@com_google_protobuf//:source_context_proto
@com_google_protobuf//:any_proto

Not up to date with Bazel/protobuf I guess

Trying to build as of 2019-03:

> bazel version
Build label: 0.23.0-homebrew

> bazel build //src:person_cc_proto
ERROR: .../proto_library/WORKSPACE:5:1: name 'http_archive' is not defined
ERROR: .../proto_library/WORKSPACE:14:1: name 'http_archive' is not defined
ERROR: Error evaluating WORKSPACE file
ERROR: error loading package '': Encountered error while reading extension file 'tools/build_defs/repo/http.bzl': no such package '@bazel_tools//tools/build_defs/repo': error loading package 'external': Could not load //external package
ERROR

Reference to "google/api/annotations.proto"

Hi,

is there a sample/advice how to add a reference to

import "google/api/annotations.proto";

It seems to be a trivial case, but I'm not able to find a way how to add the above reference to my project.

Thank you.

Best Regards,
Jiri

Reducing protobuf dependencies?

Hi cgrushko@,

First off thanks for bring protobuf support to Bazel.

We have 5 protobuf dependencies in our WORKSPACE: https://github.com/google/tink/blob/master/WORKSPACE#L43-L85.

It seems that Bazel has to download and compile each package separately. This takes a lot of time, especially compiling. Since these protobuf packages have shared code which I suspect that got compiled several times.

Is there a way to merge these packages to a single dependency so that everything is compiled only once?

Thanks!

Appears not to work on windows

Just cloned and tried to build. Don't know a lot about Bazel yet so I'm not sure where /Wwrite-strings is even being specified.

I'm happy to help triage whenever I become more proficient with the system.

C:\projects\proto_library>bazel build //src:person_cc_proto
INFO: Found 1 target...
ERROR: C:/users/chip.collier/appdata/local/temp/_bazel_chip.collier/7oy6qvby/external/com_google_protobuf/BUILD:73:1: C++ compilation of rule '@com_google_protobuf//:protobuf_lite' failed (Exit 2).
cl : Command line error D8021 : invalid numeric argument '/Wwrite-strings'
Target //src:person_cc_proto failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.901s, Critical Path: 0.08s

C:\projects\proto_library>bazel build //src
ERROR: no such target '//src:src': target 'src' not declared in package 'src' defined by C:/projects/proto_library/src/BUILD.
INFO: Elapsed time: 0.512s

C:\projects\proto_library>bazel build //src:person_java_proto
INFO: Found 1 target...
ERROR: C:/users/chip.collier/appdata/local/temp/_bazel_chip.collier/7oy6qvby/external/com_google_protobuf_java/BUILD:73:1: C++ compilation of rule '@com_google_protobuf_java//:protobuf_lite' failed (Exit 2).
cl : Command line error D8021 : invalid numeric argument '/Wwrite-strings'
Target //src:person_java_proto failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 15.177s, Critical Path: 0.19s

bazel build //src:person_cc_proto fail

I got these message for compiling person_cc_proto

ERROR: /home/lighthouse/.cache/bazel/_bazel_lighthouse/63bd832c5da9da3b0281fb42bbcf7349/external/com_google_protobuf/BUILD:1006:21: in proto_lang_toolchain rule @com_google_protobuf//:cc_toolchain: '@com_google_protobuf//:cc_toolchain' does not have mandatory provider 'ProtoInfo'.
ERROR: Analysis of target '//src:person_cc_proto' failed; build aborted: Analysis of target '@com_google_protobuf//:cc_toolchain' failed
INFO: Elapsed time: 0.204s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)

need CI

I'm not sure this is working on newer versions of bazel.

INFO: Invocation ID: d1d1b8dd-d912-4859-89ed-e9a4d5f09a5e
ERROR: /home/thickey/.cache/bazel/_bazel_thickey/12ea4ca4c5b772e334d238b0acc653b5/external/com_google_protobuf/BUILD:597:1: Traceback (most recent call last):
	File "/home/thickey/.cache/bazel/_bazel_thickey/12ea4ca4c5b772e334d238b0acc653b5/external/com_google_protobuf/BUILD", line 597
		internal_gen_well_known_protos_java(srcs = WELL_KNOWN_PROTOS)
	File "/home/thickey/.cache/bazel/_bazel_thickey/12ea4ca4c5b772e334d238b0acc653b5/external/com_google_protobuf/protobuf.bzl", line 266, in internal_gen_well_known_protos_java
		Label(("%s//protobuf_java" % REPOSITOR...))
	File "/home/thickey/.cache/bazel/_bazel_thickey/12ea4ca4c5b772e334d238b0acc653b5/external/com_google_protobuf/protobuf.bzl", line 266, in Label
		REPOSITORY_NAME
The value 'REPOSITORY_NAME' has been removed in favor of 'repository_name()', please use the latter (https://docs.bazel.build/versions/master/skylark/lib/native.html#repository_name). You can temporarily allow the old name by using --incompatible_package_name_is_a_function=false
ERROR: /home/thickey/.cache/bazel/_bazel_thickey/12ea4ca4c5b772e334d238b0acc653b5/external/com_google_protobuf/BUILD:380:1: Target '@com_google_protobuf//:android' contains an error and its package is in error and referenced by '@com_google_protobuf//:protoc'
ERROR: /home/thickey/.cache/bazel/_bazel_thickey/12ea4ca4c5b772e334d238b0acc653b5/external/com_google_protobuf/BUILD:380:1: Target '@com_google_protobuf//:windows' contains an error and its package is in error and referenced by '@com_google_protobuf//:protoc'
ERROR: /home/thickey/.cache/bazel/_bazel_thickey/12ea4ca4c5b772e334d238b0acc653b5/external/com_google_protobuf/BUILD:380:1: Target '@com_google_protobuf//:windows_msvc' contains an error and its package is in error and referenced by '@com_google_protobuf//:protoc'

We should set up travis CI or something for more confidence.

Error in Ubuntu

:~/Desktop/blog/c++/protobuf/proto_library$ bb //src:person_cc_proto

............
ERROR: /home/mobvoi/Desktop/blog/c++/protobuf/proto_library/src/BUILD:32:1: every rule of type proto_library implicitly depends upon the target '@com_google_protobuf_cc//:cc_toolchain', but this target could not be found because of: no such package '@com_google_protobuf_cc//': The repository could not be resolved
ERROR: Analysis of target '//src:person_cc_proto' failed; build aborted: Evaluation of aspect BazelCcProtoAspect on //src:person_proto failed: com.google.devtools.build.lib.packages.BuildFileNotFoundException: no such package '@com_google_protobuf_cc//': The repository could not be resolved
INFO: Elapsed time: 44.536s
FAILED: Build did NOT complete successfully (11 packages loaded)

java_lite_proto_library failed to work

Thanks for working on this, it's really useful and has saved me a lot of time.

java_proto_library works perfectly for me, but I'm getting this error with java_lite_proto_library:

ERROR: /private/var/tmp/_bazel_thaidn/df2e59bf257c59e48735734d799e3be1/external/com_google_protobuf_javalite/protobuf.bzl:91:19: name 'HOST_CFG' is not defined.

It seems related to protocolbuffers/protobuf#2761, but I can't tell what I should do to fix it. Any idea?

Cheers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.