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
9c7d9c09
Commit
9c7d9c09
authored
Oct 15, 2015
by
Jisi Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style/naming fix
parent
25d75b56
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
protobuf.bzl
protobuf.bzl
+11
-9
No files found.
protobuf.bzl
View file @
9c7d9c09
...
...
@@ -14,8 +14,8 @@ def _cc_outs(srcs):
def
_py_outs
(
srcs
):
return
[
s
[:
-
len
(
".proto"
)]
+
"_pb2.py"
for
s
in
srcs
]
def
_proto_
srcs
_impl
(
ctx
):
"""General implementation for
calculating proto src
s"""
def
_proto_
gen
_impl
(
ctx
):
"""General implementation for
generating proto
s"""
srcs
=
ctx
.
files
.
srcs
deps
=
[]
deps
+=
ctx
.
files
.
srcs
...
...
@@ -36,7 +36,7 @@ def _proto_srcs_impl(ctx):
inputs
=
srcs
+
deps
,
outputs
=
ctx
.
outputs
.
outs
,
arguments
=
args
+
import_flags
+
[
s
.
path
for
s
in
srcs
],
executable
=
ctx
.
executable
.
protoc
executable
=
ctx
.
executable
.
protoc
,
)
return
struct
(
...
...
@@ -47,7 +47,7 @@ def _proto_srcs_impl(ctx):
),
)
_proto_
srcs
=
rule
(
_proto_
gen
=
rule
(
attrs
=
{
"srcs"
:
attr
.
label_list
(
allow_files
=
True
),
"deps"
:
attr
.
label_list
(
providers
=
[
"proto"
]),
...
...
@@ -62,7 +62,7 @@ _proto_srcs = rule(
"outs"
:
attr
.
output_list
(),
},
output_to_genfiles
=
True
,
implementation
=
_proto_
srcs
_impl
,
implementation
=
_proto_
gen
_impl
,
)
def
cc_proto_library
(
...
...
@@ -78,7 +78,7 @@ def cc_proto_library(
if
internal_bootstrap_hack
:
# For pre-checked-in generated files, we add the internal_bootstrap_hack
# which will skip the codegen action.
_proto_
srcs
(
_proto_
gen
(
name
=
name
+
"_genproto"
,
srcs
=
srcs
,
deps
=
[
s
+
"_genproto"
for
s
in
proto_deps
],
...
...
@@ -88,11 +88,12 @@ def cc_proto_library(
# An empty cc_library to make rule dependency consistent.
native
.
cc_library
(
name
=
name
,
**
kargs
)
**
kargs
,
)
return
outs
=
_cc_outs
(
srcs
)
_proto_
srcs
(
_proto_
gen
(
name
=
name
+
"_genproto"
,
srcs
=
srcs
,
deps
=
[
s
+
"_genproto"
for
s
in
proto_deps
],
...
...
@@ -107,4 +108,5 @@ def cc_proto_library(
srcs
=
outs
,
deps
=
deps
+
proto_deps
,
includes
=
[
prefix
],
**
kargs
)
**
kargs
,
)
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