Skip to content

Commit 9157786

Browse files
authored
refactor(channel): versioned clients (#10876)
1 parent 0ea71ba commit 9157786

42 files changed

Lines changed: 3671 additions & 3436 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.typos.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extend-exclude = [
88
"google/cloud/bigtable/internal/readrowsparser_acceptance_tests.inc",
99
# The source proto files have one or more typos in their comments
1010
"google/cloud/asset/v1/asset_client.h",
11-
"google/cloud/channel/cloud_channel_client.h",
11+
"google/cloud/channel/v1/cloud_channel_client.h",
1212
"google/cloud/gameservices/game_server_deployments_client.h",
1313
"google/cloud/managedidentities/managed_identities_client.h",
1414
"google/cloud/monitoring/uptime_check_client.h",
961 Bytes
Binary file not shown.

ci/etc/expected_install_directories

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,10 @@
142142
./include/google/cloud/certificatemanager/v1/internal
143143
./include/google/cloud/certificatemanager/v1/mocks
144144
./include/google/cloud/channel
145-
./include/google/cloud/channel/internal
146145
./include/google/cloud/channel/mocks
147146
./include/google/cloud/channel/v1
147+
./include/google/cloud/channel/v1/internal
148+
./include/google/cloud/channel/v1/mocks
148149
./include/google/cloud/cloudbuild
149150
./include/google/cloud/cloudbuild/internal
150151
./include/google/cloud/cloudbuild/mocks

generator/generator_config.textproto

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ service {
356356
service {
357357
service_proto_path: "google/cloud/channel/v1/service.proto"
358358
additional_proto_files: ["google/cloud/channel/v1/operations.proto"]
359-
product_path: "google/cloud/channel"
359+
product_path: "google/cloud/channel/v1"
360+
forwarding_product_path: "google/cloud/channel"
360361
initial_copyright_year: "2022"
361362
retryable_status_codes: ["kUnavailable"]
362363
}

google/cloud/channel/BUILD.bazel

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,26 @@ package(default_visibility = ["//visibility:private"])
1616

1717
licenses(["notice"]) # Apache 2.0
1818

19+
service_dirs = [
20+
"",
21+
"v1/",
22+
]
23+
24+
src_dirs = service_dirs + [d + "internal/" for d in service_dirs]
25+
1926
filegroup(
2027
name = "srcs",
21-
srcs = glob([
22-
"*.cc",
23-
"internal/*.cc",
24-
]),
28+
srcs = glob([d + "*.cc" for d in src_dirs]),
2529
)
2630

2731
filegroup(
2832
name = "hdrs",
29-
srcs = glob([
30-
"*.h",
31-
"internal/*.h",
32-
]),
33+
srcs = glob([d + "*.h" for d in src_dirs]),
3334
)
3435

3536
filegroup(
3637
name = "mocks",
37-
srcs = glob(["mocks/*.h"]),
38+
srcs = glob([d + "mocks/*.h" for d in service_dirs]),
3839
)
3940

4041
cc_library(
@@ -64,3 +65,13 @@ cc_library(
6465
"@com_google_googletest//:gtest",
6566
],
6667
)
68+
69+
[cc_test(
70+
name = sample.replace("/", "_").replace(".cc", ""),
71+
srcs = [sample],
72+
tags = ["integration-test"],
73+
deps = [
74+
"//:channel",
75+
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
76+
],
77+
) for sample in glob([d + "samples/*.cc" for d in service_dirs])]

google/cloud/channel/CMakeLists.txt

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,22 @@ include(GoogleapisConfig)
3131
set(DOXYGEN_PROJECT_NAME "Cloud Channel API C++ Client")
3232
set(DOXYGEN_PROJECT_BRIEF "A C++ Client Library for the Cloud Channel API")
3333
set(DOXYGEN_PROJECT_NUMBER "${PROJECT_VERSION}")
34-
set(DOXYGEN_EXCLUDE_SYMBOLS "internal" "channel_internal" "channel_testing"
35-
"examples")
36-
set(DOXYGEN_EXAMPLE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/samples
37-
${CMAKE_CURRENT_SOURCE_DIR}/quickstart)
34+
set(DOXYGEN_EXCLUDE_SYMBOLS "internal")
35+
set(DOXYGEN_EXAMPLE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/quickstart")
36+
37+
unset(mocks_globs)
38+
unset(source_globs)
39+
set(service_dirs "" "v1/")
40+
foreach (dir IN LISTS service_dirs)
41+
string(REPLACE "/" "_" ns "${dir}")
42+
list(APPEND source_globs "${dir}*.h" "${dir}*.cc" "${dir}internal/*")
43+
list(APPEND mocks_globs "${dir}mocks/*.h")
44+
list(APPEND DOXYGEN_EXCLUDE_SYMBOLS "channel_${ns}internal")
45+
if (NOT dir STREQUAL "")
46+
list(APPEND DOXYGEN_EXAMPLE_PATH
47+
"${CMAKE_CURRENT_SOURCE_DIR}/${dir}samples")
48+
endif ()
49+
endforeach ()
3850

3951
include(GoogleCloudCppDoxygen)
4052
google_cloud_cpp_doxygen_targets("channel" DEPENDS cloud-docs
@@ -60,7 +72,7 @@ target_link_libraries(google_cloud_cpp_channel_protos PUBLIC ${proto_deps})
6072
file(
6173
GLOB source_files
6274
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
63-
"*.h" "*.cc" "internal/*.h" "internal/*.cc")
75+
${source_globs})
6476
list(SORT source_files)
6577
add_library(google_cloud_cpp_channel ${source_files})
6678
target_include_directories(
@@ -90,7 +102,7 @@ add_library(google-cloud-cpp::channel ALIAS google_cloud_cpp_channel)
90102
file(
91103
GLOB relative_mock_files
92104
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
93-
"mocks/*.h")
105+
${mocks_globs})
94106
list(SORT relative_mock_files)
95107
set(mock_files)
96108
foreach (file IN LISTS relative_mock_files)
@@ -176,3 +188,10 @@ install(
176188
COMPONENT google_cloud_cpp_development)
177189

178190
external_googleapis_install_pc("google_cloud_cpp_channel_protos")
191+
192+
# google-cloud-cpp::channel must be defined before we can add the samples.
193+
foreach (dir IN LISTS service_dirs)
194+
if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS)
195+
google_cloud_cpp_add_samples_relative("channel" "${dir}samples/")
196+
endif ()
197+
endforeach ()

0 commit comments

Comments
 (0)