diff --git a/BUILD b/BUILD index a52010397d3..26838dc2f70 100644 --- a/BUILD +++ b/BUILD @@ -363,6 +363,7 @@ GRPCXX_PUBLIC_HDRS = [ "include/grpcpp/server_builder.h", "include/grpcpp/server_context.h", "include/grpcpp/server_posix.h", + "include/grpcpp/version_info.h", "include/grpcpp/support/async_stream.h", "include/grpcpp/support/async_unary_call.h", "include/grpcpp/support/byte_buffer.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 98f77605b34..b1bf5704dff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3483,6 +3483,7 @@ foreach(_hdr include/grpcpp/support/sync_stream.h include/grpcpp/support/time.h include/grpcpp/support/validate_service_config.h + include/grpcpp/version_info.h include/grpcpp/xds_server_builder.h ) string(REPLACE "include/" "" _path ${_hdr}) @@ -4155,6 +4156,7 @@ foreach(_hdr include/grpcpp/support/sync_stream.h include/grpcpp/support/time.h include/grpcpp/support/validate_service_config.h + include/grpcpp/version_info.h ) string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 3d9761d3000..6719b0963f7 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -2866,6 +2866,7 @@ libs: - include/grpcpp/support/sync_stream.h - include/grpcpp/support/time.h - include/grpcpp/support/validate_service_config.h + - include/grpcpp/version_info.h - include/grpcpp/xds_server_builder.h headers: - src/core/ext/transport/binder/client/binder_connector.h @@ -3281,6 +3282,7 @@ libs: - include/grpcpp/support/sync_stream.h - include/grpcpp/support/time.h - include/grpcpp/support/validate_service_config.h + - include/grpcpp/version_info.h headers: - src/cpp/client/create_channel_internal.h - src/cpp/common/channel_filter.h diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 8221b167aab..5756d05a93e 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -194,6 +194,7 @@ Pod::Spec.new do |s| 'include/grpcpp/support/sync_stream.h', 'include/grpcpp/support/time.h', 'include/grpcpp/support/validate_service_config.h', + 'include/grpcpp/version_info.h', 'include/grpcpp/xds_server_builder.h' end diff --git a/include/grpcpp/grpcpp.h b/include/grpcpp/grpcpp.h index 9d707e29d7e..d692b7f0038 100644 --- a/include/grpcpp/grpcpp.h +++ b/include/grpcpp/grpcpp.h @@ -58,6 +58,7 @@ #include #include #include +#include // IWYU pragma: end_exports namespace grpc { diff --git a/include/grpcpp/version_info.h b/include/grpcpp/version_info.h new file mode 100644 index 00000000000..417a766f7ae --- /dev/null +++ b/include/grpcpp/version_info.h @@ -0,0 +1,27 @@ +// Copyright 2022 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This file is autogenerated from: + templates/include/grpcpp/version_info.h.template */ + +#ifndef GRPCPP_VERSION_INFO_H +#define GRPCPP_VERSION_INFO_H + +#define GRPC_CPP_VERSION_MAJOR 1 +#define GRPC_CPP_VERSION_MINOR 51 +#define GRPC_CPP_VERSION_PATCH 0 +#define GRPC_CPP_VERSION_TAG "dev" +#define GRPC_CPP_VERSION_STRING "1.51.0-dev" + +#endif // GRPCPP_VERSION_INFO_H diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 4d7c8f024eb..79a60fcf066 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -16,14 +16,11 @@ * */ -/* This file is autogenerated from: - templates/src/cpp/common/version_cc.cc.template */ - #include #include #include namespace grpc { -std::string Version() { return "1.51.0-dev"; } +std::string Version() { return GRPC_CPP_VERSION_STRING; } } // namespace grpc diff --git a/templates/include/grpcpp/version_info.h.template b/templates/include/grpcpp/version_info.h.template new file mode 100644 index 00000000000..38415ce1fb8 --- /dev/null +++ b/templates/include/grpcpp/version_info.h.template @@ -0,0 +1,29 @@ +%YAML 1.2 +--- | + // Copyright 2022 gRPC authors. + // + // Licensed under the Apache License, Version 2.0 (the "License"); + // you may not use this file except in compliance with the License. + // You may obtain a copy of the License at + // + // http://www.apache.org/licenses/LICENSE-2.0 + // + // Unless required by applicable law or agreed to in writing, software + // distributed under the License is distributed on an "AS IS" BASIS, + // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + // See the License for the specific language governing permissions and + // limitations under the License. + + /* This file is autogenerated from: + templates/include/grpcpp/version_info.h.template */ + + #ifndef GRPCPP_VERSION_INFO_H + #define GRPCPP_VERSION_INFO_H + + #define GRPC_CPP_VERSION_MAJOR ${settings.cpp_version.major} + #define GRPC_CPP_VERSION_MINOR ${settings.cpp_version.minor} + #define GRPC_CPP_VERSION_PATCH ${settings.cpp_version.patch} + #define GRPC_CPP_VERSION_TAG "${settings.cpp_version.tag or ''}" + #define GRPC_CPP_VERSION_STRING "${settings.cpp_version}" + + #endif // GRPCPP_VERSION_INFO_H diff --git a/templates/src/cpp/common/version_cc.cc.template b/templates/src/cpp/common/version_cc.cc.template deleted file mode 100644 index 5fcf6e44174..00000000000 --- a/templates/src/cpp/common/version_cc.cc.template +++ /dev/null @@ -1,31 +0,0 @@ -%YAML 1.2 ---- | - /* - * - * Copyright 2016 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - - /* This file is autogenerated from: - templates/src/cpp/common/version_cc.cc.template */ - - #include - - #include - #include - - namespace grpc { - std::string Version() { return "${settings.cpp_version}"; } - } // namespace grpc diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index f055a843843..23cc073a11c 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -1059,6 +1059,7 @@ include/grpcpp/support/stub_options.h \ include/grpcpp/support/sync_stream.h \ include/grpcpp/support/time.h \ include/grpcpp/support/validate_service_config.h \ +include/grpcpp/version_info.h \ include/grpcpp/xds_server_builder.h # This tag can be used to specify the character encoding of the source files diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 62b27efa703..74ce1f59662 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1059,6 +1059,7 @@ include/grpcpp/support/stub_options.h \ include/grpcpp/support/sync_stream.h \ include/grpcpp/support/time.h \ include/grpcpp/support/validate_service_config.h \ +include/grpcpp/version_info.h \ include/grpcpp/xds_server_builder.h \ src/core/ext/filters/census/grpc_context.cc \ src/core/ext/filters/channel_idle/channel_idle_filter.cc \