Skip to content

bazel: Add proto_library rules for well known types. Fixes #2763 - #3594

Merged
xfxyjwf merged 1 commit into
protocolbuffers:masterfrom
buchgr:well-known-protos
Sep 5, 2017
Merged

xfxyjwf merged 1 commit into
protocolbuffers:masterfrom
buchgr:well-known-protos

Conversation

@buchgr

@buchgr buchgr commented Sep 5, 2017 •

Copy link
Copy Markdown
Contributor

Adds a proto_library rule for each well known type proto:

$ bazel query "filter(\".*_proto$\", \"...\")"
//:wrappers_proto
//:timestamp_proto
//:struct_proto
//:field_mask_proto
//:empty_proto
//:duration_proto
//:compiler_plugin_proto
//:descriptor_proto
//:api_proto
//:type_proto
//:source_context_proto
//:any_proto

Bazel users can reference these proto_library rules for their own
language specific rules i.e.

java_proto_library(
  name = "any_java_proto",
  deps = ["@com_google_protobuf//:any_proto"],
)

Also set the workspace name to "com_google_protobuf", as proto_library
rules reference protobuf that way.

@grpc-kokoro

Copy link
Copy Markdown

Thanks for your pull request. The automated tests will run as soon as one of the admins verifies this change is ok for us to run on our infrastructure.

1 similar comment
@grpc-kokoro

Copy link
Copy Markdown

Thanks for your pull request. The automated tests will run as soon as one of the admins verifies this change is ok for us to run on our infrastructure.

Comment thread BUILD Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this prefix needed to avoid conflict? If not it seems better to just use the simpler name.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also just use the simpler name. SGTM.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the simpler version then. Can you update this pull request?

@buchgr

buchgr commented Sep 5, 2017

Copy link
Copy Markdown
Contributor Author

Updated. Please take another look @xfxyjwf

Comment thread BUILD Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment to explain how to use these protos? An example should be good enough.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

…ffers#2763

Adds a proto_library rule for each well known type proto:

$ bazel query "filter(\".*_proto$\", \"...\")"
//:wrappers_proto
//:timestamp_proto
//:struct_proto
//:field_mask_proto
//:empty_proto
//:duration_proto
//:compiler_plugin_proto
//:descriptor_proto
//:api_proto
//:type_proto
//:source_context_proto
//:any_proto

Bazel users can reference these proto_library rules for their own
language specific rules i.e.

java_proto_library(
  name = "any_java_proto",
  deps = ["@com_google_protobuf//:any_proto"],
)

Also set the workspace name to "com_google_protobuf", as proto_library
rules reference protobuf that way.
@xfxyjwf

xfxyjwf commented Sep 5, 2017

Copy link
Copy Markdown
Contributor

Thanks!

@xfxyjwf
xfxyjwf merged commit 35b852f into protocolbuffers:master Sep 5, 2017
xfxyjwf added a commit to xfxyjwf/protobuf that referenced this pull request Sep 8, 2017
The example utilizes native bazel rules (proto_library, cc_proto_library,
java_proto_library, java_lite_proto_library) to show how easy it is to
build protobuf with bazel's native support. It also makes use of well
known types which was not possible until the latest bazel 0.5.4 release
and protocolbuffers#3594 .
mikaelstaldal added a commit to mikaelstaldal/rules_protobuf that referenced this pull request Dec 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants