Remove unnecessary dependencies
diff --git a/Makefile b/Makefile
index a116595..f3a9b2b 100644
--- a/Makefile
+++ b/Makefile
@@ -4097,6 +4097,7 @@
test/cpp/util/grpc_tool.cc \
test/cpp/util/proto_file_parser.cc \
test/cpp/util/proto_reflection_descriptor_database.cc \
+ test/cpp/util/string_ref_helper.cc \
PUBLIC_HEADERS_CXX += \
@@ -11004,16 +11005,16 @@
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 $@"
$(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
-$(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)
diff --git a/build.yaml b/build.yaml
index 5b2c581..afad1e1 100644
--- a/build.yaml
+++ b/build.yaml
@@ -1032,15 +1032,18 @@
- test/cpp/util/grpc_tool.h
- test/cpp/util/proto_file_parser.h
- test/cpp/util/proto_reflection_descriptor_database.h
+ - test/cpp/util/string_ref_helper.h
src:
- test/cpp/util/cli_call.cc
- test/cpp/util/grpc_tool.cc
- test/cpp/util/proto_file_parser.cc
- test/cpp/util/proto_reflection_descriptor_database.cc
+ - test/cpp/util/string_ref_helper.cc
deps:
- grpc++_reflection
- grpc++
- grpc_plugin_support
+ - grpc++_test_config
- name: grpc_plugin_support
build: protoc
language: c++
@@ -2661,11 +2664,8 @@
deps:
- grpc_cli_libs
- grpc++_reflection
- - grpc++_test_util
- - grpc_test_util
- grpc++
- grpc
- - gpr_test_util
- gpr
- grpc++_test_config
- name: grpc_cpp_plugin
diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc
index 28c8795..897ac5c 100644
--- a/test/cpp/util/grpc_cli.cc
+++ b/test/cpp/util/grpc_cli.cc
@@ -33,19 +33,24 @@
/*
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:
- grpc_cli call localhost:50051 UnaryCall src/proto/grpc/testing/test.proto \
- "response_size:10" --enable_ssl=false
+ grpc_cli call localhost:50051 UnaryCall "response_size:10" \
+ --protofiles=src/proto/grpc/testing/test.proto --enable_ssl=false
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
- counterpart in protoc.
- 2. --metadata specifies metadata to be sent to the server, such as:
+ counterpart in protoc. This option is valid only when protofiles is
+ provided.
+ 3. --metadata specifies metadata to be sent to the server, such as:
--metadata="MyHeaderKey1:Value1:MyHeaderKey2:Value2"
- 3. --enable_ssl, whether to use tls.
- 4. --use_auth, if set to true, attach a GoogleDefaultCredentials to the call
- 3. --input_binary_file, a file containing the serialized request. The file
+ 4. --enable_ssl, whether to use tls.
+ 5. --use_auth, if set to true, attach a GoogleDefaultCredentials to the call
+ 6. --input_binary_file, a file containing the serialized request. The file
can be generated by calling something like:
protoc --proto_path=src/proto/grpc/testing/ \
--encode=grpc.testing.SimpleRequest \
@@ -53,7 +58,7 @@
< input.txt > input.bin
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.
- 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:
protoc --proto_path=src/proto/grpc/testing/ \
--decode=grpc.testing.SimpleResponse \
diff --git a/test/cpp/util/grpc_tool.cc b/test/cpp/util/grpc_tool.cc
index 38ac9e5..5b3f565 100644
--- a/test/cpp/util/grpc_tool.cc
+++ b/test/cpp/util/grpc_tool.cc
@@ -31,7 +31,7 @@
*
*/
-#include "grpc_tool.h"
+#include "test/cpp/util/grpc_tool.h"
#include <unistd.h>
#include <fstream>
@@ -47,7 +47,6 @@
#include <grpc++/security/credentials.h>
#include <grpc++/support/string_ref.h>
#include <grpc/grpc.h>
-#include <grpc/support/log.h>
#include "test/cpp/util/cli_call.h"
#include "test/cpp/util/proto_file_parser.h"
@@ -75,8 +74,8 @@
public:
explicit GrpcTool();
virtual ~GrpcTool() {}
- bool Help(int argc, const char** argv, OutputCallback callback);
- bool CallMethod(int argc, const char** argv, OutputCallback callback);
+ bool Help(int argc, const char** argv, GrpcToolOutputCallback callback);
+ bool CallMethod(int argc, const char** argv, GrpcToolOutputCallback callback);
void SetPrintCommandMode(int exit_status) {
print_command_usage_ = true;
usage_exit_status_ = exit_status;
@@ -89,8 +88,8 @@
};
template <typename T>
-std::function<bool(GrpcTool*, int, const char**, OutputCallback)> BindWith4Args(
- T&& func) {
+std::function<bool(GrpcTool*, int, const char**, GrpcToolOutputCallback)>
+BindWith4Args(T&& func) {
return std::bind(std::forward<T>(func), std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3,
std::placeholders::_4);
@@ -143,7 +142,8 @@
struct 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 max_args;
};
@@ -186,7 +186,8 @@
}
} // namespace
-int GrpcToolMainLib(int argc, const char** argv, OutputCallback callback) {
+int GrpcToolMainLib(int argc, const char** argv,
+ GrpcToolOutputCallback callback) {
if (argc < 2) {
Usage("No command specified");
}
@@ -222,7 +223,8 @@
}
}
-bool GrpcTool::Help(int argc, const char** argv, OutputCallback callback) {
+bool GrpcTool::Help(int argc, const char** argv,
+ GrpcToolOutputCallback callback) {
CommandUsage(
"Print help\n"
" grpc_cli help [subcommand]\n");
@@ -241,7 +243,7 @@
}
bool GrpcTool::CallMethod(int argc, const char** argv,
- OutputCallback callback) {
+ GrpcToolOutputCallback callback) {
CommandUsage(
"Call method\n"
" grpc_cli call <address> <service>[.<method>] <request>\n"
diff --git a/test/cpp/util/grpc_tool.h b/test/cpp/util/grpc_tool.h
index d779737..9e61abf 100644
--- a/test/cpp/util/grpc_tool.h
+++ b/test/cpp/util/grpc_tool.h
@@ -31,17 +31,16 @@
*
*/
+#include <grpc++/support/config.h>
#include <functional>
-#include <string>
-
-#include <gflags/gflags.h>
namespace grpc {
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 grpc
diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json
index f7232a2..e2d2796 100644
--- a/tools/run_tests/sources_and_headers.json
+++ b/tools/run_tests/sources_and_headers.json
@@ -2130,14 +2130,11 @@
{
"deps": [
"gpr",
- "gpr_test_util",
"grpc",
"grpc++",
"grpc++_reflection",
"grpc++_test_config",
- "grpc++_test_util",
- "grpc_cli_libs",
- "grpc_test_util"
+ "grpc_cli_libs"
],
"headers": [],
"language": "c++",
@@ -4491,13 +4488,15 @@
"deps": [
"grpc++",
"grpc++_reflection",
+ "grpc++_test_config",
"grpc_plugin_support"
],
"headers": [
"test/cpp/util/cli_call.h",
"test/cpp/util/grpc_tool.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++",
"name": "grpc_cli_libs",
@@ -4509,7 +4508,9 @@
"test/cpp/util/proto_file_parser.cc",
"test/cpp/util/proto_file_parser.h",
"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,
"type": "lib"
diff --git a/vsprojects/vcxproj/grpc_cli_libs/grpc_cli_libs.vcxproj b/vsprojects/vcxproj/grpc_cli_libs/grpc_cli_libs.vcxproj
index 3269bab..59b2923 100644
--- a/vsprojects/vcxproj/grpc_cli_libs/grpc_cli_libs.vcxproj
+++ b/vsprojects/vcxproj/grpc_cli_libs/grpc_cli_libs.vcxproj
@@ -151,6 +151,7 @@
<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_reflection_descriptor_database.h" />
+ <ClInclude Include="$(SolutionDir)\..\test\cpp\util\string_ref_helper.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(SolutionDir)\..\test\cpp\util\cli_call.cc">
@@ -161,6 +162,8 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.cc">
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\test\cpp\util\string_ref_helper.cc">
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<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">
<Project>{B6E81D84-2ACB-41B8-8781-493A944C7817}</Project>
</ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++_test_config\grpc++_test_config.vcxproj">
+ <Project>{3F7D093D-11F9-C4BC-BEB7-18EB28E3F290}</Project>
+ </ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/vsprojects/vcxproj/grpc_cli_libs/grpc_cli_libs.vcxproj.filters b/vsprojects/vcxproj/grpc_cli_libs/grpc_cli_libs.vcxproj.filters
index cbce2f2..d400f8e 100644
--- a/vsprojects/vcxproj/grpc_cli_libs/grpc_cli_libs.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc_cli_libs/grpc_cli_libs.vcxproj.filters
@@ -13,6 +13,9 @@
<ClCompile Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.cc">
<Filter>test\cpp\util</Filter>
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\test\cpp\util\string_ref_helper.cc">
+ <Filter>test\cpp\util</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(SolutionDir)\..\test\cpp\util\cli_call.h">
@@ -27,6 +30,9 @@
<ClInclude Include="$(SolutionDir)\..\test\cpp\util\proto_reflection_descriptor_database.h">
<Filter>test\cpp\util</Filter>
</ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\test\cpp\util\string_ref_helper.h">
+ <Filter>test\cpp\util</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
diff --git a/vsprojects/vcxproj/test/grpc_cli/grpc_cli.vcxproj b/vsprojects/vcxproj/test/grpc_cli/grpc_cli.vcxproj
index f9dbe1d..78a0a63 100644
--- a/vsprojects/vcxproj/test/grpc_cli/grpc_cli.vcxproj
+++ b/vsprojects/vcxproj/test/grpc_cli/grpc_cli.vcxproj
@@ -170,21 +170,12 @@
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++_reflection\grpc++_reflection.vcxproj">
<Project>{5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}</Project>
</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">
<Project>{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}</Project>
</ProjectReference>
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj">
<Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project>
</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">
<Project>{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}</Project>
</ProjectReference>