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
3101e733
Commit
3101e733
authored
Oct 16, 2015
by
Jisi Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change prefix to include, and add docs
parent
d8701b57
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
12 deletions
+29
-12
BUILD
BUILD
+2
-2
protobuf.bzl
protobuf.bzl
+27
-10
No files found.
BUILD
View file @
3101e733
...
...
@@ -146,7 +146,7 @@ cc_proto_library(
name = "cc_wkt_protos",
srcs = ["src/" + s for s in WELL_KNOWN_PROTOS],
internal_bootstrap_hack = 1,
prefix
= "src",
include
= "src",
cc_libs = [":protobuf"],
)
...
...
@@ -340,7 +340,7 @@ TEST_PROTOS = [
cc_proto_library(
name = "cc_test_protos",
srcs = ["src/" + s for s in (LITE_TEST_PROTOS + TEST_PROTOS)],
prefix
= "src",
include
= "src",
deps = [":cc_wkt_protos"],
)
...
...
protobuf.bzl
View file @
3101e733
# -*- mode: python; -*- PYTHON-PREPROCESSING-REQUIRED
def
_gen_dir
(
ctx
):
if
not
ctx
.
attr
.
prefix
:
if
not
ctx
.
attr
.
include
:
return
ctx
.
label
.
package
if
not
ctx
.
label
.
package
:
return
ctx
.
attr
.
prefix
return
ctx
.
label
.
package
+
'/'
+
ctx
.
attr
.
prefix
return
ctx
.
attr
.
include
return
ctx
.
label
.
package
+
'/'
+
ctx
.
attr
.
include
def
_cc_outs
(
srcs
):
return
[
s
[:
-
len
(
".proto"
)]
+
".pb.h"
for
s
in
srcs
]
+
\
...
...
@@ -51,7 +51,7 @@ _proto_gen = rule(
attrs
=
{
"srcs"
:
attr
.
label_list
(
allow_files
=
True
),
"deps"
:
attr
.
label_list
(
providers
=
[
"proto"
]),
"
prefix
"
:
attr
.
string
(),
"
include
"
:
attr
.
string
(),
"protoc"
:
attr
.
label
(
executable
=
True
,
single_file
=
True
,
...
...
@@ -68,12 +68,29 @@ _proto_gen = rule(
def
cc_proto_library
(
name
,
srcs
=
[],
protoc
=
":protoc"
,
internal_bootstrap_hack
=
False
,
prefix
=
""
,
deps
=
[],
cc_libs
=
[],
include
=
""
,
protoc
=
":protoc"
,
internal_bootstrap_hack
=
False
,
**
kargs
):
"""Bazel rule to create a C++ protobuf library from proto source files
Args:
name: the name of the cc_proto_library.
srcs: the .proto files of the cc_proto_library.
deps: a list of dependency labels; must be cc_proto_library.
cc_libs: a list of other cc_library targets depended by the generated
cc_library.
include: a string indicating the include path of the .proto files.
protoc: the label of the protocol compiler to generate the sources.
internal_bootstrap_hack: a flag indicate the cc_proto_library is used only
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
cc_proto_library can depend on it.
**kargs: other keyword arguments that are passed to cc_library.
"""
if
internal_bootstrap_hack
:
# For pre-checked-in generated files, we add the internal_bootstrap_hack
...
...
@@ -82,7 +99,7 @@ def cc_proto_library(
name
=
name
+
"_genproto"
,
srcs
=
srcs
,
deps
=
[
s
+
"_genproto"
for
s
in
deps
],
prefix
=
prefix
,
include
=
include
,
protoc
=
protoc
,
)
# An empty cc_library to make rule dependency consistent.
...
...
@@ -96,7 +113,7 @@ def cc_proto_library(
name
=
name
+
"_genproto"
,
srcs
=
srcs
,
deps
=
[
s
+
"_genproto"
for
s
in
deps
],
prefix
=
prefix
,
include
=
include
,
protoc
=
protoc
,
gen_cc
=
1
,
outs
=
outs
,
...
...
@@ -106,5 +123,5 @@ def cc_proto_library(
name
=
name
,
srcs
=
outs
,
deps
=
cc_libs
+
deps
,
includes
=
[
prefix
],
includes
=
[
include
],
**
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