Skip to content

Commit 21f4e01

Browse files
authored
refactor(artifactregistry): versioned clients (#10869)
1 parent 41557c1 commit 21f4e01

41 files changed

Lines changed: 2471 additions & 2237 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
601 Bytes
Binary file not shown.

ci/etc/expected_install_directories

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@
5050
./include/google/cloud/appengine/v1/internal
5151
./include/google/cloud/appengine/v1/mocks
5252
./include/google/cloud/artifactregistry
53-
./include/google/cloud/artifactregistry/internal
5453
./include/google/cloud/artifactregistry/mocks
54+
./include/google/cloud/artifactregistry/v1
55+
./include/google/cloud/artifactregistry/v1/internal
56+
./include/google/cloud/artifactregistry/v1/mocks
5557
./include/google/cloud/asset
5658
./include/google/cloud/asset/mocks
5759
./include/google/cloud/asset/v1

generator/generator_config.textproto

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ service {
8080
# Artifact Registry
8181
service {
8282
service_proto_path: "google/devtools/artifactregistry/v1/service.proto"
83-
product_path: "google/cloud/artifactregistry"
83+
product_path: "google/cloud/artifactregistry/v1"
84+
forwarding_product_path: "google/cloud/artifactregistry"
8485
initial_copyright_year: "2022"
8586
retryable_status_codes: ["kUnavailable"]
8687
}

google/cloud/artifactregistry/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(
@@ -58,3 +59,13 @@ cc_library(
5859
"@com_google_googletest//:gtest",
5960
],
6061
)
62+
63+
[cc_test(
64+
name = sample.replace("/", "_").replace(".cc", ""),
65+
srcs = [sample],
66+
tags = ["integration-test"],
67+
deps = [
68+
"//:artifactregistry",
69+
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
70+
],
71+
) for sample in glob([d + "samples/*.cc" for d in service_dirs])]

google/cloud/artifactregistry/CMakeLists.txt

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,22 @@ include(GoogleapisConfig)
1818
set(DOXYGEN_PROJECT_NAME "Artifact Registry API C++ Client")
1919
set(DOXYGEN_PROJECT_BRIEF "A C++ Client Library for the Artifact Registry API")
2020
set(DOXYGEN_PROJECT_NUMBER "${PROJECT_VERSION}")
21-
set(DOXYGEN_EXCLUDE_SYMBOLS "internal" "artifactregistry_internal"
22-
"artifactregistry_testing" "examples")
23-
set(DOXYGEN_EXAMPLE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/samples
24-
${CMAKE_CURRENT_SOURCE_DIR}/quickstart)
21+
set(DOXYGEN_EXCLUDE_SYMBOLS "internal")
22+
set(DOXYGEN_EXAMPLE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/quickstart")
23+
24+
unset(mocks_globs)
25+
unset(source_globs)
26+
set(service_dirs "" "v1/")
27+
foreach (dir IN LISTS service_dirs)
28+
string(REPLACE "/" "_" ns "${dir}")
29+
list(APPEND source_globs "${dir}*.h" "${dir}*.cc" "${dir}internal/*")
30+
list(APPEND mocks_globs "${dir}mocks/*.h")
31+
list(APPEND DOXYGEN_EXCLUDE_SYMBOLS "artifactregistry_${ns}internal")
32+
if (NOT dir STREQUAL "")
33+
list(APPEND DOXYGEN_EXAMPLE_PATH
34+
"${CMAKE_CURRENT_SOURCE_DIR}/${dir}samples")
35+
endif ()
36+
endforeach ()
2537

2638
include(GoogleCloudCppDoxygen)
2739
google_cloud_cpp_doxygen_targets("artifactregistry" DEPENDS cloud-docs
@@ -49,7 +61,7 @@ target_link_libraries(google_cloud_cpp_artifactregistry_protos
4961
file(
5062
GLOB source_files
5163
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
52-
"*.h" "*.cc" "internal/*.h" "internal/*.cc")
64+
${source_globs})
5365
list(SORT source_files)
5466
add_library(google_cloud_cpp_artifactregistry ${source_files})
5567
target_include_directories(
@@ -80,7 +92,7 @@ add_library(google-cloud-cpp::artifactregistry ALIAS
8092
file(
8193
GLOB relative_mock_files
8294
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
83-
"mocks/*.h")
95+
${mocks_globs})
8496
list(SORT relative_mock_files)
8597
set(mock_files)
8698
foreach (file IN LISTS relative_mock_files)
@@ -188,3 +200,12 @@ install(
188200
COMPONENT google_cloud_cpp_development)
189201

190202
external_googleapis_install_pc("google_cloud_cpp_artifactregistry_protos")
203+
204+
# google-cloud-cpp::artifactregistry must be defined before we can add the
205+
# samples.
206+
foreach (dir IN LISTS service_dirs)
207+
if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS)
208+
google_cloud_cpp_add_samples_relative("artifactregistry"
209+
"${dir}samples/")
210+
endif ()
211+
endforeach ()

0 commit comments

Comments
 (0)