Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(baremetalsolution): versioned clients #10873

Merged
merged 5 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
3 changes: 2 additions & 1 deletion ci/etc/expected_install_directories
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@
./include/google/cloud/automl/mocks
./include/google/cloud/automl/v1
./include/google/cloud/baremetalsolution
./include/google/cloud/baremetalsolution/internal
./include/google/cloud/baremetalsolution/mocks
./include/google/cloud/baremetalsolution/v2
./include/google/cloud/baremetalsolution/v2/internal
./include/google/cloud/baremetalsolution/v2/mocks
./include/google/cloud/batch
./include/google/cloud/batch/internal
./include/google/cloud/batch/mocks
Expand Down
3 changes: 2 additions & 1 deletion generator/generator_config.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ service {
# Bare Metal Solution
service {
service_proto_path: "google/cloud/baremetalsolution/v2/baremetalsolution.proto"
product_path: "google/cloud/baremetalsolution"
product_path: "google/cloud/baremetalsolution/v2"
forwarding_product_path: "google/cloud/baremetalsolution"
initial_copyright_year: "2022"
retryable_status_codes: ["kUnavailable"]
}
Expand Down
29 changes: 20 additions & 9 deletions google/cloud/baremetalsolution/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,26 @@ package(default_visibility = ["//visibility:private"])

licenses(["notice"]) # Apache 2.0

service_dirs = [
"",
"v2/",
]

src_dirs = service_dirs + [d + "internal/" for d in service_dirs]

filegroup(
name = "srcs",
srcs = glob([
"*.cc",
"internal/*.cc",
]),
srcs = glob([d + "*.cc" for d in src_dirs]),
)

filegroup(
name = "hdrs",
srcs = glob([
"*.h",
"internal/*.h",
]),
srcs = glob([d + "*.h" for d in src_dirs]),
)

filegroup(
name = "mocks",
srcs = glob(["mocks/*.h"]),
srcs = glob([d + "mocks/*.h" for d in service_dirs]),
)

cc_library(
Expand All @@ -58,3 +59,13 @@ cc_library(
"@com_google_googletest//:gtest",
],
)

[cc_test(
name = sample.replace("/", "_").replace(".cc", ""),
srcs = [sample],
tags = ["integration-test"],
deps = [
"//:baremetalsolution",
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
],
) for sample in glob([d + "samples/*.cc" for d in service_dirs])]
33 changes: 27 additions & 6 deletions google/cloud/baremetalsolution/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,22 @@ set(DOXYGEN_PROJECT_NAME "Bare Metal Solution API C++ Client")
set(DOXYGEN_PROJECT_BRIEF
"A C++ Client Library for the Bare Metal Solution API")
set(DOXYGEN_PROJECT_NUMBER "${PROJECT_VERSION}")
set(DOXYGEN_EXCLUDE_SYMBOLS "internal" "baremetalsolution_internal"
"baremetalsolution_testing" "examples")
set(DOXYGEN_EXAMPLE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/samples
${CMAKE_CURRENT_SOURCE_DIR}/quickstart)
set(DOXYGEN_EXCLUDE_SYMBOLS "internal")
set(DOXYGEN_EXAMPLE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/quickstart")

unset(mocks_globs)
unset(source_globs)
set(service_dirs "" "v2/")
foreach (dir IN LISTS service_dirs)
string(REPLACE "/" "_" ns "${dir}")
list(APPEND source_globs "${dir}*.h" "${dir}*.cc" "${dir}internal/*")
list(APPEND mocks_globs "${dir}mocks/*.h")
list(APPEND DOXYGEN_EXCLUDE_SYMBOLS "baremetalsolution_${ns}internal")
if (NOT dir STREQUAL "")
list(APPEND DOXYGEN_EXAMPLE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/${dir}samples")
endif ()
endforeach ()

include(GoogleCloudCppDoxygen)
google_cloud_cpp_doxygen_targets("baremetalsolution" DEPENDS cloud-docs
Expand Down Expand Up @@ -51,7 +63,7 @@ target_link_libraries(google_cloud_cpp_baremetalsolution_protos
file(
GLOB source_files
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"*.h" "*.cc" "internal/*.h" "internal/*.cc")
${source_globs})
list(SORT source_files)
add_library(google_cloud_cpp_baremetalsolution ${source_files})
target_include_directories(
Expand Down Expand Up @@ -82,7 +94,7 @@ add_library(google-cloud-cpp::baremetalsolution ALIAS
file(
GLOB relative_mock_files
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"mocks/*.h")
${mocks_globs})
list(SORT relative_mock_files)
set(mock_files)
foreach (file IN LISTS relative_mock_files)
Expand Down Expand Up @@ -190,3 +202,12 @@ install(
COMPONENT google_cloud_cpp_development)

external_googleapis_install_pc("google_cloud_cpp_baremetalsolution_protos")

# google-cloud-cpp::baremetalsolution must be defined before we can add the
# samples.
foreach (dir IN LISTS service_dirs)
if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS)
google_cloud_cpp_add_samples_relative("baremetalsolution"
"${dir}samples/")
endif ()
endforeach ()
Loading