From 66d40c63f7bf004623dcc4dbafda96b69fc46094 Mon Sep 17 00:00:00 2001 From: yang-g Date: Wed, 12 Apr 2017 10:18:10 -0700 Subject: [PATCH] Fix BUILD dependency, copyright and cmake --- CMakeLists.txt | 4 +++- templates/CMakeLists.txt.template | 4 +++- test/cpp/util/BUILD | 3 ++- tools/distrib/check_copyright.py | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08bf646c823..0869c3a8c30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,6 +167,7 @@ if("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "module") if(NOT PROTOBUF_ROOT_DIR) set(PROTOBUF_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/protobuf) endif() + set(PROTOBUF_WELLKNOWN_IMPORT_DIR ${PROTOBUF_ROOT_DIR}/src) if(EXISTS "${PROTOBUF_ROOT_DIR}/cmake/CMakeLists.txt") set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Link static runtime libraries") add_subdirectory(${PROTOBUF_ROOT_DIR}/cmake third_party/protobuf) @@ -199,6 +200,7 @@ elseif("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "package") find_package(Protobuf MODULE) set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND)\n find_package(Protobuf)\nendif()") endif() + set(PROTOBUF_WELLKNOWN_IMPORT_DIR /usr/local/include) endif() if("${gRPC_SSL_PROVIDER}" STREQUAL "module") @@ -301,7 +303,7 @@ function(protobuf_generate_grpc_cpp) return() endif() - set(_protobuf_include_path -I .) + set(_protobuf_include_path -I . -I ${PROTOBUF_WELLKNOWN_IMPORT_DIR}) foreach(FIL ${ARGN}) get_filename_component(ABS_FIL ${FIL} ABSOLUTE) get_filename_component(FIL_WE ${FIL} NAME_WE) diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index cf69f0cc06f..c647ea57072 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -212,6 +212,7 @@ if(NOT PROTOBUF_ROOT_DIR) set(PROTOBUF_ROOT_DIR <%text>${CMAKE_CURRENT_SOURCE_DIR}/third_party/protobuf) endif() + set(PROTOBUF_WELLKNOWN_IMPORT_DIR <%text>${PROTOBUF_ROOT_DIR}/src) if(EXISTS "<%text>${PROTOBUF_ROOT_DIR}/cmake/CMakeLists.txt") set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Link static runtime libraries") add_subdirectory(<%text>${PROTOBUF_ROOT_DIR}/cmake third_party/protobuf) @@ -244,6 +245,7 @@ find_package(Protobuf MODULE) set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND)\n find_package(Protobuf)\nendif()") endif() + set(PROTOBUF_WELLKNOWN_IMPORT_DIR /usr/local/include) endif() if("<%text>${gRPC_SSL_PROVIDER}" STREQUAL "module") @@ -346,7 +348,7 @@ return() endif() - set(_protobuf_include_path -I .) + set(_protobuf_include_path -I . -I <%text>${PROTOBUF_WELLKNOWN_IMPORT_DIR}) foreach(FIL <%text>${ARGN}) get_filename_component(ABS_FIL <%text>${FIL} ABSOLUTE) get_filename_component(FIL_WE <%text>${FIL} NAME_WE) diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD index 7471ce75dd3..38f804ffd40 100644 --- a/test/cpp/util/BUILD +++ b/test/cpp/util/BUILD @@ -89,8 +89,9 @@ cc_test( "error_details_test.cc", ], deps = [ - "//external:gtest", "//:grpc++_error_details", + "//external:gtest", + "//src/proto/grpc/testing:echo_messages_proto", ], ) diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index 42005e3bd3a..0a58adf2f0a 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -113,6 +113,8 @@ _EXEMPT = frozenset(( 'src/php/tests/bootstrap.php', # census.proto copied from github 'tools/grpcz/census.proto', + # status.proto copied from googleapis + 'src/proto/grpc/status/status.proto', ))