-
Notifications
You must be signed in to change notification settings - Fork 190
/
Copy pathprotobuf.BUILD
40 lines (38 loc) · 1.28 KB
/
protobuf.BUILD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
_CHECK_VERSION = """
PROTOC_VERSION=$$($(location @com_google_protobuf//:protoc) --version \
| cut -d' ' -f2 | sed -e 's/\\./ /g')
PROTOC_VERSION=$$(printf '%d%03d%03d' $${PROTOC_VERSION})
TF_PROTO_VERSION=$$(grep '#define PROTOBUF_MIN_PROTOC_VERSION' \
$(location tf_includes/google/protobuf/port_def.inc) | cut -d' ' -f3)
if [ "$${PROTOC_VERSION}" -lt "$${TF_PROTO_VERSION}" ]; then
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1>&2
echo Your protoc version does not match the tensorflow proto header \
required version: "$${PROTOC_VERSION}" vs. "$${TF_PROTO_VERSION}" 1>&2
echo Please update the PROTOC_VERSION in your WORKSPACE file. 1>&2
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1>&2
false
else
touch $@
fi
"""
genrule(
name = "compare_protobuf_version",
outs = ["versions_compared"],
srcs = [
"tf_includes/google/protobuf/port_def.inc",
],
tools = ["@com_google_protobuf//:protoc"],
cmd = _CHECK_VERSION,
)
cc_library(
name = "includes",
data = [":versions_compared"],
hdrs = glob([
"tf_includes/google/protobuf/*.h",
"tf_includes/google/protobuf/*.inc",
"tf_includes/google/protobuf/**/*.h",
"tf_includes/google/protobuf/**/*.inc",
]),
includes = ["tf_includes"],
visibility = ["//visibility:public"],
)