From df09570add3fbe72086f02557d4f74e498cc6f84 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 13 Sep 2016 11:06:40 -0700 Subject: Allow decoupling core version number from wrapper version numbers --- build.yaml | 1 + 1 file changed, 1 insertion(+) (limited to 'build.yaml') diff --git a/build.yaml b/build.yaml index 6eb23d6fb7..04c031da1d 100644 --- a/build.yaml +++ b/build.yaml @@ -12,6 +12,7 @@ settings: '#08': Use "-preN" suffixes to identify pre-release versions '#09': Per-language overrides are possible with (eg) ruby_version tag here '#10': See the expand_version.py for all the quirks here + core_version: 2.0.0-dev g_stands_for: good version: 1.1.0-dev filegroups: -- cgit v1.2.3 From ed9132427a57cac194f02dae4938ba45324323c6 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 4 Nov 2016 16:31:30 -0700 Subject: Get user agent right --- BUILD | 3 ++ CMakeLists.txt | 3 ++ Makefile | 3 ++ build.yaml | 1 + include/grpc++/grpc++.h | 4 ++ src/cpp/common/channel_arguments.cc | 5 +-- src/cpp/common/version_cc.cc | 41 +++++++++++++++++++++ templates/src/cpp/common/version_cc.cc.template | 43 ++++++++++++++++++++++ tools/doxygen/Doxyfile.c++.internal | 1 + tools/run_tests/sources_and_headers.json | 1 + vsprojects/vcxproj/grpc++/grpc++.vcxproj | 2 + vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters | 3 ++ .../grpc++_unsecure/grpc++_unsecure.vcxproj | 2 + .../grpc++_unsecure.vcxproj.filters | 3 ++ 14 files changed, 112 insertions(+), 3 deletions(-) create mode 100644 src/cpp/common/version_cc.cc create mode 100644 templates/src/cpp/common/version_cc.cc.template (limited to 'build.yaml') diff --git a/BUILD b/BUILD index 89dbddfb52..8690052bc4 100644 --- a/BUILD +++ b/BUILD @@ -1370,6 +1370,7 @@ cc_library( "src/cpp/common/core_codegen.cc", "src/cpp/common/resource_quota_cc.cc", "src/cpp/common/rpc_method.cc", + "src/cpp/common/version_cc.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", "src/cpp/server/dynamic_thread_pool.cc", @@ -1513,6 +1514,7 @@ cc_library( "src/cpp/common/core_codegen.cc", "src/cpp/common/resource_quota_cc.cc", "src/cpp/common/rpc_method.cc", + "src/cpp/common/version_cc.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", "src/cpp/server/dynamic_thread_pool.cc", @@ -1677,6 +1679,7 @@ cc_library( "src/cpp/common/core_codegen.cc", "src/cpp/common/resource_quota_cc.cc", "src/cpp/common/rpc_method.cc", + "src/cpp/common/version_cc.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", "src/cpp/server/dynamic_thread_pool.cc", diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d74452a9d..b551ce3411 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1069,6 +1069,7 @@ add_library(grpc++ src/cpp/common/core_codegen.cc src/cpp/common/resource_quota_cc.cc src/cpp/common/rpc_method.cc + src/cpp/common/version_cc.cc src/cpp/server/async_generic_service.cc src/cpp/server/create_default_thread_pool.cc src/cpp/server/dynamic_thread_pool.cc @@ -1226,6 +1227,7 @@ add_library(grpc++_cronet src/cpp/common/core_codegen.cc src/cpp/common/resource_quota_cc.cc src/cpp/common/rpc_method.cc + src/cpp/common/version_cc.cc src/cpp/server/async_generic_service.cc src/cpp/server/create_default_thread_pool.cc src/cpp/server/dynamic_thread_pool.cc @@ -1421,6 +1423,7 @@ add_library(grpc++_unsecure src/cpp/common/core_codegen.cc src/cpp/common/resource_quota_cc.cc src/cpp/common/rpc_method.cc + src/cpp/common/version_cc.cc src/cpp/server/async_generic_service.cc src/cpp/server/create_default_thread_pool.cc src/cpp/server/dynamic_thread_pool.cc diff --git a/Makefile b/Makefile index e17bb5eb41..9dc4340a58 100644 --- a/Makefile +++ b/Makefile @@ -3740,6 +3740,7 @@ LIBGRPC++_SRC = \ src/cpp/common/core_codegen.cc \ src/cpp/common/resource_quota_cc.cc \ src/cpp/common/rpc_method.cc \ + src/cpp/common/version_cc.cc \ src/cpp/server/async_generic_service.cc \ src/cpp/server/create_default_thread_pool.cc \ src/cpp/server/dynamic_thread_pool.cc \ @@ -3926,6 +3927,7 @@ LIBGRPC++_CRONET_SRC = \ src/cpp/common/core_codegen.cc \ src/cpp/common/resource_quota_cc.cc \ src/cpp/common/rpc_method.cc \ + src/cpp/common/version_cc.cc \ src/cpp/server/async_generic_service.cc \ src/cpp/server/create_default_thread_pool.cc \ src/cpp/server/dynamic_thread_pool.cc \ @@ -4448,6 +4450,7 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/common/core_codegen.cc \ src/cpp/common/resource_quota_cc.cc \ src/cpp/common/rpc_method.cc \ + src/cpp/common/version_cc.cc \ src/cpp/server/async_generic_service.cc \ src/cpp/server/create_default_thread_pool.cc \ src/cpp/server/dynamic_thread_pool.cc \ diff --git a/build.yaml b/build.yaml index ee5ffedc0a..c4aed3d883 100644 --- a/build.yaml +++ b/build.yaml @@ -752,6 +752,7 @@ filegroups: - src/cpp/common/core_codegen.cc - src/cpp/common/resource_quota_cc.cc - src/cpp/common/rpc_method.cc + - src/cpp/common/version_cc.cc - src/cpp/server/async_generic_service.cc - src/cpp/server/create_default_thread_pool.cc - src/cpp/server/dynamic_thread_pool.cc diff --git a/include/grpc++/grpc++.h b/include/grpc++/grpc++.h index afb1c555bb..ce355e492d 100644 --- a/include/grpc++/grpc++.h +++ b/include/grpc++/grpc++.h @@ -67,4 +67,8 @@ #include // IWYU pragma: end_exports +namespace grpc { +std::string Version(); +} // namespace grpc + #endif // GRPCXX_GRPCXX_H diff --git a/src/cpp/common/channel_arguments.cc b/src/cpp/common/channel_arguments.cc index c6cad8eeae..d86ba9dd4e 100644 --- a/src/cpp/common/channel_arguments.cc +++ b/src/cpp/common/channel_arguments.cc @@ -34,6 +34,7 @@ #include +#include #include #include #include @@ -42,10 +43,8 @@ namespace grpc { ChannelArguments::ChannelArguments() { - std::ostringstream user_agent_prefix; - user_agent_prefix << "grpc-c++/" << grpc_version_string(); // This will be ignored if used on the server side. - SetString(GRPC_ARG_PRIMARY_USER_AGENT_STRING, user_agent_prefix.str()); + SetString(GRPC_ARG_PRIMARY_USER_AGENT_STRING, "grpc-c++/" + Version()); } ChannelArguments::ChannelArguments(const ChannelArguments& other) diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc new file mode 100644 index 0000000000..826ddfba61 --- /dev/null +++ b/src/cpp/common/version_cc.cc @@ -0,0 +1,41 @@ +/* + * + * Copyright 2016, 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. + * + */ + +/* This file is autogenerated from: + templates/src/core/surface/version.c.template */ + +#include + +namespace grpc { +std::string Version() { return "1.1.0-dev"; } +} diff --git a/templates/src/cpp/common/version_cc.cc.template b/templates/src/cpp/common/version_cc.cc.template new file mode 100644 index 0000000000..60f0b3bb51 --- /dev/null +++ b/templates/src/cpp/common/version_cc.cc.template @@ -0,0 +1,43 @@ +%YAML 1.2 +--- | + /* + * + * Copyright 2016, 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. + * + */ + + /* This file is autogenerated from: + templates/src/core/surface/version.c.template */ + + #include + + namespace grpc { + std::string Version() { return "${settings.cpp_version}"; } + } diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index a55e905252..04e8f4e7f2 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -877,6 +877,7 @@ src/cpp/common/completion_queue_cc.cc \ src/cpp/common/core_codegen.cc \ src/cpp/common/resource_quota_cc.cc \ src/cpp/common/rpc_method.cc \ +src/cpp/common/version_cc.cc \ src/cpp/server/async_generic_service.cc \ src/cpp/server/create_default_thread_pool.cc \ src/cpp/server/dynamic_thread_pool.cc \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 835d7beff1..5bee7ecaff 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -7573,6 +7573,7 @@ "src/cpp/common/core_codegen.cc", "src/cpp/common/resource_quota_cc.cc", "src/cpp/common/rpc_method.cc", + "src/cpp/common/version_cc.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", "src/cpp/server/dynamic_thread_pool.cc", diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index e8946043b6..f281db72b6 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -400,6 +400,8 @@ + + diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index e7d6d557f1..f359e4ef31 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -64,6 +64,9 @@ src\cpp\common + + src\cpp\common + src\cpp\server diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 1728575242..1511a2cfe4 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -386,6 +386,8 @@ + + diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index 7fc8ed33fc..bed77b25a4 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -49,6 +49,9 @@ src\cpp\common + + src\cpp\common + src\cpp\server -- cgit v1.2.3