Merge github.com:grpc/grpc into maxmsgsz

pull/9404/head
Craig Tiller 8 years ago
commit ba7a84b2a8
  1. 9885
      CMakeLists.txt
  2. 74
      INSTALL.md
  3. 6
      include/grpc++/impl/codegen/config.h
  4. 4
      include/grpc++/support/channel_arguments.h
  5. 4
      src/core/ext/client_channel/resolver_registry.h
  6. 5
      src/core/lib/iomgr/resource_quota.c
  7. 6
      src/core/lib/iomgr/resource_quota.h
  8. 8
      src/cpp/common/channel_arguments.cc
  9. 23
      src/python/grpcio/grpc/__init__.py
  10. 154
      templates/CMakeLists.txt.template
  11. 76
      templates/vsprojects/generate_debug_projects.sh
  12. 2
      third_party/gflags
  13. 76
      tools/buildgen/generate_projects-old.sh
  14. 0
      tools/distrib/yapf_code.sh
  15. 1
      tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile
  16. 2
      tools/jenkins/build_artifacts.sh
  17. 2
      tools/run_tests/artifacts/build_artifact_protoc.bat
  18. 2
      tools/run_tests/sanity/check_submodules.sh
  19. 2
      tools/run_tests/sanity/sanity_tests.yaml
  20. 85
      vsprojects/README.md

File diff suppressed because it is too large Load Diff

@ -61,49 +61,45 @@ gRPC C Core library.
There are several ways to build under Windows, of varying complexity depending
on experience with the tools involved.
<!--
###Visual Studio
###Pre-generated Visual Studio solution
Versions 2013 and 2015 are both supported. You can use [their respective
community
editions](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx).
Building the C Core:
- Open [grpc.sln](https://github.com/grpc/grpc/blob/master/vsprojects/grpc.sln).
- Select your build target.
- Build the `grpc` project.
The pre-generated VS projects & solution are checked into the repository under the [vsprojects](/vsprojects) directory.
###Building using CMake (with BoringSSL)
- Install [CMake](https://cmake.org/download/).
- Install [Active State Perl](http://www.activestate.com/activeperl/) (`choco install activeperl`)
- Install [Ninja](https://ninja-build.org/) (`choco install ninja`)
- Install [Go](https://golang.org/dl/) (`choco install golang`)
- Install [yasm](http://yasm.tortall.net/) and add it to `PATH` (`choco install yasm`)
- Run these commands in the repo root directory
```
> md .build
> cd .build
> call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x64
> cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release
> cmake --build .
```
NOTE: Currently you can only use Ninja to build using cmake on Windows (because of the boringssl dependency).
Building the C++ runtime:
- You need [CMake](https://cmake.org/) on your path to build protobuf (see below
for building using solely CMake).
- Run `vsprojects/build_protos.bat` (needs `cmake.exe` in your path).
- Open [buildtests_cxx.sln]()
- Select your build target.
- build the `grpc++` project.
-->
###msys2 (with mingw)
###msys2
The Makefile (and source code) should support msys2's mingw32 and mingw64
compilers. Building with msys2's native compiler is also possible, but
difficult.
This approach requires having [msys2](https://msys2.github.io/) installed.
```
# Install prerequisites
MSYS2$ pacman -S autoconf automake gcc libtool mingw-w64-x86_64-toolchain perl pkg-config zlib
MSYS2$ pacman -S mingw-w64-x86_64-gflags
```
- The Makefile (and source code) should support msys2's mingw32 and mingw64
compilers. Building with msys2's native compiler is also possible, but
difficult.
- The Makefile is expecting the Windows versions of OpenSSL (see
https://slproweb.com/products/Win32OpenSSL.html). It's also possible to build
the Windows version of OpenSSL from scratch. The output should be `libeay32`
and `ssleay32`.
- If you are not installing the above files under msys2's path, you may specify
it, for instance, in the following way:
```CPPFLAGS=”-I/c/OpenSSL-Win32/include” LDFLAGS=”-L/c/OpenSSL-Win32/lib” make static_c```
- [protobuf3](https://github.com/google/protobuf/blob/master/src/README.md#c-installation---windows)
must be installed on the msys2 path.
###Cmake (experimental)
```
# From mingw shell
MINGW64$ export CPPFLAGS="-D_WIN32_WINNT=0x0600"
MINGW64$ make
```
- Install [CMake](https://cmake.org/download/).
- Run it over [grpc's
CMakeLists.txt](https://github.com/grpc/grpc/blob/master/CMakeLists.txt) to
generate "projects" for your compiler.
- Build with your compiler of choice. The generated build files should have the
protobuf3 dependency baked in.
NOTE: While most of the make targets are buildable under Mingw, some haven't been ported to Windows yet
and may fail to build (mostly trying to include POSIX headers not available on Mingw).

@ -39,6 +39,12 @@
#define GRPC_CUSTOM_STRING std::string
#endif
// The following macros are deprecated and appear only for users
// with PB files generated using gRPC 1.0.x plugins. They should
// not be used in new code
#define GRPC_OVERRIDE override // deprecated
#define GRPC_FINAL final // deprecated
namespace grpc {
typedef GRPC_CUSTOM_STRING string;

@ -88,6 +88,10 @@ class ChannelArguments {
/// The given buffer pool will be attached to the constructed channel
void SetResourceQuota(const ResourceQuota& resource_quota);
/// Sets the max receive and send message sizes.
void SetMaxReceiveMessageSize(int size);
void SetMaxSendMessageSize(int size);
/// Set LB policy name.
/// Note that if the name resolver returns only balancer addresses, the
/// grpclb LB policy will be used, regardless of what is specified here.

@ -60,7 +60,9 @@ void grpc_register_resolver_type(grpc_resolver_factory *factory);
return it.
If a resolver factory was not found, return NULL.
\a args is a set of channel arguments to be included in the result
(typically the set of arguments passed in from the client API). */
(typically the set of arguments passed in from the client API).
\a pollset_set is used to drive IO in the name resolution process, it
should not be NULL. */
grpc_resolver *grpc_resolver_create(grpc_exec_ctx *exec_ctx, const char *target,
const grpc_channel_args *args,
grpc_pollset_set *pollset_set);

@ -691,6 +691,11 @@ grpc_resource_user *grpc_resource_user_create(
return resource_user;
}
grpc_resource_quota *grpc_resource_user_quota(
grpc_resource_user *resource_user) {
return resource_user->resource_quota;
}
static void ru_ref_by(grpc_resource_user *resource_user, gpr_atm amount) {
GPR_ASSERT(amount > 0);
GPR_ASSERT(gpr_atm_no_barrier_fetch_add(&resource_user->refs, amount) != 0);

@ -88,6 +88,12 @@ typedef struct grpc_resource_user grpc_resource_user;
grpc_resource_user *grpc_resource_user_create(
grpc_resource_quota *resource_quota, const char *name);
/* Returns a borrowed reference to the underlying resource quota for this
resource user. */
grpc_resource_quota *grpc_resource_user_quota(
grpc_resource_user *resource_user);
void grpc_resource_user_ref(grpc_resource_user *resource_user);
void grpc_resource_user_unref(grpc_exec_ctx *exec_ctx,
grpc_resource_user *resource_user);

@ -143,6 +143,14 @@ void ChannelArguments::SetResourceQuota(
grpc_resource_quota_arg_vtable());
}
void ChannelArguments::SetMaxReceiveMessageSize(int size) {
SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, size);
}
void ChannelArguments::SetMaxSendMessageSize(int size) {
SetInt(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, size);
}
void ChannelArguments::SetLoadBalancingPolicyName(
const grpc::string& lb_policy_name) {
SetString(GRPC_ARG_LB_POLICY_NAME, lb_policy_name);

@ -487,9 +487,9 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
Returns:
An object that is both a Call for the RPC and a Future. In the event of
RPC completion, the return Future's result value will be the response
message of the RPC. Should the event terminate with non-OK status, the
returned Future's exception value will be an RpcError.
RPC completion, the return Call-Future's result value will be the
response message of the RPC. Should the event terminate with non-OK
status, the returned Call-Future's exception value will be an RpcError.
"""
raise NotImplementedError()
@ -510,8 +510,8 @@ class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
Returns:
An object that is both a Call for the RPC and an iterator of response
values. Drawing response values from the returned iterator may raise
RpcError indicating termination of the RPC with non-OK status.
values. Drawing response values from the returned Call-iterator may
raise RpcError indicating termination of the RPC with non-OK status.
"""
raise NotImplementedError()
@ -535,8 +535,7 @@ class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
credentials: An optional CallCredentials for the RPC.
Returns:
The response value for the RPC, and a Call for the RPC if with_call was
set to True at invocation.
The response value for the RPC.
Raises:
RpcError: Indicating that the RPC terminated with non-OK status. The
@ -587,9 +586,9 @@ class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
Returns:
An object that is both a Call for the RPC and a Future. In the event of
RPC completion, the return Future's result value will be the response
message of the RPC. Should the event terminate with non-OK status, the
returned Future's exception value will be an RpcError.
RPC completion, the return Call-Future's result value will be the
response message of the RPC. Should the event terminate with non-OK
status, the returned Call-Future's exception value will be an RpcError.
"""
raise NotImplementedError()
@ -614,8 +613,8 @@ class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
Returns:
An object that is both a Call for the RPC and an iterator of response
values. Drawing response values from the returned iterator may raise
RpcError indicating termination of the RPC with non-OK status.
values. Drawing response values from the returned Call-iterator may
raise RpcError indicating termination of the RPC with non-OK status.
"""
raise NotImplementedError()

@ -40,6 +40,17 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<%!
import re
proto_re = re.compile('(.*)\\.proto')
def proto_replace_ext(filename, ext):
m = proto_re.match(filename)
if not m:
return filename
return '${_gRPC_PROTO_GENS_DIR}/' + m.group(1) + ext
def get_deps(target_dict):
deps = []
if target_dict.get('baselib', False):
@ -54,6 +65,8 @@
deps.append("${_gRPC_ZLIB_LIBRARIES}")
for d in target_dict.get('deps', []):
deps.append(d)
if target_dict.build == 'test' and target_dict.language == 'c++':
deps.append("${_gRPC_GFLAGS_LIBRARIES}")
return deps
%>
@ -65,6 +78,9 @@
set(PACKAGE_TARNAME "<%text>${PACKAGE_NAME}-${PACKAGE_VERSION}</%text>")
set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/")
project(<%text>${PACKAGE_NAME}</%text> C CXX)
# Options
option(gRPC_BUILD_TESTS "Build tests" OFF)
if (NOT MSVC)
set(gRPC_INSTALL ON CACHE BOOL "Generate installation target")
@ -80,7 +96,10 @@
set(gRPC_PROTOBUF_PROVIDER "module" CACHE STRING "Provider of protobuf library")
set_property(CACHE gRPC_PROTOBUF_PROVIDER PROPERTY STRINGS "module" "package")
set(gRPC_GFLAGS_PROVIDER "module" CACHE STRING "Provider of gflags library")
set_property(CACHE gRPC_GFLAGS_PROVIDER PROPERTY STRINGS "module" "package")
set(gRPC_USE_PROTO_LITE OFF CACHE BOOL "Use the protobuf-lite library")
if (MSVC)
@ -140,6 +159,9 @@
if(TARGET libprotoc)
set(_gRPC_PROTOBUF_PROTOC_LIBRARIES libprotoc)
endif()
if(TARGET protoc)
set(_gRPC_PROTOBUF_PROTOC protoc)
endif()
else()
message(WARNING "gRPC_PROTOBUF_PROVIDER is \"module\" but PROTOBUF_ROOT_DIR is wrong")
endif()
@ -152,6 +174,9 @@
if(TARGET protobuf::libprotoc)
set(_gRPC_PROTOBUF_PROTOC_LIBRARIES protobuf::libprotoc)
endif()
if(TARGET protobuf::protoc)
set(_gRPC_PROTOBUF_PROTOC protobuf::protoc)
endif()
set(_gRPC_FIND_PROTOBUF "if(NOT protobuf_FOUND)\n find_package(protobuf CONFIG)\nendif()")
else()
find_package(Protobuf MODULE)
@ -178,6 +203,26 @@
endif()
set(_gRPC_FIND_SSL "if(NOT OpenSSL_FOUND)\n find_package(OpenSSL)\nendif()")
endif()
if("<%text>${gRPC_GFLAGS_PROVIDER}</%text>" STREQUAL "module")
if(NOT GFLAGS_ROOT_DIR)
set(GFLAGS_ROOT_DIR <%text>${CMAKE_CURRENT_SOURCE_DIR}</%text>/third_party/gflags)
endif()
if(EXISTS "<%text>${GFLAGS_ROOT_DIR}</%text>/CMakeLists.txt")
add_subdirectory(<%text>${GFLAGS_ROOT_DIR}</%text> third_party/gflags)
if(TARGET gflags_static)
set(_gRPC_GFLAGS_LIBRARIES gflags_static)
endif()
else()
message(WARNING "gRPC_GFLAGS_PROVIDER is \"module\" but GFLAGS_ROOT_DIR is wrong")
endif()
elseif("<%text>${gRPC_GFLAGS_PROVIDER}</%text>" STREQUAL "package")
find_package(gflags)
if(TARGET gflags::gflags)
set(_gRPC_GFLAGS_LIBRARIES gflags::gflags)
endif()
set(_gRPC_FIND_GFLAGS "if(NOT gflags_FOUND)\n find_package(gflags)\nendif()")
endif()
if(NOT MSVC)
set(CMAKE_C_FLAGS "<%text>${CMAKE_C_FLAGS}</%text> -std=c11")
@ -192,32 +237,105 @@
if(NOT DEFINED CMAKE_INSTALL_CMAKEDIR)
set(CMAKE_INSTALL_CMAKEDIR "<%text>${CMAKE_INSTALL_LIBDIR}</%text>/cmake/gRPC")
endif()
# Create directory for generated .proto files
set(_gRPC_PROTO_GENS_DIR <%text>${CMAKE_BINARY_DIR}/gens</%text>)
file(MAKE_DIRECTORY <%text>${_gRPC_PROTO_GENS_DIR}</%text>)
# protobuf_generate_grpc_cpp
# --------------------------
#
# Add custom commands to process ``.proto`` files to C++ using protoc and
# GRPC plugin::
#
# protobuf_generate_grpc_cpp [<ARGN>...]
#
# ``ARGN``
# ``.proto`` files
#
function(protobuf_generate_grpc_cpp)
if(NOT ARGN)
message(SEND_ERROR "Error: PROTOBUF_GENERATE_GRPC_CPP() called without any proto files")
return()
endif()
set(_protobuf_include_path -I .)
foreach(FIL <%text>${ARGN}</%text>)
get_filename_component(ABS_FIL <%text>${FIL}</%text> ABSOLUTE)
get_filename_component(FIL_WE <%text>${FIL}</%text> NAME_WE)
file(RELATIVE_PATH REL_FIL <%text>${CMAKE_SOURCE_DIR}</%text> <%text>${ABS_FIL}</%text>)
get_filename_component(REL_DIR <%text>${REL_FIL}</%text> DIRECTORY)
set(RELFIL_WE "<%text>${REL_DIR}/${FIL_WE}</%text>")
add_custom_command(
OUTPUT <%text>"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc"</%text>
<%text>"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h"</%text>
<%text>"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc"</%text>
<%text>"${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h"</%text>
COMMAND <%text>${_gRPC_PROTOBUF_PROTOC}</%text>
ARGS --grpc_out=<%text>${_gRPC_PROTO_GENS_DIR}</%text>
--cpp_out=<%text>${_gRPC_PROTO_GENS_DIR}</%text>
--plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin>
<%text>${_protobuf_include_path}</%text>
<%text>${REL_FIL}</%text>
DEPENDS <%text>${ABS_FIL}</%text> <%text>${_gRPC_PROTOBUF_PROTOC}</%text> grpc_cpp_plugin
WORKING_DIRECTORY <%text>${CMAKE_SOURCE_DIR}</%text>
COMMENT "Running gRPC C++ protocol buffer compiler on <%text>${FIL}</%text>"
VERBATIM)
<%text>set_source_files_properties("${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc" "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h" "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc" "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h" PROPERTIES GENERATED TRUE)</%text>
endforeach()
endfunction()
% for lib in libs:
% if lib.build in ["all", "protoc", "tool"] and lib.language in ['c', 'c++']:
## TODO(jtattermusch): grpc++_reflection includes .proto files
## which is not yet supported and thus fails the entire build.
## Re-enable once fixed.
% if lib.name != 'grpc++_reflection':
${cc_library(lib)}
${cc_install(lib)}
% if lib.build in ["all", "protoc", "tool", "test", "private"] and lib.language in ['c', 'c++']:
% if not lib.get('build_system', []) or 'cmake' in lib.get('build_system', []):
% if lib.build in ["test", "private"]:
if (gRPC_BUILD_TESTS)
${cc_library(lib)}
endif (gRPC_BUILD_TESTS)
% else:
${cc_library(lib)}
${cc_install(lib)}
% endif
% endif
% endif
% endfor
% for tgt in targets:
% if tgt.build in ["all", "protoc", "tool"] and tgt.language in ['c', 'c++']:
% if tgt.build in ["all", "protoc", "tool", "test", "private"] and tgt.language in ['c', 'c++']:
% if tgt.build in ["test", "private"]:
if (gRPC_BUILD_TESTS)
${cc_binary(tgt)}
endif (gRPC_BUILD_TESTS)
% else:
${cc_binary(tgt)}
${cc_install(tgt)}
% endif
% endif
% endfor
<%def name="cc_library(lib)">
add_library(${lib.name}
% for src in lib.src:
% if not proto_re.match(src):
${src}
% else:
${proto_replace_ext(src, '.pb.cc')}
${proto_replace_ext(src, '.grpc.pb.cc')}
${proto_replace_ext(src, '.pb.h')}
${proto_replace_ext(src, '.grpc.pb.h')}
% endif
% endfor
)
% for src in lib.src:
% if proto_re.match(src):
protobuf_generate_grpc_cpp(
${src}
)
% endif
% endfor
target_include_directories(${lib.name}
PRIVATE <%text>${CMAKE_CURRENT_SOURCE_DIR}</%text>
@ -226,6 +344,14 @@
PRIVATE <%text>${PROTOBUF_ROOT_DIR}</%text>/src
PRIVATE <%text>${ZLIB_INCLUDE_DIR}</%text>
PRIVATE <%text>${CMAKE_CURRENT_BINARY_DIR}</%text>/third_party/zlib
PRIVATE <%text>${CMAKE_CURRENT_BINARY_DIR}</%text>/third_party/gflags/include
% if lib.build in ['test', 'private'] and lib.language == 'c++':
PRIVATE third_party/googletest/include
PRIVATE third_party/googletest
% endif
% if any(proto_re.match(src) for src in lib.src):
PRIVATE <%text>${_gRPC_PROTO_GENS_DIR}</%text>
% endif
)
% if len(get_deps(lib)) > 0:
@ -256,6 +382,9 @@
% for src in tgt.src:
${src}
% endfor
% if tgt.build == 'test' and tgt.language == 'c++':
third_party/googletest/src/gtest-all.cc
% endif
)
target_include_directories(${tgt.name}
@ -265,6 +394,11 @@
PRIVATE <%text>${PROTOBUF_ROOT_DIR}</%text>/src
PRIVATE <%text>${ZLIB_ROOT_DIR}</%text>
PRIVATE <%text>${CMAKE_CURRENT_BINARY_DIR}</%text>/third_party/zlib
PRIVATE <%text>${CMAKE_CURRENT_BINARY_DIR}</%text>/third_party/gflags/include
% if tgt.build in ['test', 'private'] and tgt.language == 'c++':
PRIVATE third_party/googletest/include
PRIVATE third_party/googletest
% endif
)
% if len(get_deps(tgt)) > 0:

@ -1,76 +0,0 @@
#!/bin/sh
# 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.
# To properly use this, you'll need to add:
#
# "debug": true
#
# to build.json
cd `dirname $0`/../..
git add . #because we're using "git diff" to find changes to grpc.sln and then make files based on those changes, this prevents this file or other files from possibly being found in the diff
./tools/buildgen/generate_projects-old.sh
line_number=0
git diff |
grep -A2 \\+Project | #find "Project" immediately after a backslash (escaped), plus 2 additional lines to capture the "libs = ", plus 1 line of "--". matches will come from the generated grpc.sln
while read p ; do
line_number=$((line_number + 1))
if [ "$line_number" -gt "4" ]; then
line_number=1;
fi
echo $line_number
echo $p
if [ "$line_number" -eq "1" ]; then
project_name=$(echo "$p" | cut -d\" -f 4) #sed: extract line N only; cut with delimiter: ". select only field 4
fi
if [ "$line_number" -eq "3" ]; then
lib_setting=$(echo "$p" | cut -d\" -f 2) #
echo "project_name"
echo $project_name
echo "lib_setting"
echo $lib_setting
mkdir -p templates/vsprojects/$project_name
if [ "$lib_setting" = "True" ]; then
echo "lib: true"
echo '<%namespace file="../vcxproj_defs.include" import="gen_project"/>${gen_project("'$project_name'", libs)}' > templates/vsprojects/$project_name/$project_name.vcxproj.template
else
echo "lib: not true"
echo '<%namespace file="../vcxproj_defs.include" import="gen_project"/>${gen_project("'$project_name'", targets)}' > templates/vsprojects/$project_name/$project_name.vcxproj.template
fi
fi
# sleep .5 #for testing
done
./tools/buildgen/generate_projects-old.sh

@ -1 +1 @@
Subproject commit 05b155ff59114735ec8cd089f669c4c3d8f59029
Subproject commit f8a0efe03aa69b3336d8e228b37d4ccb17324b88

@ -1,76 +0,0 @@
#!/bin/sh
# 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.
set -e
if [ "x$TEST" = "x" ] ; then
TEST=false
fi
cd `dirname $0`/../..
mako_renderer=tools/buildgen/mako_renderer.py
if [ "x$TEST" != "x" ] ; then
tools/buildgen/build-cleaner.py build.yaml
fi
. tools/buildgen/generate_build_additions.sh
global_plugins=`find ./tools/buildgen/plugins -name '*.py' |
sort | grep -v __init__ | awk ' { printf "-p %s ", $0 } '`
for dir in . ; do
local_plugins=`find $dir/templates -name '*.py' |
sort | grep -v __init__ | awk ' { printf "-p %s ", $0 } '`
plugins="$global_plugins $local_plugins"
find -L $dir/templates -type f -and -name *.template | while read file ; do
out=${dir}/${file#$dir/templates/} # strip templates dir prefix
out=${out%.*} # strip template extension
echo "generating file: $out"
yaml_files="build.yaml $gen_build_files"
data=`for i in $yaml_files ; do echo $i ; done | awk ' { printf "-d %s ", $0 } '`
if [ "x$TEST" = "xtrue" ] ; then
actual_out=$out
out=`mktemp /tmp/gentXXXXXX`
fi
mkdir -p `dirname $out` # make sure dest directory exist
$mako_renderer $plugins $data -o $out $file
if [ "x$TEST" = "xtrue" ] ; then
diff -q $out $actual_out
rm $out
fi
done
done
rm $gen_build_files

@ -46,7 +46,6 @@ RUN apt-get update && apt-get install -y \
RUN pip install pip --upgrade
RUN pip install virtualenv
RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.0.0a2 six==1.10.0
RUN pip install twisted h2
# Define the default command.
CMD ["bash"]

@ -40,7 +40,7 @@ curr_platform="$platform"
unset platform # variable named 'platform' breaks the windows build
if [ "$curr_platform" == "linux" ] && [ "$language" == "ruby" ] ; then
./tools/run_tests/build_artifact_ruby.sh
./tools/run_tests/artifacts/build_artifact_ruby.sh
else
python tools/run_tests/task_runner.py -f artifact $language $curr_platform $architecture
fi

@ -34,7 +34,7 @@ cd third_party/protobuf/cmake
mkdir build & cd build
mkdir solution & cd solution
cmake -G "%generator%" -Dprotobuf_BUILD_TESTS=OFF ../../.. || goto :error
cmake -G "%generator%" -Dprotobuf_BUILD_TESTS=OFF ../.. || goto :error
endlocal
call vsprojects/build_plugins.bat || goto :error

@ -44,7 +44,7 @@ cat << EOF | awk '{ print $1 }' | sort > $want_submodules
44c25c892a6229b20db7cd9dc05584ea865896de third_party/benchmark (v0.1.0-343-g44c25c8)
c880e42ba1c8032d4cdde2aba0541d8a9d9fa2e9 third_party/boringssl (c880e42)
886e7d75368e3f4fab3f4d0d3584e4abfc557755 third_party/boringssl-with-bazel (version_for_cocoapods_7.0-857-g886e7d7)
05b155ff59114735ec8cd089f669c4c3d8f59029 third_party/gflags (v2.1.0-45-g05b155f)
f8a0efe03aa69b3336d8e228b37d4ccb17324b88 third_party/gflags (v2.2.0)
c99458533a9b4c743ed51537e25989ea55944908 third_party/googletest (release-1.7.0)
a428e42072765993ff674fda72863c9f1aa2d268 third_party/protobuf (v3.1.0-alpha-1)
bcad91771b7f0bff28a1cac1981d7ef2b9bcef3c third_party/thrift (bcad917)

@ -12,6 +12,6 @@
- script: tools/distrib/check_trailing_newlines.sh
- script: tools/distrib/check_nanopb_output.sh
- script: tools/distrib/check_include_guards.py
- script: tools/distrib/pyformat_code.sh
- script: tools/distrib/yapf_code.sh
- script: tools/distrib/python/check_grpcio_tools.py

@ -1,8 +1,8 @@
This directory contains MS Visual Studio project & solution files.
#Pre-generated MS Visual Studio project & solution files
#Supported Visual Studio versions
Currently supported versions are Visual Studio 2013 (our primary focus).
Versions 2013 and 2015 are both supported. You can use [their respective
community
editions](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx).
#Building
We are using [NuGet](http://www.nuget.org) to pull zlib and openssl dependencies.
@ -16,8 +16,8 @@ download nuget.exe from the web and manually restore the NuGet packages.
```
After that, you can build the solution using one of these options:
1. open `grpc.sln` with Visual Studio and hit "Build".
2. build from commandline using `msbuild grpc.sln /p:Configuration=Debug`
1. open `grpc.sln` with Visual Studio and hit "Build".
2. build from commandline using `msbuild grpc.sln /p:Configuration=Debug`
#C/C++ Test Dependencies
* gtest isn't available as a git repo like the other dependencies. download it and add it to `/third_party/gtest/` (the folder will end up with `/build-aux/`, `/cmake/`, `/codegear/`, etc. folders in it).
@ -36,73 +36,18 @@ After that, you can build the solution using one of these options:
* install [NuGet](http://www.nuget.org)
* nuget should automatically bring in built versions of zlib and openssl when building grpc.sln (the versions in `/third_party/` are not used). If it doesn't work use `tools->nuget...->manage...`. The packages are put in `/vsprojects/packages/`
#C/C++ Test Solution/Project Build Steps
* A basic git version of grpc only has templates for non-test items. This checklist adds test items to grpc.sln and makes individual vs projects for them
* set up dependencies (above)
* add `"debug": true,` to the top of build.json. This is the base file for all build tracking, see [templates](https://github.com/grpc/grpc/tree/master/templates) for more information
* `"debug": true,` gets picked up by `/tools/buildgen/plugins/generate_vsprojects.py`. It tells the script to add visual studio GUIDs to all projects. Otherwise only the projects that already have GUIDs in build.json will be built
* run `/templates/vsprojects/generate_debug_projects.sh` to make debug templates/projects. This runs a regular visual studio buildgen process, which creates the `.sln` file with all of the new debug projects, then uses git diff to find the new project names from the `.sln` that need templates added. It builds the new templates based on the diff, then re-runs the visual studio buildgen, which builds the vs projects for each of the new debug targets
* copy over the `/vsprojects/` folder to your windows build setup (assuming this was built on linux in order to have easy access to python/mako and shell scripts)
* run `/templates/vsprojects/build_test_protos.sh`
* this builds all `.proto` files in `/test/` in-place. there might be a better place to put them that mirrors what happens in the linux build process (todo)
* each `.proto` file gets built into a `.grpc.pb.cc`, .`grpc.pb.h`, `.pb.cc`, and `.pb.h`. These are included in each test project in lieu of the `.proto` includes specified in `build.json`. This substitution is done by `/templates/vsprojects/vcxproj_defs.include`
* copy over the `/test/` folder in order to get the new files (assuming this was built on linux in order to have an easy protobuf+grpc plugin installation)
#Making and running tests with `/tools/run_tests/run_tests.py` or `/vsprojects/make.bat`
`run_tests.py` and `make.bat` both rely on `/vsprojects/grpc.mak`, an NMAKE script that includes C/C++ tests in addition to the base grpc projects. It builds the base projects by calling grpc.sln, but most things are built with a command line similar to a makefile workflow.
arguments for `/vsprojects/make.bat`:
* no options or `all` or `buildtests`: builds all tests
* `buildtests_c`: just c tests
* `buildtests_cxx`: just c++ tests
* names of individual tests: just those tests (example: `make.bat gpr_string_test`)
using `run_tests.py` on windows:
* when `run_tests.py` detects that it's running on windows it calls `make.bat` to build the tests and expects to find tests in `/vsprojects/test_bins/`
`run_tests.py` options:
* `run_tests.py --help`
* `run_tests.py -l c`: run c language tests
* `run_tests.py -l c++`: run c++ language tests
* note: `run_tests.py` doesn't normally show build steps, so if a build fails it is best to fall back to `make.bat`
* if `make.bat` fails, it might be easier to open up the `.sln` file in the visual studio gui (see above for how to build the test projects) and build the offending test from its project file. The `.mak` and project file templates are slightly different, so it's possible that a project will build one way and not another. Please report this if it happens.
It can be helpful to disable the firewall when running tests so that 400 connection warnings don't pop up.
Individual tests can be run by directly running the executable in `/vsprojects/run_tests/` (this is `/bins/opt/` on linux). Many C tests have no output; they either pass or fail internally and communicate this with their exit code (`0=pass`, `nonzero=fail`)
`run_tests.py` will fail if it can't build something, so not-building tests are disabled with a "platforms = posix" note in build.json. The buildgen tools will not add a test to a windows build unless it is marked "windows" or has no platforms identified. As tests are ported they will get this mark removed.
# Building protoc plugins
For generating service stub code, gRPC relies on plugins for `protoc` (the protocol buffer compiler). The solution `grpc_protoc_plugins.sln` allows you to build
Windows .exe binaries of gRPC protoc plugins.
1. Follow instructions in `third_party\protobuf\cmake\README.md` to create Visual Studio 2013 projects for protobuf.
```
$ cd third_party/protobuf/cmake
$ mkdir build & cd build
$ mkdir solution & cd solution
$ cmake -G "Visual Studio 12 2013" -Dprotobuf_BUILD_TESTS=OFF ../..
```
2. Open solution `third_party\protobuf\cmake\build\solution\protobuf.sln` and build it in Release mode. That will build libraries `libprotobuf.lib` and `libprotoc.lib` needed for the next step.
- Follow instructions in `third_party\protobuf\cmake\README.md` to create Visual Studio 2013 projects for protobuf.
```
$ cd third_party/protobuf/cmake
$ mkdir build & cd build
$ mkdir solution & cd solution
$ cmake -G "Visual Studio 12 2013" -Dprotobuf_BUILD_TESTS=OFF ../..
```
3. Open solution `vsprojects\grpc_protoc_plugins.sln` and build it in Release mode. As a result, you should obtain a set of gRPC protoc plugin binaries (`grpc_cpp_plugin.exe`, `grpc_csharp_plugin.exe`, ...)
- Open solution `third_party\protobuf\cmake\build\solution\protobuf.sln` and build it in Release mode. That will build libraries `libprotobuf.lib` and `libprotoc.lib` needed for the next step.
#Building using CMake (with BoringSSL)
1. Install [Active State Perl](http://www.activestate.com/activeperl/) (`choco install activeperl`)
2. Install [Ninja](https://ninja-build.org/) (`choco install ninja`)
2. Install [Go](https://golang.org/dl/) (`choco install golang`)
3. Install [yasm](http://yasm.tortall.net/) and add it to `PATH` (`choco install yasm`)
4. Update boringssl sumbodule to `master`
5. Run this commads in grpc directory:
```
> md .build
> cd .build
> call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x64
> cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release
> cmake --build .
```
- Open solution `vsprojects\grpc_protoc_plugins.sln` and build it in Release mode. As a result, you should obtain a set of gRPC protoc plugin binaries (`grpc_cpp_plugin.exe`, `grpc_csharp_plugin.exe`, ...)

Loading…
Cancel
Save