Skip to content

Commit d7502ef

Browse files
authored
feat(datacatalog): generate library (#8216)
1 parent 174e2a5 commit d7502ef

89 files changed

Lines changed: 12457 additions & 0 deletions

File tree

Some content is hidden

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

BUILD.bazel

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,20 @@ cc_library(
269269
],
270270
)
271271

272+
cc_library(
273+
name = "experimental-datacatalog",
274+
deps = [
275+
"//google/cloud/datacatalog:google_cloud_cpp_datacatalog",
276+
],
277+
)
278+
279+
cc_library(
280+
name = "experimental-datacatalog_mocks",
281+
deps = [
282+
"//google/cloud/datacatalog:google_cloud_cpp_datacatalog_mocks",
283+
],
284+
)
285+
272286
cc_library(
273287
name = "experimental-datamigration",
274288
deps = [

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ releasing them early in case they elicit some feedback that requires changes.
102102
<summary> Expand to see the full list of new libraries...</summary>
103103
<br>
104104

105+
* [Data Catalog](https://github.com/googleapis/google-cloud-cpp/blob/main/google/cloud/datacatalog/README.md)
105106
* [Managed Service for Microsoft Active Directory](https://github.com/googleapis/google-cloud-cpp/blob/main/google/cloud/managedidentities/README.md)
106107

107108
</details>

ci/etc/expected_install_directories

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@
7979
./include/google/cloud/containeranalysis
8080
./include/google/cloud/containeranalysis/internal
8181
./include/google/cloud/containeranalysis/mocks
82+
./include/google/cloud/datacatalog
83+
./include/google/cloud/datacatalog/internal
84+
./include/google/cloud/datacatalog/mocks
85+
./include/google/cloud/datacatalog/v1
8286
./include/google/cloud/datamigration
8387
./include/google/cloud/datamigration/internal
8488
./include/google/cloud/datamigration/mocks
@@ -350,6 +354,7 @@
350354
./lib64/cmake/google_cloud_cpp_composer
351355
./lib64/cmake/google_cloud_cpp_container
352356
./lib64/cmake/google_cloud_cpp_containeranalysis
357+
./lib64/cmake/google_cloud_cpp_datacatalog
353358
./lib64/cmake/google_cloud_cpp_datamigration
354359
./lib64/cmake/google_cloud_cpp_debugger
355360
./lib64/cmake/google_cloud_cpp_dlp

ci/etc/full_feature_list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ cloudbuild
1414
composer
1515
container
1616
containeranalysis
17+
datacatalog
1718
datamigration
1819
debugger
1920
dlp
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@com_google_googleapis//google/api:annotations_proto
2+
@com_google_googleapis//google/api:client_proto
3+
@com_google_googleapis//google/api:field_behavior_proto
4+
@com_google_googleapis//google/api:http_proto
5+
@com_google_googleapis//google/api:resource_proto
6+
@com_google_googleapis//google/iam/v1:iam_policy_proto
7+
@com_google_googleapis//google/iam/v1:options_proto
8+
@com_google_googleapis//google/iam/v1:policy_proto
9+
@com_google_googleapis//google/type:expr_proto
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@com_google_googleapis//google/cloud/datacatalog/v1:bigquery.proto
2+
@com_google_googleapis//google/cloud/datacatalog/v1:common.proto
3+
@com_google_googleapis//google/cloud/datacatalog/v1:data_source.proto
4+
@com_google_googleapis//google/cloud/datacatalog/v1:datacatalog.proto
5+
@com_google_googleapis//google/cloud/datacatalog/v1:gcs_fileset_spec.proto
6+
@com_google_googleapis//google/cloud/datacatalog/v1:policytagmanager.proto
7+
@com_google_googleapis//google/cloud/datacatalog/v1:policytagmanagerserialization.proto
8+
@com_google_googleapis//google/cloud/datacatalog/v1:schema.proto
9+
@com_google_googleapis//google/cloud/datacatalog/v1:search.proto
10+
@com_google_googleapis//google/cloud/datacatalog/v1:table_spec.proto
11+
@com_google_googleapis//google/cloud/datacatalog/v1:tags.proto
12+
@com_google_googleapis//google/cloud/datacatalog/v1:timestamps.proto
13+
@com_google_googleapis//google/cloud/datacatalog/v1:usage.proto

external/googleapis/update_libraries.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ declare -A -r LIBRARIES=(
5959
["composer"]="@com_google_googleapis//google/cloud/orchestration/airflow/service/v1:service_cc_grpc"
6060
["container"]="@com_google_googleapis//google/container/v1:container_cc_grpc"
6161
["containeranalysis"]="@com_google_googleapis//google/devtools/containeranalysis/v1:containeranalysis_cc_grpc"
62+
["datacatalog"]="@com_google_googleapis//google/cloud/datacatalog/v1:datacatalog_cc_grpc"
6263
["datamigration"]="$(
6364
printf ",%s" \
6465
"@com_google_googleapis//google/cloud/clouddms/v1:clouddms_cc_grpc" \

generator/generator_config.textproto

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,28 @@ service {
219219
retryable_status_codes: ["kUnavailable"]
220220
}
221221

222+
# Data Catalog
223+
service {
224+
service_proto_path: "google/cloud/datacatalog/v1/datacatalog.proto"
225+
product_path: "google/cloud/datacatalog"
226+
initial_copyright_year: "2022"
227+
retryable_status_codes: ["kUnavailable"]
228+
}
229+
230+
service {
231+
service_proto_path: "google/cloud/datacatalog/v1/policytagmanager.proto"
232+
product_path: "google/cloud/datacatalog"
233+
initial_copyright_year: "2022"
234+
retryable_status_codes: ["kUnavailable"]
235+
}
236+
237+
service {
238+
service_proto_path: "google/cloud/datacatalog/v1/policytagmanagerserialization.proto"
239+
product_path: "google/cloud/datacatalog"
240+
initial_copyright_year: "2022"
241+
retryable_status_codes: ["kUnavailable"]
242+
}
243+
222244
# Database Migration
223245
service {
224246
service_proto_path: "google/cloud/clouddms/v1/clouddms.proto"
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
package(default_visibility = ["//visibility:private"])
16+
17+
licenses(["notice"]) # Apache 2.0
18+
19+
SOURCE_GLOB = "**/*.cc"
20+
21+
MOCK_SOURCE_GLOB = "mocks/*.cc"
22+
23+
HEADER_GLOB = "**/*.h"
24+
25+
MOCK_HEADER_GLOB = "mocks/*.h"
26+
27+
cc_library(
28+
name = "google_cloud_cpp_datacatalog",
29+
srcs = glob(
30+
include = [SOURCE_GLOB],
31+
exclude = [MOCK_SOURCE_GLOB],
32+
),
33+
hdrs = glob(
34+
include = [HEADER_GLOB],
35+
exclude = [MOCK_HEADER_GLOB],
36+
),
37+
visibility = ["//:__pkg__"],
38+
deps = [
39+
"//google/cloud:google_cloud_cpp_common",
40+
"//google/cloud:google_cloud_cpp_grpc_utils",
41+
"@com_google_googleapis//google/cloud/datacatalog/v1:datacatalog_cc_grpc",
42+
],
43+
)
44+
45+
cc_library(
46+
name = "google_cloud_cpp_datacatalog_mocks",
47+
srcs = glob(
48+
include = [MOCK_SOURCE_GLOB],
49+
),
50+
hdrs = glob(
51+
include = [MOCK_HEADER_GLOB],
52+
),
53+
visibility = ["//:__pkg__"],
54+
deps = [
55+
":google_cloud_cpp_datacatalog",
56+
"//google/cloud:google_cloud_cpp_common",
57+
"//google/cloud:google_cloud_cpp_grpc_utils",
58+
],
59+
)
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
# ~~~
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# ~~~
16+
17+
include(GoogleapisConfig)
18+
set(DOXYGEN_PROJECT_NAME "Google Cloud Data Catalog API C++ Client")
19+
set(DOXYGEN_PROJECT_BRIEF
20+
"A C++ Client Library for the Google Cloud Data Catalog API")
21+
set(DOXYGEN_PROJECT_NUMBER "${PROJECT_VERSION} (Experimental)")
22+
set(DOXYGEN_EXCLUDE_SYMBOLS "internal" "datacatalog_internal"
23+
"datacatalog_testing" "examples")
24+
set(DOXYGEN_EXAMPLE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/quickstart)
25+
26+
# Creates the proto headers needed by doxygen.
27+
set(GOOGLE_CLOUD_CPP_DOXYGEN_DEPS google-cloud-cpp::datacatalog_protos)
28+
29+
find_package(gRPC REQUIRED)
30+
find_package(ProtobufWithTargets REQUIRED)
31+
find_package(absl CONFIG REQUIRED)
32+
33+
include(GoogleCloudCppCommon)
34+
35+
set(EXTERNAL_GOOGLEAPIS_SOURCE
36+
"${PROJECT_BINARY_DIR}/external/googleapis/src/googleapis_download")
37+
find_path(PROTO_INCLUDE_DIR google/protobuf/descriptor.proto)
38+
if (PROTO_INCLUDE_DIR)
39+
list(INSERT PROTOBUF_IMPORT_DIRS 0 "${PROTO_INCLUDE_DIR}")
40+
endif ()
41+
42+
include(CompileProtos)
43+
google_cloud_cpp_grpcpp_library(
44+
google_cloud_cpp_datacatalog_protos
45+
# cmake-format: sort
46+
${EXTERNAL_GOOGLEAPIS_SOURCE}/google/cloud/datacatalog/v1/bigquery.proto
47+
${EXTERNAL_GOOGLEAPIS_SOURCE}/google/cloud/datacatalog/v1/common.proto
48+
${EXTERNAL_GOOGLEAPIS_SOURCE}/google/cloud/datacatalog/v1/data_source.proto
49+
${EXTERNAL_GOOGLEAPIS_SOURCE}/google/cloud/datacatalog/v1/datacatalog.proto
50+
${EXTERNAL_GOOGLEAPIS_SOURCE}/google/cloud/datacatalog/v1/gcs_fileset_spec.proto
51+
${EXTERNAL_GOOGLEAPIS_SOURCE}/google/cloud/datacatalog/v1/policytagmanager.proto
52+
${EXTERNAL_GOOGLEAPIS_SOURCE}/google/cloud/datacatalog/v1/policytagmanagerserialization.proto
53+
${EXTERNAL_GOOGLEAPIS_SOURCE}/google/cloud/datacatalog/v1/schema.proto
54+
${EXTERNAL_GOOGLEAPIS_SOURCE}/google/cloud/datacatalog/v1/search.proto
55+
${EXTERNAL_GOOGLEAPIS_SOURCE}/google/cloud/datacatalog/v1/table_spec.proto
56+
${EXTERNAL_GOOGLEAPIS_SOURCE}/google/cloud/datacatalog/v1/tags.proto
57+
${EXTERNAL_GOOGLEAPIS_SOURCE}/google/cloud/datacatalog/v1/timestamps.proto
58+
${EXTERNAL_GOOGLEAPIS_SOURCE}/google/cloud/datacatalog/v1/usage.proto
59+
PROTO_PATH_DIRECTORIES
60+
"${EXTERNAL_GOOGLEAPIS_SOURCE}"
61+
"${PROTO_INCLUDE_DIR}")
62+
external_googleapis_set_version_and_alias(datacatalog_protos)
63+
target_link_libraries(
64+
google_cloud_cpp_datacatalog_protos
65+
PUBLIC #
66+
google-cloud-cpp::api_annotations_protos
67+
google-cloud-cpp::api_client_protos
68+
google-cloud-cpp::api_field_behavior_protos
69+
google-cloud-cpp::api_http_protos
70+
google-cloud-cpp::api_resource_protos
71+
google-cloud-cpp::iam_v1_iam_policy_protos
72+
google-cloud-cpp::iam_v1_options_protos
73+
google-cloud-cpp::iam_v1_policy_protos
74+
google-cloud-cpp::type_expr_protos)
75+
76+
file(
77+
GLOB source_files
78+
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
79+
"*.h" "*.cc" "internal/*.h" "internal/*.cc")
80+
list(SORT source_files)
81+
add_library(google_cloud_cpp_datacatalog ${source_files})
82+
target_include_directories(
83+
google_cloud_cpp_datacatalog
84+
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
85+
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
86+
$<INSTALL_INTERFACE:include>)
87+
target_link_libraries(
88+
google_cloud_cpp_datacatalog
89+
PUBLIC google-cloud-cpp::grpc_utils google-cloud-cpp::common
90+
google-cloud-cpp::datacatalog_protos)
91+
google_cloud_cpp_add_common_options(google_cloud_cpp_datacatalog)
92+
set_target_properties(
93+
google_cloud_cpp_datacatalog
94+
PROPERTIES EXPORT_NAME google-cloud-cpp::experimental-datacatalog
95+
VERSION "${PROJECT_VERSION}" SOVERSION
96+
"${PROJECT_VERSION_MAJOR}")
97+
target_compile_options(google_cloud_cpp_datacatalog
98+
PUBLIC ${GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG})
99+
100+
add_library(google-cloud-cpp::experimental-datacatalog ALIAS
101+
google_cloud_cpp_datacatalog)
102+
103+
# Create a header-only library for the mocks. We use a CMake `INTERFACE` library
104+
# for these, a regular library would not work on macOS (where the library needs
105+
# at least one .o file). Unfortunately INTERFACE libraries are a bit weird in
106+
# that they need absolute paths for their sources.
107+
file(
108+
GLOB relative_mock_files
109+
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
110+
"mocks/*.h")
111+
list(SORT relative_mock_files)
112+
set(mock_files)
113+
foreach (file IN LISTS relative_mock_files)
114+
list(APPEND mock_files "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
115+
endforeach ()
116+
add_library(google_cloud_cpp_datacatalog_mocks INTERFACE)
117+
target_sources(google_cloud_cpp_datacatalog_mocks INTERFACE ${mock_files})
118+
target_link_libraries(
119+
google_cloud_cpp_datacatalog_mocks
120+
INTERFACE google-cloud-cpp::experimental-datacatalog GTest::gmock_main
121+
GTest::gmock GTest::gtest)
122+
set_target_properties(
123+
google_cloud_cpp_datacatalog_mocks
124+
PROPERTIES EXPORT_NAME google-cloud-cpp::experimental-datacatalog_mocks)
125+
target_include_directories(
126+
google_cloud_cpp_datacatalog_mocks
127+
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
128+
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
129+
$<INSTALL_INTERFACE:include>)
130+
target_compile_options(google_cloud_cpp_datacatalog_mocks
131+
INTERFACE ${GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG})
132+
133+
# Get the destination directories based on the GNU recommendations.
134+
include(GNUInstallDirs)
135+
136+
# Export the CMake targets to make it easy to create configuration files.
137+
install(
138+
EXPORT google_cloud_cpp_datacatalog-targets
139+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_datacatalog"
140+
COMPONENT google_cloud_cpp_development)
141+
142+
# Install the libraries and headers in the locations determined by
143+
# GNUInstallDirs
144+
install(
145+
TARGETS google_cloud_cpp_datacatalog google_cloud_cpp_datacatalog_protos
146+
EXPORT google_cloud_cpp_datacatalog-targets
147+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
148+
COMPONENT google_cloud_cpp_runtime
149+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
150+
COMPONENT google_cloud_cpp_runtime
151+
NAMELINK_SKIP
152+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
153+
COMPONENT google_cloud_cpp_development)
154+
# With CMake-3.12 and higher we could avoid this separate command (and the
155+
# duplication).
156+
install(
157+
TARGETS google_cloud_cpp_datacatalog google_cloud_cpp_datacatalog_protos
158+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
159+
COMPONENT google_cloud_cpp_development
160+
NAMELINK_ONLY
161+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
162+
COMPONENT google_cloud_cpp_development)
163+
164+
google_cloud_cpp_install_proto_library_protos(
165+
"google_cloud_cpp_datacatalog_protos" "${EXTERNAL_GOOGLEAPIS_SOURCE}")
166+
google_cloud_cpp_install_proto_library_headers(
167+
"google_cloud_cpp_datacatalog_protos")
168+
google_cloud_cpp_install_headers("google_cloud_cpp_datacatalog"
169+
"include/google/cloud/datacatalog")
170+
google_cloud_cpp_install_headers("google_cloud_cpp_datacatalog_mocks"
171+
"include/google/cloud/datacatalog")
172+
173+
# Setup global variables used in the following *.in files.
174+
set(GOOGLE_CLOUD_CONFIG_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
175+
set(GOOGLE_CLOUD_CONFIG_VERSION_MINOR ${PROJECT_VERSION_MINOR})
176+
set(GOOGLE_CLOUD_CONFIG_VERSION_PATCH ${PROJECT_VERSION_PATCH})
177+
set(GOOGLE_CLOUD_PC_NAME "The Google Cloud Data Catalog API C++ Client Library")
178+
set(GOOGLE_CLOUD_PC_DESCRIPTION
179+
"Provides C++ APIs to use the Google Cloud Data Catalog API.")
180+
set(GOOGLE_CLOUD_PC_LIBS "-lgoogle_cloud_cpp_datacatalog")
181+
string(CONCAT GOOGLE_CLOUD_PC_REQUIRES "google_cloud_cpp_grpc_utils"
182+
" google_cloud_cpp_common" " google_cloud_cpp_datacatalog_protos")
183+
184+
# Create and install the pkg-config files.
185+
configure_file("${PROJECT_SOURCE_DIR}/google/cloud/datacatalog/config.pc.in"
186+
"google_cloud_cpp_datacatalog.pc" @ONLY)
187+
install(
188+
FILES "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_datacatalog.pc"
189+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
190+
COMPONENT google_cloud_cpp_development)
191+
192+
# Create and install the CMake configuration files.
193+
include(CMakePackageConfigHelpers)
194+
configure_file("config.cmake.in" "google_cloud_cpp_datacatalog-config.cmake"
195+
@ONLY)
196+
write_basic_package_version_file(
197+
"google_cloud_cpp_datacatalog-config-version.cmake"
198+
VERSION ${PROJECT_VERSION}
199+
COMPATIBILITY ExactVersion)
200+
201+
install(
202+
FILES
203+
"${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_datacatalog-config.cmake"
204+
"${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_datacatalog-config-version.cmake"
205+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_datacatalog"
206+
COMPONENT google_cloud_cpp_development)
207+
208+
external_googleapis_install_pc("google_cloud_cpp_datacatalog_protos"
209+
"${PROJECT_SOURCE_DIR}/external/googleapis")

0 commit comments

Comments
 (0)