Skip to content

Commit 76ce476

Browse files
authored
feat(video): generate library (googleapis#9330)
1 parent 7f780cc commit 76ce476

66 files changed

Lines changed: 8356 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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ exports_files([
2121
])
2222

2323
EXPERIMENTAL_LIBRARIES = [
24+
# Introduced circa 2022-06-22
25+
"video",
2426
# Introduced in 2022-05
2527
"baremetalsolution",
2628
"optimization",

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ For status on this, see https://github.com/googleapis/google-cloud-cpp/issues/88
109109

110110
## v1.43.0 (or maybe v2.43.0) - TBD
111111

112+
We are introducing a new client library. While we do not anticipate any API
113+
changes to this library before declaring it GA, we are releasing it early in
114+
case it elicits some feedback that requires changes.
115+
116+
* [Video Services](https://github.com/googleapis/google-cloud-cpp/blob/main/google/cloud/video/README.md)
117+
112118
## v1.42.0 - 2022-06
113119

114120
We are happy to announce the following GA libraries. Unless specifically noted,

ci/etc/expected_install_directories

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,13 @@
326326
./include/google/cloud/translate/internal
327327
./include/google/cloud/translate/mocks
328328
./include/google/cloud/translate/v3
329+
./include/google/cloud/video
330+
./include/google/cloud/video/internal
331+
./include/google/cloud/video/mocks
332+
./include/google/cloud/video/stitcher
333+
./include/google/cloud/video/stitcher/v1
334+
./include/google/cloud/video/transcoder
335+
./include/google/cloud/video/transcoder/v1
329336
./include/google/cloud/videointelligence
330337
./include/google/cloud/videointelligence/internal
331338
./include/google/cloud/videointelligence/mocks
@@ -479,6 +486,7 @@
479486
./lib64/cmake/google_cloud_cpp_tpu
480487
./lib64/cmake/google_cloud_cpp_trace
481488
./lib64/cmake/google_cloud_cpp_translate
489+
./lib64/cmake/google_cloud_cpp_video
482490
./lib64/cmake/google_cloud_cpp_videointelligence
483491
./lib64/cmake/google_cloud_cpp_vision
484492
./lib64/cmake/google_cloud_cpp_vmmigration

ci/etc/full_feature_list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ texttospeech
7474
tpu
7575
trace
7676
translate
77+
video
7778
videointelligence
7879
vision
7980
vmmigration
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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/rpc:status_proto
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@com_google_googleapis//google/cloud/video/stitcher/v1:ad_tag_details.proto
2+
@com_google_googleapis//google/cloud/video/stitcher/v1:cdn_keys.proto
3+
@com_google_googleapis//google/cloud/video/stitcher/v1:companions.proto
4+
@com_google_googleapis//google/cloud/video/stitcher/v1:events.proto
5+
@com_google_googleapis//google/cloud/video/stitcher/v1:sessions.proto
6+
@com_google_googleapis//google/cloud/video/stitcher/v1:slates.proto
7+
@com_google_googleapis//google/cloud/video/stitcher/v1:stitch_details.proto
8+
@com_google_googleapis//google/cloud/video/stitcher/v1:video_stitcher_service.proto
9+
@com_google_googleapis//google/cloud/video/transcoder/v1:resources.proto
10+
@com_google_googleapis//google/cloud/video/transcoder/v1:services.proto

external/googleapis/update_libraries.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ declare -A -r LIBRARIES=(
174174
["tpu"]="@com_google_googleapis//google/cloud/tpu/v1:tpu_cc_grpc"
175175
["trace"]="@com_google_googleapis//google/devtools/cloudtrace/v2:cloudtrace_cc_grpc"
176176
["translate"]="@com_google_googleapis//google/cloud/translate/v3:translation_cc_grpc"
177+
["video"]="$(
178+
printf ",%s" \
179+
"@com_google_googleapis//google/cloud/video/stitcher/v1:stitcher_cc_grpc" \
180+
"@com_google_googleapis//google/cloud/video/transcoder/v1:transcoder_cc_grpc"
181+
)"
177182
["videointelligence"]="@com_google_googleapis//google/cloud/videointelligence/v1:videointelligence_cc_grpc"
178183
["vision"]="@com_google_googleapis//google/cloud/vision/v1:vision_cc_grpc"
179184
["vmmigration"]="@com_google_googleapis//google/cloud/vmmigration/v1:vmmigration_cc_grpc"

generator/generator_config.textproto

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,21 @@ service {
12941294
retryable_status_codes: ["kUnavailable"]
12951295
}
12961296

1297+
# Video
1298+
service {
1299+
service_proto_path: "google/cloud/video/stitcher/v1/video_stitcher_service.proto"
1300+
product_path: "google/cloud/video"
1301+
initial_copyright_year: "2022"
1302+
retryable_status_codes: ["kUnavailable"]
1303+
}
1304+
1305+
service {
1306+
service_proto_path: "google/cloud/video/transcoder/v1/services.proto"
1307+
product_path: "google/cloud/video"
1308+
initial_copyright_year: "2022"
1309+
retryable_status_codes: ["kUnavailable"]
1310+
}
1311+
12971312
# Video Intelligence
12981313
service {
12991314
service_proto_path: "google/cloud/videointelligence/v1/video_intelligence.proto"

google/cloud/video/BUILD.bazel

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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_video",
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+
"//:common",
40+
"//:grpc_utils",
41+
"@com_google_googleapis//google/cloud/video/stitcher/v1:stitcher_cc_grpc",
42+
"@com_google_googleapis//google/cloud/video/transcoder/v1:transcoder_cc_grpc",
43+
],
44+
)
45+
46+
cc_library(
47+
name = "google_cloud_cpp_video_mocks",
48+
srcs = glob(
49+
include = [MOCK_SOURCE_GLOB],
50+
),
51+
hdrs = glob(
52+
include = [MOCK_HEADER_GLOB],
53+
),
54+
visibility = ["//:__pkg__"],
55+
deps = [
56+
":google_cloud_cpp_video",
57+
"//:common",
58+
"//:grpc_utils",
59+
],
60+
)

google/cloud/video/CMakeLists.txt

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
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 "Transcoder API C++ Client")
19+
set(DOXYGEN_PROJECT_BRIEF "A C++ Client Library for the Transcoder API")
20+
set(DOXYGEN_PROJECT_NUMBER "${PROJECT_VERSION} (Experimental)")
21+
set(DOXYGEN_EXCLUDE_SYMBOLS "internal" "video_internal" "video_testing"
22+
"examples")
23+
set(DOXYGEN_EXAMPLE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/quickstart)
24+
25+
# Creates the proto headers needed by doxygen.
26+
set(GOOGLE_CLOUD_CPP_DOXYGEN_DEPS google-cloud-cpp::video_protos)
27+
28+
include(GoogleCloudCppCommon)
29+
30+
set(EXTERNAL_GOOGLEAPIS_SOURCE
31+
"${PROJECT_BINARY_DIR}/external/googleapis/src/googleapis_download")
32+
find_path(PROTO_INCLUDE_DIR google/protobuf/descriptor.proto)
33+
if (PROTO_INCLUDE_DIR)
34+
list(INSERT PROTOBUF_IMPORT_DIRS 0 "${PROTO_INCLUDE_DIR}")
35+
endif ()
36+
37+
include(CompileProtos)
38+
google_cloud_cpp_load_protolist(
39+
proto_list
40+
"${PROJECT_SOURCE_DIR}/external/googleapis/protolists/video.list")
41+
google_cloud_cpp_load_protodeps(
42+
proto_deps "${PROJECT_SOURCE_DIR}/external/googleapis/protodeps/video.deps")
43+
google_cloud_cpp_grpcpp_library(
44+
google_cloud_cpp_video_protos # cmake-format: sort
45+
${proto_list} PROTO_PATH_DIRECTORIES "${EXTERNAL_GOOGLEAPIS_SOURCE}"
46+
"${PROTO_INCLUDE_DIR}")
47+
external_googleapis_set_version_and_alias(video_protos)
48+
target_link_libraries(google_cloud_cpp_video_protos PUBLIC ${proto_deps})
49+
50+
file(
51+
GLOB source_files
52+
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
53+
"*.h" "*.cc" "internal/*.h" "internal/*.cc")
54+
list(SORT source_files)
55+
add_library(google_cloud_cpp_video ${source_files})
56+
target_include_directories(
57+
google_cloud_cpp_video
58+
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
59+
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
60+
$<INSTALL_INTERFACE:include>)
61+
target_link_libraries(
62+
google_cloud_cpp_video
63+
PUBLIC google-cloud-cpp::grpc_utils google-cloud-cpp::common
64+
google-cloud-cpp::video_protos)
65+
google_cloud_cpp_add_common_options(google_cloud_cpp_video)
66+
set_target_properties(
67+
google_cloud_cpp_video
68+
PROPERTIES EXPORT_NAME google-cloud-cpp::experimental-video
69+
VERSION "${PROJECT_VERSION}"
70+
SOVERSION "${PROJECT_VERSION_MAJOR}")
71+
target_compile_options(google_cloud_cpp_video
72+
PUBLIC ${GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG})
73+
74+
add_library(google-cloud-cpp::experimental-video ALIAS google_cloud_cpp_video)
75+
76+
# Create a header-only library for the mocks. We use a CMake `INTERFACE` library
77+
# for these, a regular library would not work on macOS (where the library needs
78+
# at least one .o file). Unfortunately INTERFACE libraries are a bit weird in
79+
# that they need absolute paths for their sources.
80+
file(
81+
GLOB relative_mock_files
82+
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
83+
"mocks/*.h")
84+
list(SORT relative_mock_files)
85+
set(mock_files)
86+
foreach (file IN LISTS relative_mock_files)
87+
list(APPEND mock_files "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
88+
endforeach ()
89+
add_library(google_cloud_cpp_video_mocks INTERFACE)
90+
target_sources(google_cloud_cpp_video_mocks INTERFACE ${mock_files})
91+
target_link_libraries(
92+
google_cloud_cpp_video_mocks
93+
INTERFACE google-cloud-cpp::experimental-video GTest::gmock_main
94+
GTest::gmock GTest::gtest)
95+
set_target_properties(
96+
google_cloud_cpp_video_mocks
97+
PROPERTIES EXPORT_NAME google-cloud-cpp::experimental-video_mocks)
98+
target_include_directories(
99+
google_cloud_cpp_video_mocks
100+
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
101+
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
102+
$<INSTALL_INTERFACE:include>)
103+
target_compile_options(google_cloud_cpp_video_mocks
104+
INTERFACE ${GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG})
105+
106+
include(CTest)
107+
if (BUILD_TESTING)
108+
add_executable(video_quickstart "quickstart/quickstart.cc")
109+
target_link_libraries(video_quickstart
110+
PRIVATE google-cloud-cpp::experimental-video)
111+
google_cloud_cpp_add_common_options(video_quickstart)
112+
add_test(
113+
NAME video_quickstart
114+
COMMAND
115+
cmake -P "${PROJECT_SOURCE_DIR}/cmake/quickstart-runner.cmake"
116+
$<TARGET_FILE:video_quickstart> GOOGLE_CLOUD_PROJECT
117+
GOOGLE_CLOUD_CPP_TEST_REGION)
118+
set_tests_properties(video_quickstart
119+
PROPERTIES LABELS "integration-test;quickstart")
120+
endif ()
121+
122+
# Get the destination directories based on the GNU recommendations.
123+
include(GNUInstallDirs)
124+
125+
# Export the CMake targets to make it easy to create configuration files.
126+
install(
127+
EXPORT google_cloud_cpp_video-targets
128+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_video"
129+
COMPONENT google_cloud_cpp_development)
130+
131+
# Install the libraries and headers in the locations determined by
132+
# GNUInstallDirs
133+
install(
134+
TARGETS google_cloud_cpp_video google_cloud_cpp_video_protos
135+
EXPORT google_cloud_cpp_video-targets
136+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
137+
COMPONENT google_cloud_cpp_runtime
138+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
139+
COMPONENT google_cloud_cpp_runtime
140+
NAMELINK_SKIP
141+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
142+
COMPONENT google_cloud_cpp_development)
143+
# With CMake-3.12 and higher we could avoid this separate command (and the
144+
# duplication).
145+
install(
146+
TARGETS google_cloud_cpp_video google_cloud_cpp_video_protos
147+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
148+
COMPONENT google_cloud_cpp_development
149+
NAMELINK_ONLY
150+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
151+
COMPONENT google_cloud_cpp_development)
152+
153+
google_cloud_cpp_install_proto_library_protos("google_cloud_cpp_video_protos"
154+
"${EXTERNAL_GOOGLEAPIS_SOURCE}")
155+
google_cloud_cpp_install_proto_library_headers("google_cloud_cpp_video_protos")
156+
google_cloud_cpp_install_headers("google_cloud_cpp_video"
157+
"include/google/cloud/video")
158+
google_cloud_cpp_install_headers("google_cloud_cpp_video_mocks"
159+
"include/google/cloud/video")
160+
161+
google_cloud_cpp_add_pkgconfig(
162+
video
163+
"The Transcoder API C++ Client Library"
164+
"Provides C++ APIs to use the Transcoder API."
165+
"google_cloud_cpp_grpc_utils"
166+
" google_cloud_cpp_common"
167+
" google_cloud_cpp_video_protos")
168+
169+
# Create and install the CMake configuration files.
170+
include(CMakePackageConfigHelpers)
171+
configure_file("config.cmake.in" "google_cloud_cpp_video-config.cmake" @ONLY)
172+
write_basic_package_version_file(
173+
"google_cloud_cpp_video-config-version.cmake"
174+
VERSION ${PROJECT_VERSION}
175+
COMPATIBILITY ExactVersion)
176+
177+
install(
178+
FILES
179+
"${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_video-config.cmake"
180+
"${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_video-config-version.cmake"
181+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_video"
182+
COMPONENT google_cloud_cpp_development)
183+
184+
external_googleapis_install_pc("google_cloud_cpp_video_protos")

0 commit comments

Comments
 (0)