diff options
author | 2016-04-14 19:15:20 -0800 | |
---|---|---|
committer | 2016-04-14 20:22:35 -0700 | |
commit | df15baa9b10a0b2d194181dff7ee14bff70d9b8f (patch) | |
tree | a66e1fcb309a7404a2749140d8bac991a6524ac0 /tensorflow/tools/proto_text/BUILD | |
parent | 104fe2822b419c4154d11c401ffd4a3a6e8f24c6 (diff) |
Add tools/proto_text for generating ProtoDebugString,
ProtoShortDebugString, and ProtoParseFromString methods from protos. This will
allow changing code used on mobile to use the proto LITE_RUNTIME, to reduce
code size.
This change is only for the tool itself. A future change will add a better
genrule and use it the generated code in tensorflow.
Change: 119919087
Diffstat (limited to 'tensorflow/tools/proto_text/BUILD')
-rw-r--r-- | tensorflow/tools/proto_text/BUILD | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/tensorflow/tools/proto_text/BUILD b/tensorflow/tools/proto_text/BUILD new file mode 100644 index 0000000000..c677721672 --- /dev/null +++ b/tensorflow/tools/proto_text/BUILD @@ -0,0 +1,90 @@ +# Description: +# This package provides build-time generation of proto3 text format functions +# (ProtoDebugString, ProtoShortDebugString, and ProtoParseFromString) which +# provide equivalent functionality as proto.DebugString, proto.ShortDebugString, +# and TextFormat parsing, but can be used with protos generated with +# LITE_RUNTIME. +# +# Note that proto3 well-known types (e.g. Any) are not handled in a special way +# by the generated code. + +package(default_visibility = ["//visibility:private"]) + +licenses(["notice"]) # Apache 2.0 + +exports_files(["LICENSE"]) + +# For platform specific build config +load( + "//tensorflow/core:platform/default/build_config.bzl", + "tf_proto_library_cc", +) + +cc_binary( + name = "gen_proto_text_functions", + srcs = ["gen_proto_text_functions.cc"], + visibility = ["//tensorflow:internal"], + deps = [ + ":gen_proto_text_functions_lib", + "//tensorflow/core:lib", + ], +) + +cc_library( + name = "gen_proto_text_functions_lib", + srcs = ["gen_proto_text_functions_lib.cc"], + hdrs = ["gen_proto_text_functions_lib.h"], + deps = [ + "//tensorflow/core:lib", + ], +) + +tf_proto_library_cc( + name = "test_proto", + srcs = ["test.proto"], +) + +genrule( + name = "test_proto_text_srcs", + srcs = ["test.proto"], + outs = [ + "test.pb_text-impl.h", + "test.pb_text.h", + "test.pb_text.cc", + ], + cmd = "$(location :gen_proto_text_functions) " + + "$(@D) $(location test.proto)", + tools = [":gen_proto_text_functions"], +) + +cc_test( + name = "gen_proto_text_functions_lib_test", + size = "small", + srcs = [ + "gen_proto_text_functions_lib_test.cc", + ":test_proto_text_srcs", + ], + deps = [ + ":gen_proto_text_functions_lib", + ":test_proto_cc", + "//tensorflow/core:lib", + "//tensorflow/core:lib_internal", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + ], +) + +# ----------------------------------------------------------------------------- +# Google-internal targets. These must be at the end for syncrepo. + +filegroup( + name = "all_files", + srcs = glob( + ["**/*"], + exclude = [ + "**/METADATA", + "**/OWNERS", + ], + ), + visibility = ["//tensorflow:__subpackages__"], +) |