diff options
author | Yuchen Zeng <y-zeng@users.noreply.github.com> | 2016-09-28 13:12:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-28 13:12:31 -0700 |
commit | b97f867b390193daf18988958183143726602727 (patch) | |
tree | 7a57ffb8efa62890589906a23253d979f11cf074 | |
parent | fbf8dd8a40ad5a845dc405d54364f1e0a01281f0 (diff) | |
parent | ef394a954a326f42bf236f2db49fcfd84f50339b (diff) |
Merge pull request #8185 from y-zeng/gen_proto_comment
Improve gen_reflection_proto.sh
-rw-r--r-- | include/grpc++/ext/reflection.grpc.pb.h | 2 | ||||
-rw-r--r-- | include/grpc++/ext/reflection.pb.h | 2 | ||||
-rw-r--r-- | src/cpp/ext/reflection.grpc.pb.cc | 2 | ||||
-rw-r--r-- | src/cpp/ext/reflection.pb.cc | 2 | ||||
-rwxr-xr-x | tools/codegen/extensions/gen_reflection_proto.sh | 32 |
5 files changed, 31 insertions, 9 deletions
diff --git a/include/grpc++/ext/reflection.grpc.pb.h b/include/grpc++/ext/reflection.grpc.pb.h index 064117e303..6e56088497 100644 --- a/include/grpc++/ext/reflection.grpc.pb.h +++ b/include/grpc++/ext/reflection.grpc.pb.h @@ -32,7 +32,7 @@ */ -// Generated by the gRPC protobuf plugin. +// Generated by tools/codegen/extensions/gen_reflection_proto.sh // If you make any local change, they will be lost. // source: reflection.proto // Original file comments: diff --git a/include/grpc++/ext/reflection.pb.h b/include/grpc++/ext/reflection.pb.h index bdb86197d0..caa1592424 100644 --- a/include/grpc++/ext/reflection.pb.h +++ b/include/grpc++/ext/reflection.pb.h @@ -32,7 +32,7 @@ */ -// Generated by the protocol buffer compiler. DO NOT EDIT! +// Generated by tools/codegen/extensions/gen_reflection_proto.sh // source: reflection.proto #ifndef PROTOBUF_reflection_2eproto__INCLUDED diff --git a/src/cpp/ext/reflection.grpc.pb.cc b/src/cpp/ext/reflection.grpc.pb.cc index b046dfc1b8..8139c8ea16 100644 --- a/src/cpp/ext/reflection.grpc.pb.cc +++ b/src/cpp/ext/reflection.grpc.pb.cc @@ -32,7 +32,7 @@ */ -// Generated by the gRPC protobuf plugin. +// Generated by tools/codegen/extensions/gen_reflection_proto.sh // If you make any local change, they will be lost. // source: reflection.proto diff --git a/src/cpp/ext/reflection.pb.cc b/src/cpp/ext/reflection.pb.cc index a84494f9a9..b50465b9b5 100644 --- a/src/cpp/ext/reflection.pb.cc +++ b/src/cpp/ext/reflection.pb.cc @@ -32,7 +32,7 @@ */ -// Generated by the protocol buffer compiler. DO NOT EDIT! +// Generated by tools/codegen/extensions/gen_reflection_proto.sh // source: reflection.proto #define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION diff --git a/tools/codegen/extensions/gen_reflection_proto.sh b/tools/codegen/extensions/gen_reflection_proto.sh index bd8aac6a7b..ea7689f7e8 100755 --- a/tools/codegen/extensions/gen_reflection_proto.sh +++ b/tools/codegen/extensions/gen_reflection_proto.sh @@ -29,20 +29,39 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +set -e +cd $(dirname $0)/../../.. + PROTO_DIR="src/proto/grpc/reflection/v1alpha" PROTO_FILE="reflection" HEADER_DIR="include/grpc++/ext" SRC_DIR="src/cpp/ext" INCLUDE_DIR="grpc++/ext" TMP_DIR="tmp" -GRPC_PLUGIN="bins/opt/grpc_cpp_plugin" -PROTOC="bins/opt/protobuf/protoc" -set -e +if hash grpc_cpp_plugin 2>/dev/null; then + GRPC_PLUGIN=$(which grpc_cpp_plugin) +else + if [ -f bins/opt/grpc_cpp_plugin ]; then + GRPC_PLUGIN="bins/opt/grpc_cpp_plugin" + else + echo "gRPC protoc plugin not found" + exit 1 + fi +fi -TMP_DIR=${TMP_DIR}_${PROTO_FILE} +if hash protoc 2>/dev/null; then + PROTOC=$(which protoc) +else + if [ -f bins/opt/protobuf/protoc ]; then + PROTOC="bins/opt/protobuf/protoc" + else + echo "protoc not found" + exit 1 + fi +fi -cd $(dirname $0)/../../.. +TMP_DIR=${TMP_DIR}_${PROTO_FILE} [ ! -d $HEADER_DIR ] && mkdir -p $HEADER_DIR || : [ ! -d $SRC_DIR ] && mkdir -p $SRC_DIR || : @@ -56,6 +75,9 @@ sed -i "s/\"${PROTO_FILE}.pb.h\"/<${INCLUDE_DIR/\//\\\/}\/${PROTO_FILE}.pb.h>/g" sed -i "s/\"${PROTO_FILE}.pb.h\"/<${INCLUDE_DIR/\//\\\/}\/${PROTO_FILE}.pb.h>/g" ${TMP_DIR}/${PROTO_FILE}.grpc.pb.cc sed -i "s/\"${PROTO_FILE}.grpc.pb.h\"/<${INCLUDE_DIR/\//\\\/}\/${PROTO_FILE}.grpc.pb.h>/g" ${TMP_DIR}/${PROTO_FILE}.grpc.pb.cc +sed -i "1s/.*/\/\/ Generated by tools\/codegen\/extensions\/gen_reflection_proto.sh/g" ${TMP_DIR}/*.pb.h +sed -i "1s/.*/\/\/ Generated by tools\/codegen\/extensions\/gen_reflection_proto.sh/g" ${TMP_DIR}/*.pb.cc + /bin/cp LICENSE ${TMP_DIR}/TMP_LICENSE sed -i -e "s/./ &/" -e "s/.*/ \*&/" ${TMP_DIR}/TMP_LICENSE sed -i -r "\$a\ *\n *\/\n\n" ${TMP_DIR}/TMP_LICENSE |