From 27e96f9beb04084686b179ee65503d6a7f8ad1b7 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Thu, 22 Sep 2016 20:56:46 -0700 Subject: Add comments about how to re-generate reflection proto files --- include/grpc++/ext/reflection.grpc.pb.h | 2 +- include/grpc++/ext/reflection.pb.h | 2 +- src/cpp/ext/reflection.grpc.pb.cc | 2 +- src/cpp/ext/reflection.pb.cc | 2 +- tools/codegen/extensions/gen_reflection_proto.sh | 3 +++ 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/grpc++/ext/reflection.grpc.pb.h b/include/grpc++/ext/reflection.grpc.pb.h index 064117e303..f95ffd6a35 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_refelction_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..5821b0d5ae 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_refelction_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..b107b29b4a 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_refelction_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..a27cb275be 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_refelction_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..d55272803f 100755 --- a/tools/codegen/extensions/gen_reflection_proto.sh +++ b/tools/codegen/extensions/gen_reflection_proto.sh @@ -56,6 +56,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_refelction_proto.sh/g" ${TMP_DIR}/*.pb.h +sed -i "1s/.*/\/\/ Generated by tools\/codegen\/extensions\/gen_refelction_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 -- cgit v1.2.3 From 2383a4129da6641e3fb0d9f7c4d1059d43851b8c Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Thu, 22 Sep 2016 21:31:39 -0700 Subject: Check protoc and grpc_cpp_plugin --- tools/codegen/extensions/gen_reflection_proto.sh | 29 ++++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/tools/codegen/extensions/gen_reflection_proto.sh b/tools/codegen/extensions/gen_reflection_proto.sh index d55272803f..db997556ec 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 || : -- cgit v1.2.3 From ef394a954a326f42bf236f2db49fcfd84f50339b Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 23 Sep 2016 14:04:33 -0700 Subject: Fix typo --- include/grpc++/ext/reflection.grpc.pb.h | 2 +- include/grpc++/ext/reflection.pb.h | 2 +- src/cpp/ext/reflection.grpc.pb.cc | 2 +- src/cpp/ext/reflection.pb.cc | 2 +- tools/codegen/extensions/gen_reflection_proto.sh | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/grpc++/ext/reflection.grpc.pb.h b/include/grpc++/ext/reflection.grpc.pb.h index f95ffd6a35..6e56088497 100644 --- a/include/grpc++/ext/reflection.grpc.pb.h +++ b/include/grpc++/ext/reflection.grpc.pb.h @@ -32,7 +32,7 @@ */ -// Generated by tools/codegen/extensions/gen_refelction_proto.sh +// 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 5821b0d5ae..caa1592424 100644 --- a/include/grpc++/ext/reflection.pb.h +++ b/include/grpc++/ext/reflection.pb.h @@ -32,7 +32,7 @@ */ -// Generated by tools/codegen/extensions/gen_refelction_proto.sh +// 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 b107b29b4a..8139c8ea16 100644 --- a/src/cpp/ext/reflection.grpc.pb.cc +++ b/src/cpp/ext/reflection.grpc.pb.cc @@ -32,7 +32,7 @@ */ -// Generated by tools/codegen/extensions/gen_refelction_proto.sh +// 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 a27cb275be..b50465b9b5 100644 --- a/src/cpp/ext/reflection.pb.cc +++ b/src/cpp/ext/reflection.pb.cc @@ -32,7 +32,7 @@ */ -// Generated by tools/codegen/extensions/gen_refelction_proto.sh +// 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 db997556ec..ea7689f7e8 100755 --- a/tools/codegen/extensions/gen_reflection_proto.sh +++ b/tools/codegen/extensions/gen_reflection_proto.sh @@ -75,8 +75,8 @@ 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_refelction_proto.sh/g" ${TMP_DIR}/*.pb.h -sed -i "1s/.*/\/\/ Generated by tools\/codegen\/extensions\/gen_refelction_proto.sh/g" ${TMP_DIR}/*.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 -- cgit v1.2.3