Remove unnecessary dependencies

pull/7521/head
Yuchen Zeng 9 years ago
parent 29ca79be89
commit 28263275f0
  1. 7
      Makefile
  2. 6
      build.yaml
  3. 23
      test/cpp/util/grpc_cli.cc
  4. 22
      test/cpp/util/grpc_tool.cc
  5. 9
      test/cpp/util/grpc_tool.h
  6. 13
      tools/run_tests/sources_and_headers.json
  7. 6
      vsprojects/vcxproj/grpc_cli_libs/grpc_cli_libs.vcxproj
  8. 6
      vsprojects/vcxproj/grpc_cli_libs/grpc_cli_libs.vcxproj.filters
  9. 9
      vsprojects/vcxproj/test/grpc_cli/grpc_cli.vcxproj

@ -4097,6 +4097,7 @@ LIBGRPC_CLI_LIBS_SRC = \
test/cpp/util/grpc_tool.cc \ test/cpp/util/grpc_tool.cc \
test/cpp/util/proto_file_parser.cc \ test/cpp/util/proto_file_parser.cc \
test/cpp/util/proto_reflection_descriptor_database.cc \ test/cpp/util/proto_reflection_descriptor_database.cc \
test/cpp/util/string_ref_helper.cc \
PUBLIC_HEADERS_CXX += \ PUBLIC_HEADERS_CXX += \
@ -11004,16 +11005,16 @@ $(BINDIR)/$(CONFIG)/grpc_cli: protobuf_dep_error
else else
$(BINDIR)/$(CONFIG)/grpc_cli: $(PROTOBUF_DEP) $(GRPC_CLI_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(BINDIR)/$(CONFIG)/grpc_cli: $(PROTOBUF_DEP) $(GRPC_CLI_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(GRPC_CLI_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/grpc_cli $(Q) $(LDXX) $(LDFLAGS) $(GRPC_CLI_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/grpc_cli
endif endif
endif endif
$(OBJDIR)/$(CONFIG)/test/cpp/util/grpc_cli.o: $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(OBJDIR)/$(CONFIG)/test/cpp/util/grpc_cli.o: $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a
deps_grpc_cli: $(GRPC_CLI_OBJS:.o=.dep) deps_grpc_cli: $(GRPC_CLI_OBJS:.o=.dep)

@ -1032,15 +1032,18 @@ libs:
- test/cpp/util/grpc_tool.h - test/cpp/util/grpc_tool.h
- test/cpp/util/proto_file_parser.h - test/cpp/util/proto_file_parser.h
- test/cpp/util/proto_reflection_descriptor_database.h - test/cpp/util/proto_reflection_descriptor_database.h
- test/cpp/util/string_ref_helper.h
src: src:
- test/cpp/util/cli_call.cc - test/cpp/util/cli_call.cc
- test/cpp/util/grpc_tool.cc - test/cpp/util/grpc_tool.cc
- test/cpp/util/proto_file_parser.cc - test/cpp/util/proto_file_parser.cc
- test/cpp/util/proto_reflection_descriptor_database.cc - test/cpp/util/proto_reflection_descriptor_database.cc
- test/cpp/util/string_ref_helper.cc
deps: deps:
- grpc++_reflection - grpc++_reflection
- grpc++ - grpc++
- grpc_plugin_support - grpc_plugin_support
- grpc++_test_config
- name: grpc_plugin_support - name: grpc_plugin_support
build: protoc build: protoc
language: c++ language: c++
@ -2661,11 +2664,8 @@ targets:
deps: deps:
- grpc_cli_libs - grpc_cli_libs
- grpc++_reflection - grpc++_reflection
- grpc++_test_util
- grpc_test_util
- grpc++ - grpc++
- grpc - grpc
- gpr_test_util
- gpr - gpr
- grpc++_test_config - grpc++_test_config
- name: grpc_cpp_plugin - name: grpc_cpp_plugin

@ -33,19 +33,24 @@
/* /*
A command line tool to talk to a grpc server. A command line tool to talk to a grpc server.
Run `grpc_cli help` command to see its usage information.
Example of talking to grpc interop server: Example of talking to grpc interop server:
grpc_cli call localhost:50051 UnaryCall src/proto/grpc/testing/test.proto \ grpc_cli call localhost:50051 UnaryCall "response_size:10" \
"response_size:10" --enable_ssl=false --protofiles=src/proto/grpc/testing/test.proto --enable_ssl=false
Options: Options:
1. --proto_path, if your proto file is not under current working directory, 1. --protofiles, use this flag to provide a proto file if the server does
does not have the reflection service.
2. --proto_path, if your proto file is not under current working directory,
use this flag to provide a search root. It should work similar to the use this flag to provide a search root. It should work similar to the
counterpart in protoc. counterpart in protoc. This option is valid only when protofiles is
2. --metadata specifies metadata to be sent to the server, such as: provided.
3. --metadata specifies metadata to be sent to the server, such as:
--metadata="MyHeaderKey1:Value1:MyHeaderKey2:Value2" --metadata="MyHeaderKey1:Value1:MyHeaderKey2:Value2"
3. --enable_ssl, whether to use tls. 4. --enable_ssl, whether to use tls.
4. --use_auth, if set to true, attach a GoogleDefaultCredentials to the call 5. --use_auth, if set to true, attach a GoogleDefaultCredentials to the call
3. --input_binary_file, a file containing the serialized request. The file 6. --input_binary_file, a file containing the serialized request. The file
can be generated by calling something like: can be generated by calling something like:
protoc --proto_path=src/proto/grpc/testing/ \ protoc --proto_path=src/proto/grpc/testing/ \
--encode=grpc.testing.SimpleRequest \ --encode=grpc.testing.SimpleRequest \
@ -53,7 +58,7 @@
< input.txt > input.bin < input.txt > input.bin
If this is used and no proto file is provided in the argument list, the If this is used and no proto file is provided in the argument list, the
method string has to be exact in the form of /package.service/method. method string has to be exact in the form of /package.service/method.
4. --output_binary_file, a file to write binary format response into, it can 7. --output_binary_file, a file to write binary format response into, it can
be later decoded using protoc: be later decoded using protoc:
protoc --proto_path=src/proto/grpc/testing/ \ protoc --proto_path=src/proto/grpc/testing/ \
--decode=grpc.testing.SimpleResponse \ --decode=grpc.testing.SimpleResponse \

@ -31,7 +31,7 @@
* *
*/ */
#include "grpc_tool.h" #include "test/cpp/util/grpc_tool.h"
#include <unistd.h> #include <unistd.h>
#include <fstream> #include <fstream>
@ -47,7 +47,6 @@
#include <grpc++/security/credentials.h> #include <grpc++/security/credentials.h>
#include <grpc++/support/string_ref.h> #include <grpc++/support/string_ref.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/support/log.h>
#include "test/cpp/util/cli_call.h" #include "test/cpp/util/cli_call.h"
#include "test/cpp/util/proto_file_parser.h" #include "test/cpp/util/proto_file_parser.h"
@ -75,8 +74,8 @@ class GrpcTool {
public: public:
explicit GrpcTool(); explicit GrpcTool();
virtual ~GrpcTool() {} virtual ~GrpcTool() {}
bool Help(int argc, const char** argv, OutputCallback callback); bool Help(int argc, const char** argv, GrpcToolOutputCallback callback);
bool CallMethod(int argc, const char** argv, OutputCallback callback); bool CallMethod(int argc, const char** argv, GrpcToolOutputCallback callback);
void SetPrintCommandMode(int exit_status) { void SetPrintCommandMode(int exit_status) {
print_command_usage_ = true; print_command_usage_ = true;
usage_exit_status_ = exit_status; usage_exit_status_ = exit_status;
@ -89,8 +88,8 @@ class GrpcTool {
}; };
template <typename T> template <typename T>
std::function<bool(GrpcTool*, int, const char**, OutputCallback)> BindWith4Args( std::function<bool(GrpcTool*, int, const char**, GrpcToolOutputCallback)>
T&& func) { BindWith4Args(T&& func) {
return std::bind(std::forward<T>(func), std::placeholders::_1, return std::bind(std::forward<T>(func), std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3, std::placeholders::_2, std::placeholders::_3,
std::placeholders::_4); std::placeholders::_4);
@ -143,7 +142,8 @@ void PrintMetadata(const T& m, const grpc::string& message) {
struct Command { struct Command {
const char* command; const char* command;
std::function<bool(GrpcTool*, int, const char**, OutputCallback)> function; std::function<bool(GrpcTool*, int, const char**, GrpcToolOutputCallback)>
function;
int min_args; int min_args;
int max_args; int max_args;
}; };
@ -186,7 +186,8 @@ const Command* FindCommand(const grpc::string& name) {
} }
} // namespace } // namespace
int GrpcToolMainLib(int argc, const char** argv, OutputCallback callback) { int GrpcToolMainLib(int argc, const char** argv,
GrpcToolOutputCallback callback) {
if (argc < 2) { if (argc < 2) {
Usage("No command specified"); Usage("No command specified");
} }
@ -222,7 +223,8 @@ void GrpcTool::CommandUsage(const grpc::string& usage) const {
} }
} }
bool GrpcTool::Help(int argc, const char** argv, OutputCallback callback) { bool GrpcTool::Help(int argc, const char** argv,
GrpcToolOutputCallback callback) {
CommandUsage( CommandUsage(
"Print help\n" "Print help\n"
" grpc_cli help [subcommand]\n"); " grpc_cli help [subcommand]\n");
@ -241,7 +243,7 @@ bool GrpcTool::Help(int argc, const char** argv, OutputCallback callback) {
} }
bool GrpcTool::CallMethod(int argc, const char** argv, bool GrpcTool::CallMethod(int argc, const char** argv,
OutputCallback callback) { GrpcToolOutputCallback callback) {
CommandUsage( CommandUsage(
"Call method\n" "Call method\n"
" grpc_cli call <address> <service>[.<method>] <request>\n" " grpc_cli call <address> <service>[.<method>] <request>\n"

@ -31,17 +31,16 @@
* *
*/ */
#include <grpc++/support/config.h>
#include <functional> #include <functional>
#include <string>
#include <gflags/gflags.h>
namespace grpc { namespace grpc {
namespace testing { namespace testing {
typedef std::function<bool(const std::string &)> OutputCallback; typedef std::function<bool(const grpc::string &)> GrpcToolOutputCallback;
int GrpcToolMainLib(int argc, const char **argv, OutputCallback callback); int GrpcToolMainLib(int argc, const char **argv,
GrpcToolOutputCallback callback);
} // namespace testing } // namespace testing
} // namespace grpc } // namespace grpc

@ -2130,14 +2130,11 @@
{ {
"deps": [ "deps": [
"gpr", "gpr",
"gpr_test_util",
"grpc", "grpc",
"grpc++", "grpc++",
"grpc++_reflection", "grpc++_reflection",
"grpc++_test_config", "grpc++_test_config",
"grpc++_test_util", "grpc_cli_libs"
"grpc_cli_libs",
"grpc_test_util"
], ],
"headers": [], "headers": [],
"language": "c++", "language": "c++",
@ -4491,13 +4488,15 @@
"deps": [ "deps": [
"grpc++", "grpc++",
"grpc++_reflection", "grpc++_reflection",
"grpc++_test_config",
"grpc_plugin_support" "grpc_plugin_support"
], ],
"headers": [ "headers": [
"test/cpp/util/cli_call.h", "test/cpp/util/cli_call.h",
"test/cpp/util/grpc_tool.h", "test/cpp/util/grpc_tool.h",
"test/cpp/util/proto_file_parser.h", "test/cpp/util/proto_file_parser.h",
"test/cpp/util/proto_reflection_descriptor_database.h" "test/cpp/util/proto_reflection_descriptor_database.h",
"test/cpp/util/string_ref_helper.h"
], ],
"language": "c++", "language": "c++",
"name": "grpc_cli_libs", "name": "grpc_cli_libs",
@ -4509,7 +4508,9 @@
"test/cpp/util/proto_file_parser.cc", "test/cpp/util/proto_file_parser.cc",
"test/cpp/util/proto_file_parser.h", "test/cpp/util/proto_file_parser.h",
"test/cpp/util/proto_reflection_descriptor_database.cc", "test/cpp/util/proto_reflection_descriptor_database.cc",
"test/cpp/util/proto_reflection_descriptor_database.h" "test/cpp/util/proto_reflection_descriptor_database.h",
"test/cpp/util/string_ref_helper.cc",
"test/cpp/util/string_ref_helper.h"
], ],
"third_party": false, "third_party": false,
"type": "lib" "type": "lib"

@ -151,6 +151,7 @@
<ClInclude Include="$(SolutionDir)\..\test\cpp\util\grpc_tool.h" /> <ClInclude Include="$(SolutionDir)\..\test\cpp\util\grpc_tool.h" />
<ClInclude Include="$(SolutionDir)\..\test\cpp\util\proto_file_parser.h" /> <ClInclude Include="$(SolutionDir)\..\test\cpp\util\proto_file_parser.h" />
<ClInclude Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.h" /> <ClInclude Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.h" />
<ClInclude Include="$(SolutionDir)\..\test\cpp\util\string_ref_helper.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="$(SolutionDir)\..\test\cpp\util\cli_call.cc"> <ClCompile Include="$(SolutionDir)\..\test\cpp\util\cli_call.cc">
@ -161,6 +162,8 @@
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.cc"> <ClCompile Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.cc">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\cpp\util\string_ref_helper.cc">
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++_reflection\grpc++_reflection.vcxproj"> <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++_reflection\grpc++_reflection.vcxproj">
@ -172,6 +175,9 @@
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_plugin_support\grpc_plugin_support.vcxproj"> <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_plugin_support\grpc_plugin_support.vcxproj">
<Project>{B6E81D84-2ACB-41B8-8781-493A944C7817}</Project> <Project>{B6E81D84-2ACB-41B8-8781-493A944C7817}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++_test_config\grpc++_test_config.vcxproj">
<Project>{3F7D093D-11F9-C4BC-BEB7-18EB28E3F290}</Project>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

@ -13,6 +13,9 @@
<ClCompile Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.cc"> <ClCompile Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.cc">
<Filter>test\cpp\util</Filter> <Filter>test\cpp\util</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\cpp\util\string_ref_helper.cc">
<Filter>test\cpp\util</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="$(SolutionDir)\..\test\cpp\util\cli_call.h"> <ClInclude Include="$(SolutionDir)\..\test\cpp\util\cli_call.h">
@ -27,6 +30,9 @@
<ClInclude Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.h"> <ClInclude Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.h">
<Filter>test\cpp\util</Filter> <Filter>test\cpp\util</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(SolutionDir)\..\test\cpp\util\string_ref_helper.h">
<Filter>test\cpp\util</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -170,21 +170,12 @@
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++_reflection\grpc++_reflection.vcxproj"> <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++_reflection\grpc++_reflection.vcxproj">
<Project>{5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}</Project> <Project>{5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++_test_util\grpc++_test_util.vcxproj">
<Project>{0BE77741-552A-929B-A497-4EF7ECE17A64}</Project>
</ProjectReference>
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_test_util\grpc_test_util.vcxproj">
<Project>{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}</Project>
</ProjectReference>
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++\grpc++.vcxproj"> <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++\grpc++.vcxproj">
<Project>{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}</Project> <Project>{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj"> <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj">
<Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project> <Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr_test_util\gpr_test_util.vcxproj">
<Project>{EAB0A629-17A9-44DB-B5FF-E91A721FE037}</Project>
</ProjectReference>
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr\gpr.vcxproj"> <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr\gpr.vcxproj">
<Project>{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}</Project> <Project>{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}</Project>
</ProjectReference> </ProjectReference>

Loading…
Cancel
Save