Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
fc51bdc0
Commit
fc51bdc0
authored
Feb 23, 2016
by
Jisi Liu
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1268 from keveman/grpc_support
Added grpc plugin support to cc_proto_library.
parents
8f67b165
f0966a74
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
protobuf.bzl
protobuf.bzl
+17
-0
No files found.
protobuf.bzl
View file @
fc51bdc0
...
@@ -63,6 +63,10 @@ def _proto_gen_impl(ctx):
...
@@ -63,6 +63,10 @@ def _proto_gen_impl(ctx):
if
ctx
.
attr
.
gen_py
:
if
ctx
.
attr
.
gen_py
:
args
+=
[
"--python_out="
+
ctx
.
var
[
"GENDIR"
]
+
"/"
+
gen_dir
]
args
+=
[
"--python_out="
+
ctx
.
var
[
"GENDIR"
]
+
"/"
+
gen_dir
]
if
ctx
.
executable
.
grpc_cpp_plugin
:
args
+=
[
"--plugin=protoc-gen-grpc="
+
ctx
.
executable
.
grpc_cpp_plugin
.
path
]
args
+=
[
"--grpc_out="
+
ctx
.
var
[
"GENDIR"
]
+
"/"
+
gen_dir
]
if
args
:
if
args
:
ctx
.
action
(
ctx
.
action
(
inputs
=
srcs
+
deps
,
inputs
=
srcs
+
deps
,
...
@@ -90,6 +94,11 @@ _proto_gen = rule(
...
@@ -90,6 +94,11 @@ _proto_gen = rule(
single_file
=
True
,
single_file
=
True
,
mandatory
=
True
,
mandatory
=
True
,
),
),
"grpc_cpp_plugin"
:
attr
.
label
(
cfg
=
HOST_CFG
,
executable
=
True
,
single_file
=
True
,
),
"gen_cc"
:
attr
.
bool
(),
"gen_cc"
:
attr
.
bool
(),
"gen_py"
:
attr
.
bool
(),
"gen_py"
:
attr
.
bool
(),
"outs"
:
attr
.
output_list
(),
"outs"
:
attr
.
output_list
(),
...
@@ -106,6 +115,7 @@ def cc_proto_library(
...
@@ -106,6 +115,7 @@ def cc_proto_library(
include
=
None
,
include
=
None
,
protoc
=
"//google/protobuf:protoc"
,
protoc
=
"//google/protobuf:protoc"
,
internal_bootstrap_hack
=
False
,
internal_bootstrap_hack
=
False
,
use_grpc_plugin
=
False
,
default_runtime
=
"//google/protobuf:protobuf"
,
default_runtime
=
"//google/protobuf:protobuf"
,
**
kargs
):
**
kargs
):
"""Bazel rule to create a C++ protobuf library from proto source files
"""Bazel rule to create a C++ protobuf library from proto source files
...
@@ -126,6 +136,8 @@ def cc_proto_library(
...
@@ -126,6 +136,8 @@ def cc_proto_library(
for bootstraping. When it is set to True, no files will be generated.
for bootstraping. When it is set to True, no files will be generated.
The rule will simply be a provider for .proto files, so that other
The rule will simply be a provider for .proto files, so that other
cc_proto_library can depend on it.
cc_proto_library can depend on it.
use_grpc_plugin: a flag to indicate whether to call the grpc C++ plugin
when processing the proto files.
default_runtime: the implicitly default runtime which will be depended on by
default_runtime: the implicitly default runtime which will be depended on by
the generated cc_library target.
the generated cc_library target.
**kargs: other keyword arguments that are passed to cc_library.
**kargs: other keyword arguments that are passed to cc_library.
...
@@ -153,6 +165,10 @@ def cc_proto_library(
...
@@ -153,6 +165,10 @@ def cc_proto_library(
**
kargs
)
**
kargs
)
return
return
grpc_cpp_plugin
=
None
if
use_grpc_plugin
:
grpc_cpp_plugin
=
"//external:grpc_cpp_plugin"
outs
=
_CcOuts
(
srcs
)
outs
=
_CcOuts
(
srcs
)
_proto_gen
(
_proto_gen
(
name
=
name
+
"_genproto"
,
name
=
name
+
"_genproto"
,
...
@@ -160,6 +176,7 @@ def cc_proto_library(
...
@@ -160,6 +176,7 @@ def cc_proto_library(
deps
=
[
s
+
"_genproto"
for
s
in
deps
],
deps
=
[
s
+
"_genproto"
for
s
in
deps
],
includes
=
includes
,
includes
=
includes
,
protoc
=
protoc
,
protoc
=
protoc
,
grpc_cpp_plugin
=
grpc_cpp_plugin
,
gen_cc
=
1
,
gen_cc
=
1
,
outs
=
outs
,
outs
=
outs
,
visibility
=
[
"//visibility:public"
],
visibility
=
[
"//visibility:public"
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment