Merge remote-tracking branch 'upstream/master' into fail_fast

pull/8219/head
Mark D. Roth 8 years ago
commit 5db24978b6
  1. 2
      doc/core/pending_api_cleanups.md
  2. 2
      include/grpc++/ext/reflection.grpc.pb.h
  3. 2
      include/grpc++/ext/reflection.pb.h
  4. 6
      include/grpc/impl/codegen/grpc_types.h
  5. 6
      src/core/ext/client_config/client_config_plugin.c
  6. 31
      src/core/ext/client_config/resolver_registry.c
  7. 5
      src/core/ext/client_config/resolver_registry.h
  8. 49
      src/core/ext/client_config/subchannel_factory.c
  9. 66
      src/core/ext/client_config/subchannel_factory.h
  10. 6
      src/core/ext/lb_policy/grpclb/grpclb.c
  11. 2
      src/core/ext/lb_policy/pick_first/pick_first.c
  12. 2
      src/core/ext/lb_policy/round_robin/round_robin.c
  13. 42
      src/core/lib/channel/message_size_filter.c
  14. 2
      src/cpp/ext/reflection.grpc.pb.cc
  15. 2
      src/cpp/ext/reflection.pb.cc
  16. 1
      src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi
  17. 3
      src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
  18. 2
      test/core/surface/channel_create_test.c
  19. 2
      test/core/surface/secure_channel_create_test.c
  20. 5
      test/cpp/qps/gen_build_yaml.py
  21. 32
      tools/codegen/extensions/gen_reflection_proto.sh
  22. 10448
      tools/run_tests/tests.json

@ -13,3 +13,5 @@ number:
- remove `GRPC_ARG_MAX_MESSAGE_LENGTH` channel arg from
`include/grpc/impl/codegen/grpc_types.h` (commit `af00d8b`)
- remove `ServerBuilder::SetMaxMessageSize()` method from
`include/grpc++/server_builder.h` (commit `6980362`)

@ -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:

@ -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

@ -148,11 +148,13 @@ typedef struct {
/** Maximum number of concurrent incoming streams to allow on a http2
connection. Int valued. */
#define GRPC_ARG_MAX_CONCURRENT_STREAMS "grpc.max_concurrent_streams"
/** Maximum message length that the channel can receive. Int valued, bytes. */
/** Maximum message length that the channel can receive. Int valued, bytes.
-1 means unlimited. */
#define GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH "grpc.max_receive_message_length"
/** \deprecated For backward compatibility. */
#define GRPC_ARG_MAX_MESSAGE_LENGTH GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH
/** Maximum message length that the channel can send. Int valued, bytes. */
/** Maximum message length that the channel can send. Int valued, bytes.
-1 means unlimited. */
#define GRPC_ARG_MAX_SEND_MESSAGE_LENGTH "grpc.max_send_message_length"
/** Initial sequence number for http2 transports. Int valued. */
#define GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER \

@ -43,10 +43,6 @@
#include "src/core/ext/client_config/subchannel_index.h"
#include "src/core/lib/surface/channel_init.h"
#ifndef GRPC_DEFAULT_NAME_PREFIX
#define GRPC_DEFAULT_NAME_PREFIX "dns:///"
#endif
static bool append_filter(grpc_channel_stack_builder *builder, void *arg) {
return grpc_channel_stack_builder_append_filter(
builder, (const grpc_channel_filter *)arg, NULL, NULL);
@ -79,7 +75,7 @@ static bool set_default_host_if_unset(grpc_channel_stack_builder *builder,
void grpc_client_config_init(void) {
grpc_lb_policy_registry_init();
grpc_resolver_registry_init(GRPC_DEFAULT_NAME_PREFIX);
grpc_resolver_registry_init();
grpc_subchannel_index_init();
grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MIN,
set_default_host_if_unset, NULL);

@ -40,22 +40,20 @@
#include <grpc/support/string_util.h>
#define MAX_RESOLVERS 10
#define DEFAULT_RESOLVER_PREFIX_MAX_LENGTH 32
static grpc_resolver_factory *g_all_of_the_resolvers[MAX_RESOLVERS];
static int g_number_of_resolvers = 0;
static char *g_default_resolver_prefix;
static char g_default_resolver_prefix[DEFAULT_RESOLVER_PREFIX_MAX_LENGTH] =
"dns:///";
void grpc_resolver_registry_init(const char *default_resolver_prefix) {
g_default_resolver_prefix = gpr_strdup(default_resolver_prefix);
}
void grpc_resolver_registry_init() {}
void grpc_resolver_registry_shutdown(void) {
int i;
for (i = 0; i < g_number_of_resolvers; i++) {
for (int i = 0; i < g_number_of_resolvers; i++) {
grpc_resolver_factory_unref(g_all_of_the_resolvers[i]);
}
gpr_free(g_default_resolver_prefix);
// FIXME(ctiller): this should live in grpc_resolver_registry_init,
// however that would have the client_config plugin call this AFTER we start
// registering resolvers from third party plugins, and so they'd never show
@ -65,6 +63,17 @@ void grpc_resolver_registry_shutdown(void) {
g_number_of_resolvers = 0;
}
void grpc_resolver_registry_set_default_prefix(
const char *default_resolver_prefix) {
const size_t len = strlen(default_resolver_prefix);
GPR_ASSERT(len < DEFAULT_RESOLVER_PREFIX_MAX_LENGTH &&
"default resolver prefix too long");
GPR_ASSERT(len > 0 && "default resolver prefix can't be empty");
// By the previous assert, default_resolver_prefix is safe to be copied with a
// plain strcpy.
strcpy(g_default_resolver_prefix, default_resolver_prefix);
}
void grpc_register_resolver_type(grpc_resolver_factory *factory) {
int i;
for (i = 0; i < g_number_of_resolvers; i++) {
@ -108,7 +117,6 @@ static grpc_resolver_factory *resolve_factory(const char *target,
*uri = grpc_uri_parse(target, 1);
factory = lookup_factory_by_uri(*uri);
if (factory == NULL) {
if (g_default_resolver_prefix != NULL) {
grpc_uri_destroy(*uri);
gpr_asprintf(&tmp, "%s%s", g_default_resolver_prefix, target);
*uri = grpc_uri_parse(tmp, 1);
@ -116,14 +124,9 @@ static grpc_resolver_factory *resolve_factory(const char *target,
if (factory == NULL) {
grpc_uri_destroy(grpc_uri_parse(target, 0));
grpc_uri_destroy(grpc_uri_parse(tmp, 0));
gpr_log(GPR_ERROR, "don't know how to resolve '%s' or '%s'", target,
tmp);
gpr_log(GPR_ERROR, "don't know how to resolve '%s' or '%s'", target, tmp);
}
gpr_free(tmp);
} else {
grpc_uri_destroy(grpc_uri_parse(target, 0));
gpr_log(GPR_ERROR, "don't know how to resolve '%s'", target);
}
}
return factory;
}

@ -36,9 +36,12 @@
#include "src/core/ext/client_config/resolver_factory.h"
void grpc_resolver_registry_init(const char *default_prefix);
void grpc_resolver_registry_init();
void grpc_resolver_registry_shutdown(void);
/** Set the default URI prefix to \a default_prefix. */
void grpc_resolver_registry_set_default_prefix(const char *default_prefix);
/** Register a resolver type.
URI's of \a scheme will be resolved with the given resolver.
If \a priority is greater than zero, then the resolver will be eligible

@ -1,49 +0,0 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/ext/client_config/subchannel_factory.h"
void grpc_subchannel_factory_ref(grpc_subchannel_factory* factory) {
factory->vtable->ref(factory);
}
void grpc_subchannel_factory_unref(grpc_exec_ctx* exec_ctx,
grpc_subchannel_factory* factory) {
factory->vtable->unref(exec_ctx, factory);
}
grpc_subchannel* grpc_subchannel_factory_create_subchannel(
grpc_exec_ctx* exec_ctx, grpc_subchannel_factory* factory,
grpc_subchannel_args* args) {
return factory->vtable->create_subchannel(exec_ctx, factory, args);
}

@ -1,66 +0,0 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
#define GRPC_CORE_EXT_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
#include "src/core/ext/client_config/subchannel.h"
#include "src/core/lib/channel/channel_stack.h"
typedef struct grpc_subchannel_factory grpc_subchannel_factory;
typedef struct grpc_subchannel_factory_vtable grpc_subchannel_factory_vtable;
/** Constructor for new configured channels.
Creating decorators around this type is encouraged to adapt behavior. */
struct grpc_subchannel_factory {
const grpc_subchannel_factory_vtable *vtable;
};
struct grpc_subchannel_factory_vtable {
void (*ref)(grpc_subchannel_factory *factory);
void (*unref)(grpc_exec_ctx *exec_ctx, grpc_subchannel_factory *factory);
grpc_subchannel *(*create_subchannel)(grpc_exec_ctx *exec_ctx,
grpc_subchannel_factory *factory,
grpc_subchannel_args *args);
};
void grpc_subchannel_factory_ref(grpc_subchannel_factory *factory);
void grpc_subchannel_factory_unref(grpc_exec_ctx *exec_ctx,
grpc_subchannel_factory *factory);
/** Create a new grpc_subchannel */
grpc_subchannel *grpc_subchannel_factory_create_subchannel(
grpc_exec_ctx *exec_ctx, grpc_subchannel_factory *factory,
grpc_subchannel_args *args);
#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H */

@ -926,10 +926,8 @@ static lb_client_data *lb_client_data_create(glb_lb_policy *glb_policy) {
grpc_closure_init(&lb_client->close_sent, close_sent_cb, lb_client);
grpc_closure_init(&lb_client->srv_status_rcvd, srv_status_rcvd_cb, lb_client);
/* TODO(dgq): get the deadline from the client config instead of fabricating
* one here. */
lb_client->deadline = gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
gpr_time_from_seconds(3, GPR_TIMESPAN));
/* TODO(dgq): get the deadline from the parent channel. */
lb_client->deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
/* Note the following LB call progresses every time there's activity in \a
* glb_policy->base.interested_parties, which is comprised of the polling

@ -466,6 +466,8 @@ static grpc_lb_policy *create_pick_first(grpc_exec_ctx *exec_ctx,
}
memset(&sc_args, 0, sizeof(grpc_subchannel_args));
/* server_name will be copied as part of the subchannel creation. This makes
* the copying of args->server_name (a borrowed pointer) OK. */
sc_args.server_name = args->server_name;
sc_args.addr =
(struct sockaddr *)(&args->addresses->addresses[i].address.addr);

@ -629,6 +629,8 @@ static grpc_lb_policy *round_robin_create(grpc_exec_ctx *exec_ctx,
if (args->addresses->addresses[i].is_balancer) continue;
memset(&sc_args, 0, sizeof(grpc_subchannel_args));
/* server_name will be copied as part of the subchannel creation. This makes
* the copying of args->server_name (a borrowed pointer) OK. */
sc_args.server_name = args->server_name;
sc_args.addr =
(struct sockaddr *)(&args->addresses->addresses[i].address.addr);

@ -40,8 +40,9 @@
#include "src/core/lib/channel/channel_args.h"
#define DEFAULT_MAX_SEND_MESSAGE_LENGTH -1 // Unlimited.
// The protobuf library will (by default) start warning at 100 megs.
#define DEFAULT_MAX_MESSAGE_LENGTH (4 * 1024 * 1024)
#define DEFAULT_MAX_RECV_MESSAGE_LENGTH (4 * 1024 * 1024)
typedef struct call_data {
// Receive closures are chained: we inject this closure as the
@ -55,8 +56,8 @@ typedef struct call_data {
} call_data;
typedef struct channel_data {
size_t max_send_size;
size_t max_recv_size;
int max_send_size;
int max_recv_size;
} channel_data;
// Callback invoked when we receive a message. Here we check the max
@ -66,12 +67,12 @@ static void recv_message_ready(grpc_exec_ctx* exec_ctx, void* user_data,
grpc_call_element* elem = user_data;
call_data* calld = elem->call_data;
channel_data* chand = elem->channel_data;
if (*calld->recv_message != NULL &&
(*calld->recv_message)->length > chand->max_recv_size) {
if (*calld->recv_message != NULL && chand->max_recv_size >= 0 &&
(*calld->recv_message)->length > (size_t)chand->max_recv_size) {
char* message_string;
gpr_asprintf(
&message_string, "Received message larger than max (%u vs. %lu)",
(*calld->recv_message)->length, (unsigned long)chand->max_recv_size);
gpr_asprintf(&message_string,
"Received message larger than max (%u vs. %d)",
(*calld->recv_message)->length, chand->max_recv_size);
gpr_slice message = gpr_slice_from_copied_string(message_string);
gpr_free(message_string);
grpc_call_element_send_cancel_with_message(
@ -88,11 +89,11 @@ static void start_transport_stream_op(grpc_exec_ctx* exec_ctx,
call_data* calld = elem->call_data;
channel_data* chand = elem->channel_data;
// Check max send message size.
if (op->send_message != NULL &&
op->send_message->length > chand->max_send_size) {
if (op->send_message != NULL && chand->max_send_size >= 0 &&
op->send_message->length > (size_t)chand->max_send_size) {
char* message_string;
gpr_asprintf(&message_string, "Sent message larger than max (%u vs. %lu)",
op->send_message->length, (unsigned long)chand->max_send_size);
gpr_asprintf(&message_string, "Sent message larger than max (%u vs. %d)",
op->send_message->length, chand->max_send_size);
gpr_slice message = gpr_slice_from_copied_string(message_string);
gpr_free(message_string);
grpc_call_element_send_cancel_with_message(
@ -130,19 +131,22 @@ static void init_channel_elem(grpc_exec_ctx* exec_ctx,
GPR_ASSERT(!args->is_last);
channel_data* chand = elem->channel_data;
memset(chand, 0, sizeof(*chand));
chand->max_send_size = DEFAULT_MAX_MESSAGE_LENGTH;
chand->max_recv_size = DEFAULT_MAX_MESSAGE_LENGTH;
const grpc_integer_options options = {DEFAULT_MAX_MESSAGE_LENGTH, 0, INT_MAX};
chand->max_send_size = DEFAULT_MAX_SEND_MESSAGE_LENGTH;
chand->max_recv_size = DEFAULT_MAX_RECV_MESSAGE_LENGTH;
for (size_t i = 0; i < args->channel_args->num_args; ++i) {
if (strcmp(args->channel_args->args[i].key,
GRPC_ARG_MAX_SEND_MESSAGE_LENGTH) == 0) {
chand->max_send_size = (size_t)grpc_channel_arg_get_integer(
&args->channel_args->args[i], options);
const grpc_integer_options options = {DEFAULT_MAX_SEND_MESSAGE_LENGTH, 0,
INT_MAX};
chand->max_send_size =
grpc_channel_arg_get_integer(&args->channel_args->args[i], options);
}
if (strcmp(args->channel_args->args[i].key,
GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH) == 0) {
chand->max_recv_size = (size_t)grpc_channel_arg_get_integer(
&args->channel_args->args[i], options);
const grpc_integer_options options = {DEFAULT_MAX_RECV_MESSAGE_LENGTH, 0,
INT_MAX};
chand->max_recv_size =
grpc_channel_arg_get_integer(&args->channel_args->args[i], options);
}
}
}

@ -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

@ -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

@ -136,6 +136,7 @@ cdef extern from "grpc/grpc.h":
const char *GRPC_ARG_ENABLE_CENSUS
const char *GRPC_ARG_MAX_CONCURRENT_STREAMS
const char *GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH
const char *GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
const char *GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER
const char *GRPC_ARG_DEFAULT_AUTHORITY
const char *GRPC_ARG_PRIMARY_USER_AGENT_STRING

@ -39,7 +39,8 @@ class ConnectivityState:
class ChannelArgKey:
enable_census = GRPC_ARG_ENABLE_CENSUS
max_concurrent_streams = GRPC_ARG_MAX_CONCURRENT_STREAMS
max_message_length = GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH
max_receive_message_length = GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH
max_send_message_length = GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
http2_initial_sequence_number = GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER
default_authority = GRPC_ARG_DEFAULT_AUTHORITY
primary_user_agent_string = GRPC_ARG_PRIMARY_USER_AGENT_STRING

@ -40,7 +40,7 @@ void test_unknown_scheme_target(void) {
grpc_channel *chan;
/* avoid default prefix */
grpc_resolver_registry_shutdown();
grpc_resolver_registry_init("");
grpc_resolver_registry_init();
chan = grpc_insecure_channel_create("blah://blah", NULL, NULL);
GPR_ASSERT(chan != NULL);

@ -46,7 +46,7 @@ void test_unknown_scheme_target(void) {
grpc_channel *chan;
grpc_channel_credentials *creds;
grpc_resolver_registry_shutdown();
grpc_resolver_registry_init("");
grpc_resolver_registry_init();
creds = grpc_fake_transport_security_credentials_create();
chan = grpc_secure_channel_create(creds, "blah://blah", NULL, NULL);

@ -74,8 +74,8 @@ print yaml.dump({
'name': 'json_run_localhost',
'shortname': 'json_run_localhost:%s' % scenario_json['name'],
'args': ['--scenarios_json', _scenario_json_string(scenario_json)],
'ci_platforms': ['linux', 'mac', 'posix', 'windows'],
'platforms': ['linux', 'mac', 'posix', 'windows'],
'ci_platforms': ['linux'],
'platforms': ['linux'],
'flaky': False,
'language': 'c++',
'boringssl': True,
@ -85,5 +85,6 @@ print yaml.dump({
'timeout_seconds': 3*60
}
for scenario_json in scenario_config.CXXLanguage().scenarios()
if 'scalable' in scenario_json.get('CATEGORIES', [])
]
})

@ -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

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save