├── .bazelci └── presubmit.yml ├── .bazelignore ├── .bazelrc ├── .clang-format ├── .clang-tidy ├── .cmake-format.py ├── .codecov.yml ├── .dockerignore ├── .editorconfig ├── .github └── issue_template.md ├── .gitignore ├── BUILD ├── CHANGELOG.md ├── CMakeLists.txt ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── INSTALL.md ├── LICENSE ├── README.md ├── WORKSPACE ├── bazel ├── BUILD ├── google_cloud_cpp_common_deps.bzl └── googleapis.BUILD ├── ci ├── check-include-guards.gawk ├── check-style.sh ├── colors.sh ├── coverity-scan.sh ├── define-dump-log.sh ├── etc │ ├── install-config.sh │ ├── kokoro │ │ ├── install │ │ │ ├── project-config.sh │ │ │ └── run-installed-programs.sh │ │ └── readme │ │ │ └── project-config.sh │ ├── publish-refdocs.sh │ └── repo-config.sh ├── generate-badges.sh ├── install-bazel.sh ├── install-cloud-sdk.sh ├── kokoro │ ├── README.md │ ├── define-docker-variables.sh │ ├── docker │ │ ├── Dockerfile.centos │ │ ├── Dockerfile.fedora │ │ ├── Dockerfile.fedora-install │ │ ├── Dockerfile.fedora-libcxx-msan │ │ ├── Dockerfile.ubuntu │ │ ├── Dockerfile.ubuntu-install │ │ ├── asan-presubmit.cfg │ │ ├── asan.cfg │ │ ├── bazel-dependency-presubmit.cfg │ │ ├── bazel-dependency.cfg │ │ ├── build-in-docker-bazel-dependency.sh │ │ ├── build-in-docker-bazel.sh │ │ ├── build-in-docker-cmake.sh │ │ ├── build.sh │ │ ├── check-api-presubmit.cfg │ │ ├── check-api.cfg │ │ ├── check-api.sh │ │ ├── clang-3.8-presubmit.cfg │ │ ├── clang-3.8.cfg │ │ ├── clang-9-presubmit.cfg │ │ ├── clang-9.cfg │ │ ├── clang-tidy-presubmit.cfg │ │ ├── clang-tidy.cfg │ │ ├── common.cfg │ │ ├── coverage-presubmit.cfg │ │ ├── coverage.cfg │ │ ├── cxx17-presubmit.cfg │ │ ├── cxx17.cfg │ │ ├── dump-logs.sh │ │ ├── dump-reports.sh │ │ ├── gcc-4.8-presubmit.cfg │ │ ├── gcc-4.8.cfg │ │ ├── gcc-9-presubmit.cfg │ │ ├── gcc-9.cfg │ │ ├── libcxx-presubmit.cfg │ │ ├── libcxx.cfg │ │ ├── msan-presubmit.cfg │ │ ├── msan.cfg │ │ ├── ninja-presubmit.cfg │ │ ├── ninja.cfg │ │ ├── no-tests-presubmit.cfg │ │ ├── no-tests.cfg │ │ ├── noex-presubmit.cfg │ │ ├── noex.cfg │ │ ├── publish-refdocs.cfg │ │ ├── publish-refdocs.sh │ │ ├── shared-presubmit.cfg │ │ ├── shared.cfg │ │ ├── tsan-presubmit.cfg │ │ ├── tsan.cfg │ │ ├── ubsan-presubmit.cfg │ │ ├── ubsan.cfg │ │ ├── upload-coverage.sh │ │ └── upload-docs.sh │ ├── install │ │ ├── Dockerfile.centos-7 │ │ ├── Dockerfile.centos-8 │ │ ├── Dockerfile.debian-buster │ │ ├── Dockerfile.debian-stretch │ │ ├── Dockerfile.fedora │ │ ├── Dockerfile.opensuse-leap │ │ ├── Dockerfile.opensuse-tumbleweed │ │ ├── Dockerfile.ubuntu-bionic │ │ ├── Dockerfile.ubuntu-focal │ │ ├── Dockerfile.ubuntu-xenial │ │ ├── build.sh │ │ ├── centos-7-presubmit.cfg │ │ ├── centos-7.cfg │ │ ├── centos-8-presubmit.cfg │ │ ├── centos-8.cfg │ │ ├── common.cfg │ │ ├── debian-buster-presubmit.cfg │ │ ├── debian-buster.cfg │ │ ├── debian-stretch-presubmit.cfg │ │ ├── debian-stretch.cfg │ │ ├── fedora-presubmit.cfg │ │ ├── fedora.cfg │ │ ├── opensuse-leap-presubmit.cfg │ │ ├── opensuse-leap.cfg │ │ ├── opensuse-tumbleweed-presubmit.cfg │ │ ├── opensuse-tumbleweed.cfg │ │ ├── ubuntu-bionic-presubmit.cfg │ │ ├── ubuntu-bionic.cfg │ │ ├── ubuntu-focal-presubmit.cfg │ │ ├── ubuntu-focal.cfg │ │ ├── ubuntu-xenial-presubmit.cfg │ │ └── ubuntu-xenial.cfg │ ├── macos │ │ ├── bazel-presubmit.cfg │ │ ├── bazel.cfg │ │ ├── build-bazel.sh │ │ ├── build-cmake.sh │ │ ├── build.sh │ │ ├── cmake-super-presubmit.cfg │ │ ├── cmake-super.cfg │ │ └── common.cfg │ ├── readme │ │ ├── Dockerfile.centos-7 │ │ ├── Dockerfile.centos-8 │ │ ├── Dockerfile.debian-buster │ │ ├── Dockerfile.debian-stretch │ │ ├── Dockerfile.fedora │ │ ├── Dockerfile.opensuse-leap │ │ ├── Dockerfile.opensuse-tumbleweed │ │ ├── Dockerfile.ubuntu-bionic │ │ ├── Dockerfile.ubuntu-xenial │ │ ├── build.sh │ │ ├── centos-7-presubmit.cfg │ │ ├── centos-7.cfg │ │ ├── centos-8-presubmit.cfg │ │ ├── centos-8.cfg │ │ ├── common.cfg │ │ ├── debian-buster-presubmit.cfg │ │ ├── debian-buster.cfg │ │ ├── debian-stretch-presubmit.cfg │ │ ├── debian-stretch.cfg │ │ ├── fedora-presubmit.cfg │ │ ├── fedora.cfg │ │ ├── opensuse-leap-presubmit.cfg │ │ ├── opensuse-leap.cfg │ │ ├── opensuse-tumbleweed-presubmit.cfg │ │ ├── opensuse-tumbleweed.cfg │ │ ├── ubuntu-bionic-presubmit.cfg │ │ ├── ubuntu-bionic.cfg │ │ ├── ubuntu-xenial-presubmit.cfg │ │ └── ubuntu-xenial.cfg │ └── windows │ │ ├── bazel-presubmit.cfg │ │ ├── bazel.cfg │ │ ├── build-bazel-dependencies.ps1 │ │ ├── build-bazel.ps1 │ │ ├── build-cmake-dependencies.ps1 │ │ ├── build-cmake.ps1 │ │ ├── build.bat │ │ ├── build.ps1 │ │ ├── cmake-presubmit.cfg │ │ ├── cmake.cfg │ │ └── common.cfg ├── retry-command.sh ├── templates │ ├── README.md │ ├── generate-kokoro-install.sh │ └── kokoro │ │ ├── docker-fragments-functions.sh │ │ ├── docker-fragments.sh │ │ └── install │ │ ├── Dockerfile.centos-7.in │ │ ├── Dockerfile.centos-8.in │ │ ├── Dockerfile.debian-buster.in │ │ ├── Dockerfile.debian-stretch.in │ │ ├── Dockerfile.fedora.in │ │ ├── Dockerfile.opensuse-leap.in │ │ ├── Dockerfile.opensuse-tumbleweed.in │ │ ├── Dockerfile.ubuntu-bionic.in │ │ ├── Dockerfile.ubuntu-focal.in │ │ ├── Dockerfile.ubuntu-xenial.in │ │ └── build.sh.in ├── test-api │ ├── google_cloud_cpp_common.expected.abi.dump.gz │ └── google_cloud_cpp_grpc_utils.expected.abi.dump.gz ├── test-install │ ├── BUILD │ ├── CMakeLists.txt │ ├── Makefile │ └── WORKSPACE └── test-readme │ ├── README.md │ ├── dockerfile2markdown.sh │ ├── extract-install.sh │ ├── extract-readme.sh │ ├── generate-install.sh │ └── generate-readme.sh ├── cmake ├── CompileProtos.cmake ├── CreateBazelConfig.cmake ├── DownloadNlohmannJson.cmake ├── EnableClangTidy.cmake ├── EnableCoverage.cmake ├── EnableCxxExceptions.cmake ├── FindGMockWithTargets.cmake ├── FindProtobufWithTargets.cmake ├── FindgRPC.cmake ├── GoogleCloudCppCommon.cmake ├── IncludeNlohmannJson.cmake └── SelectMSVCRuntime.cmake ├── doc ├── adr │ ├── 2018-06-13-storage-always-retries.md │ ├── 2018-06-18-storage-request-parameters-are-function-arguments.md │ ├── 2018-06-19-do-not-duplicate-server-side-validation.md │ ├── 2018-10-30-storage-metadata-fields-and-optional.md │ ├── 2019-01-04-error-reporting-with-statusor.md │ ├── 2019-03-26-binary-distributions.md │ └── adr-template.md ├── config │ └── DoxygenLayout.xml ├── cpp-style-guide.md ├── cutting-a-patch.md ├── cutting-a-release.md ├── landing │ ├── README.md │ ├── index.html │ └── version-redirect.html ├── setup-cmake-environment.md ├── setup-development-environment.md └── working-with-bazel-and-cmake.md ├── google └── cloud │ ├── BUILD │ ├── CMakeLists.txt │ ├── README.md │ ├── async_operation.h │ ├── background_threads.h │ ├── completion_queue.cc │ ├── completion_queue.h │ ├── completion_queue_test.cc │ ├── config-version.cmake.in │ ├── config.cmake.in │ ├── config.pc.in │ ├── connection_options.cc │ ├── connection_options.h │ ├── connection_options_test.cc │ ├── future.h │ ├── future_generic.h │ ├── future_generic_test.cc │ ├── future_generic_then_test.cc │ ├── future_void.h │ ├── future_void_test.cc │ ├── future_void_then_test.cc │ ├── google_cloud_cpp_common.bzl │ ├── google_cloud_cpp_common_unit_tests.bzl │ ├── google_cloud_cpp_grpc_utils.bzl │ ├── google_cloud_cpp_grpc_utils_unit_tests.bzl │ ├── grpc_error_delegate.cc │ ├── grpc_error_delegate.h │ ├── grpc_error_delegate_test.cc │ ├── grpc_utils │ ├── BUILD │ ├── async_operation.h │ ├── completion_queue.h │ ├── config.cmake.in │ ├── grpc_error_delegate.h │ └── version.h │ ├── iam_binding.h │ ├── iam_bindings.cc │ ├── iam_bindings.h │ ├── iam_bindings_test.cc │ ├── iam_policy.cc │ ├── iam_policy.h │ ├── internal │ ├── README.md │ ├── async_read_stream_impl.h │ ├── async_retry_unary_rpc.h │ ├── async_retry_unary_rpc_test.cc │ ├── background_threads_impl.cc │ ├── background_threads_impl.h │ ├── background_threads_impl_test.cc │ ├── backoff_policy.cc │ ├── backoff_policy.h │ ├── backoff_policy_test.cc │ ├── big_endian.h │ ├── big_endian_test.cc │ ├── build_info.cc.in │ ├── build_info.h │ ├── compiler_info.cc │ ├── compiler_info.h │ ├── compiler_info_test.cc │ ├── completion_queue_impl.cc │ ├── completion_queue_impl.h │ ├── conjunction.h │ ├── disjunction.h │ ├── env_test.cc │ ├── filesystem.cc │ ├── filesystem.h │ ├── filesystem_test.cc │ ├── format_time_point.cc │ ├── format_time_point.h │ ├── format_time_point_test.cc │ ├── future_base.h │ ├── future_fwd.h │ ├── future_impl.cc │ ├── future_impl.h │ ├── future_impl_test.cc │ ├── future_then_impl.h │ ├── future_then_meta.h │ ├── getenv.cc │ ├── getenv.h │ ├── invoke_result.h │ ├── invoke_result_test.cc │ ├── ios_flags_saver.h │ ├── make_unique.h │ ├── pagination_range.h │ ├── pagination_range_test.cc │ ├── parse_rfc3339.cc │ ├── parse_rfc3339.h │ ├── parse_rfc3339_test.cc │ ├── port_platform.h │ ├── random.cc │ ├── random.h │ ├── random_test.cc │ ├── retry_policy.h │ ├── retry_policy_test.cc │ ├── setenv.cc │ ├── setenv.h │ ├── throw_delegate.cc │ ├── throw_delegate.h │ ├── throw_delegate_test.cc │ ├── tuple.h │ ├── tuple_test.cc │ ├── utility.h │ ├── utility_test.cc │ ├── version_info.h │ └── version_info.h.in │ ├── log.cc │ ├── log.h │ ├── log_test.cc │ ├── optional.h │ ├── optional_test.cc │ ├── samples │ ├── BUILD │ ├── CMakeLists.txt │ └── common_install_test.cc │ ├── status.cc │ ├── status.h │ ├── status_or.h │ ├── status_or_test.cc │ ├── status_test.cc │ ├── terminate_handler.cc │ ├── terminate_handler.h │ ├── terminate_handler_test.cc │ ├── testing_util │ ├── BUILD │ ├── CMakeLists.txt │ ├── README.md │ ├── assert_ok.cc │ ├── assert_ok.h │ ├── assert_ok_test.cc │ ├── capture_log_lines_backend.cc │ ├── capture_log_lines_backend.h │ ├── check_predicate_becomes_false.h │ ├── chrono_literals.h │ ├── config.cmake.in │ ├── custom_google_mock_main.cc │ ├── expect_exception.h │ ├── expect_future_error.h │ ├── google_cloud_cpp_testing.bzl │ ├── google_cloud_cpp_testing_grpc.bzl │ ├── google_cloud_cpp_testing_grpc_unit_tests.bzl │ ├── google_cloud_cpp_testing_unit_tests.bzl │ ├── init_google_mock.h │ ├── is_proto_equal.cc │ ├── is_proto_equal.h │ ├── is_proto_equal_test.cc │ ├── mock_async_response_reader.h │ ├── mock_completion_queue.h │ ├── scoped_environment.cc │ ├── scoped_environment.h │ ├── scoped_environment_test.cc │ ├── testing_types.cc │ └── testing_types.h │ ├── tracing_options.cc │ ├── tracing_options.h │ ├── tracing_options_test.cc │ ├── version.cc │ └── version.h ├── release ├── README.md └── release.sh └── super ├── CMakeLists.txt ├── ExternalProjectHelper.cmake └── external ├── c-ares.cmake ├── googleapis.cmake ├── googletest.cmake ├── grpc.cmake ├── protobuf.cmake ├── ssl.cmake └── zlib.cmake /.bazelci/presubmit.yml: -------------------------------------------------------------------------------- 1 | --- 2 | tasks: 3 | ubuntu1804: 4 | platform: ubuntu1804 5 | build_targets: 6 | - "//google/cloud/..." 7 | test_targets: 8 | - "//google/cloud/..." 9 | -------------------------------------------------------------------------------- /.bazelignore: -------------------------------------------------------------------------------- 1 | ci/ 2 | cmake-out/ 3 | cmake-build-*/ 4 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | # Use the Google style in this project. 2 | BasedOnStyle: Google 3 | 4 | # Some folks prefer to write "int& foo" while others prefer "int &foo". The 5 | # Google Style Guide only asks for consistency within a project, we chose 6 | # "int& foo" for this project: 7 | DerivePointerAlignment: false 8 | PointerAlignment: Left 9 | 10 | IncludeBlocks: Merge 11 | IncludeCategories: 12 | # Matches common headers first, but sorts them after project includes 13 | - Regex: '^\"google/cloud/(internal/|grpc_utils/|testing_util/|[^/]+\.h)' 14 | Priority: 1500 15 | - Regex: '^\"google/cloud/' # project includes should sort first 16 | Priority: 500 17 | - Regex: '^\"' 18 | Priority: 1000 19 | - Regex: '^' 26 | Priority: 5000 27 | 28 | # Format raw string literals with a `pb` or `proto` tag as proto. 29 | RawStringFormats: 30 | - Language: TextProto 31 | Delimiters: 32 | - 'pb' 33 | - 'proto' 34 | BasedOnStyle: Google 35 | 36 | CommentPragmas: '(@copydoc)' 37 | -------------------------------------------------------------------------------- /.cmake-format.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 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 | # http://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 | tab_size = 4 16 | separate_ctrl_name_with_space = True 17 | enable_sort = True 18 | autosort = True 19 | 20 | additional_commands = { 21 | "externalproject_add": { 22 | "flags": [ 23 | ], 24 | "kwargs": { 25 | "BUILD_COMMAND": "+", 26 | "BUILD_BYPRODUCTS": "+", 27 | "CMAKE_ARGS": "+", 28 | "COMMAND": "+", 29 | "CONFIGURE_COMMAND": "+", 30 | "DEPENDS": "+", 31 | "DOWNLOAD_COMMAND": "+", 32 | "EXCLUDE_FROM_ALL": 1, 33 | "INSTALL_COMMAND": "+", 34 | "INSTALL_DIR": 1, 35 | "LIST_SEPARATOR": 1, 36 | "TEST_COMMAND": "+", 37 | "LOG_BUILD": 1, 38 | "LOG_CONFIGURE": 1, 39 | "LOG_DOWNLOAD": 1, 40 | "LOG_INSTALL": 1, 41 | "PREFIX": 1, 42 | "URL": 1, 43 | "URL_HASH": 1, 44 | "BUILD_ALWAYS": 1, 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | # Disable commit statuses 2 | coverage: 3 | status: 4 | project: no 5 | patch: no 6 | changes: no 7 | 8 | ignore: 9 | # Ignore code generated by protobuf, we do not need to test that. 10 | - "*.pb.cc" 11 | - "*.pb.h" 12 | # Also ignore the unit tests. 13 | - "**/*_test.cc$" 14 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # We do not need the git repository in docker images. 2 | .git/ 3 | 4 | # We do not need the typical build directories in docker images. 5 | .idea/ 6 | .build/ 7 | _build/ 8 | build-output/ 9 | cmake-build-*/ 10 | cmake-out/ 11 | 12 | # Skip these directories, the files here are not needed to build any of 13 | # the Docker images. Furthermore, when creating new Dockerfiles the files 14 | # here change a lot, but do not change the image, so they trigger image rebuids 15 | # without any benefit. 16 | ci/kokoro/ 17 | ci/test-readme/ 18 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_style = space 8 | 9 | [BUILD] 10 | indent_size = 4 11 | 12 | [CMakeLists.*] 13 | indent_size = 4 14 | 15 | [*.h,*.cc] 16 | indent_size = 2 17 | 18 | [*.md] 19 | indent_size = 2 20 | 21 | [*.sh] 22 | indent_size = 2 23 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | Answering these questions before submitting your bug report will help us give 2 | you a quicker answer. Thank you! 3 | 4 | If one or more of these questions are not applicable, feel free to remove them. 5 | 6 | ### Does this issue affect the `google-cloud-cpp-common` project? 7 | 8 | If the problem is with one of the client libraries (bigtable, spanner, etc), 9 | please file an issue under the corresponding repository. 10 | 11 | ### What version of `google-cloud-cpp-common` are you using? 12 | 13 | Please include the output from `git rev-parse HEAD` if you are compiling from 14 | source, or the version number from the applicable `*/version.h` file. 15 | 16 | ### What compiler and version are you using? 17 | 18 | Please include the output of `g++ -v` or the equivalent command-line flag. 19 | 20 | ### What operating system and version are you using? 21 | 22 | If you are using a Linux distribution include the name and version of the 23 | distribution too. 24 | 25 | ### What were you trying to do? 26 | 27 | If possible, produce a recipe for reproducing the problem. 28 | 29 | ### What did you expect to see? 30 | 31 | What was the behavior you expected from the library? 32 | 33 | ### What did you see instead? 34 | 35 | What was the behavior you actually observed? 36 | 37 | ### Anything else you would like us to know? 38 | 39 | Include here information about your environment that is not captured above, or 40 | any other information you think might be relevant. 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Common build output directory names 2 | .build/ 3 | _build/ 4 | build-output/ 5 | cmake-out/ 6 | 7 | # Common bazel output directories 8 | bazel-* 9 | 10 | # Backup files for Emacs 11 | *~ 12 | 13 | # Ignore IDEA / IntelliJ files 14 | .idea/ 15 | cmake-build-*/ 16 | 17 | # This is a staging directory used to upload the documents to gihub.io 18 | github-io-staging/ 19 | 20 | # Ignore Visual Studio Code files 21 | .vsbuild/ 22 | .vscode/ 23 | 24 | google/cloud/storage/testbench/__pycache__/ 25 | google/cloud/storage/testbench/*.pyc 26 | -------------------------------------------------------------------------------- /BUILD: -------------------------------------------------------------------------------- 1 | # Copyright 2018 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 | # http://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:public"]) 16 | 17 | licenses(["notice"]) # Apache 2.0 18 | 19 | exports_files([ 20 | "LICENSE", 21 | ]) 22 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. 4 | 5 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. 6 | 7 | Examples of unacceptable behavior by participants include: 8 | 9 | * The use of sexualized language or imagery 10 | * Personal attacks 11 | * Trolling or insulting/derogatory comments 12 | * Public or private harassment 13 | * Publishing other's private information, such as physical or electronic addresses, without explicit permission 14 | * Other unethical or unprofessional conduct 15 | 16 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. 17 | 18 | This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. 19 | 20 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. 21 | 22 | This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.2.0, available at https://www.contributor-covenant.org/version/1/2/0/code-of-conduct.html 23 | 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This repo has moved 2 | 3 | It now lives in the https://github.com/googleapis/google-cloud-cpp monorepo. 4 | 5 | -------------------------------------------------------------------------------- /WORKSPACE: -------------------------------------------------------------------------------- 1 | # Copyright 2018 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 | # http://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 | workspace(name = "com_github_googleapis_google_cloud_cpp_common") 16 | 17 | load("//bazel:google_cloud_cpp_common_deps.bzl", "google_cloud_cpp_common_deps") 18 | 19 | google_cloud_cpp_common_deps() 20 | 21 | load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language") 22 | 23 | # Configure @com_google_googleapis to only compile C++ and gRPC: 24 | switched_rules_by_language( 25 | name = "com_google_googleapis_imports", 26 | cc = True, # C++ support is only "Partially implemented", roll our own. 27 | grpc = True, 28 | ) 29 | 30 | # Have to manually call the corresponding function for gRPC: 31 | # https://github.com/bazelbuild/bazel/issues/1550 32 | load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") 33 | 34 | grpc_deps() 35 | 36 | load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps") 37 | 38 | grpc_extra_deps() 39 | -------------------------------------------------------------------------------- /bazel/BUILD: -------------------------------------------------------------------------------- 1 | # Copyright 2018 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 | # http://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 | licenses(["notice"]) # Apache v2 16 | 17 | package(default_visibility = ["//:__subpackages__"]) 18 | -------------------------------------------------------------------------------- /bazel/googleapis.BUILD: -------------------------------------------------------------------------------- 1 | # Copyright 2018 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 | # http://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:public"]) 16 | 17 | licenses(["notice"]) # Apache 2.0 18 | 19 | # This rule lets us include headers from googleapis targets using angle 20 | # brackets like system includes. 21 | cc_library( 22 | name = "googleapis_system_includes", 23 | includes = [ 24 | ".", 25 | ], 26 | ) 27 | 28 | -------------------------------------------------------------------------------- /ci/colors.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2018 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 | # http://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 | if [ -z "${COLOR_RESET+x}" ]; then 17 | if type tput >/dev/null 2>&1; then 18 | readonly COLOR_RED="$(tput setaf 1)" 19 | readonly COLOR_GREEN="$(tput setaf 2)" 20 | readonly COLOR_YELLOW="$(tput setaf 3)" 21 | readonly COLOR_RESET="$(tput sgr0)" 22 | else 23 | readonly COLOR_RED="" 24 | readonly COLOR_GREEN="" 25 | readonly COLOR_YELLOW="" 26 | readonly COLOR_RESET="" 27 | fi 28 | fi 29 | -------------------------------------------------------------------------------- /ci/define-dump-log.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2018 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 | # http://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 | # Dump a log file to the console without going over CI system limits. 18 | # Globals: 19 | # None 20 | # Arguments: 21 | # logfile: the name of the logfile to print out. 22 | # Returns: 23 | # None 24 | ################################################ 25 | dump_log() { 26 | local -r logfile=$1 27 | shift 28 | local -r base="$(basename "${logfile}")" 29 | 30 | if [ ! -r "${logfile}" ]; then 31 | return 32 | fi 33 | 34 | echo "================ [begin ${base}] ================" 35 | # Travis has a limit of ~10,000 lines, if the file is around 1,000 just print 36 | # the full file. 37 | if [ "$(wc -l "${logfile}" | awk '{print $1}')" -lt 200 ]; then 38 | cat "${logfile}" 39 | else 40 | head -100 "${logfile}" 41 | echo "==== [snip] [snip] [${base}] [snip] [snip] ====" 42 | tail -100 "${logfile}" 43 | fi 44 | echo "================ [end ${base}] ================" 45 | } 46 | -------------------------------------------------------------------------------- /ci/etc/install-config.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2019 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 | # http://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 | set -eu 17 | 18 | GOOGLE_CLOUD_CPP_BAZEL_VERSION="2.0.0" 19 | readonly GOOGLE_CLOUD_CPP_BAZEL_VERSION 20 | 21 | GOOGLE_CLOUD_CPP_CLOUD_SDK_VERSION="266.0.0" 22 | readonly GOOGLE_CLOUD_CPP_CLOUD_SDK_VERSION 23 | 24 | GOOGLE_CLOUD_CPP_SDK_SHA256="e2b2cd5e49e1dc73ffe1d57ba2bcc1b76620ae9549d2aa27ece05d819a8f4bbc" 25 | readonly GOOGLE_CLOUD_CPP_SDK_SHA256 26 | -------------------------------------------------------------------------------- /ci/etc/kokoro/install/run-installed-programs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2019 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 | # http://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 | run_args=( 17 | # Remove the container after running 18 | "--rm" 19 | ) 20 | 21 | echo "================================================================" 22 | echo "Run test program against installed libraries ${DISTRO}." 23 | docker run "${run_args[@]}" "${INSTALL_RUN_IMAGE}" "/i/common_install_test" 24 | echo "================================================================" 25 | -------------------------------------------------------------------------------- /ci/etc/kokoro/readme/project-config.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2019 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 | # http://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 | declare -A ORIGINAL_COPYRIGHT_YEAR=( 17 | [centos-7]=2019 18 | [centos-8]=2019 19 | [debian-buster]=2019 20 | [debian-stretch]=2019 21 | [fedora]=2019 22 | [opensuse-leap]=2019 23 | [opensuse-tumbleweed]=2019 24 | [ubuntu-xenial]=2019 25 | [ubuntu-bionic]=2019 26 | ) 27 | -------------------------------------------------------------------------------- /ci/etc/publish-refdocs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2019 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 | # http://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 | set -eu 17 | 18 | # This script is meant to source from ci/kokoro/docker/publish_refdocs.sh. 19 | 20 | upload_docs "google-cloud-common" "${BUILD_OUTPUT}/google/cloud/html" \ 21 | "cloud.tag" "${BRANCH}" "${CREDENTIALS_FILE}" "${STAGING_BUCKET}" 22 | upload_docs "google-cloud-common-grpc-utils" \ 23 | "${BUILD_OUTPUT}/google/cloud/grpc_utils/html" "grpc_utils.tag" "${BRANCH}" \ 24 | "${CREDENTIALS_FILE}" "${STAGING_BUCKET}" 25 | -------------------------------------------------------------------------------- /ci/etc/repo-config.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2019 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 | # http://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 | set -eu 17 | 18 | # This script is sourced from several other scripts in `ci/` to configure the 19 | # repository name (and short name). It makes those scripts portable across 20 | # `google-cloud-cpp*` repositories. 21 | 22 | GOOGLE_CLOUD_CPP_REPOSITORY="google-cloud-cpp-common" 23 | readonly GOOGLE_CLOUD_CPP_REPOSITORY 24 | 25 | GOOGLE_CLOUD_CPP_REPOSITORY_SHORT="common" 26 | readonly GOOGLE_CLOUD_CPP_REPOSITORY_SHORT 27 | -------------------------------------------------------------------------------- /ci/install-bazel.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright 2018 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -eu 18 | 19 | if [[ -z "${PROJECT_ROOT+x}" ]]; then 20 | PROJECT_ROOT="$(cd "$(dirname "$0")/.."; pwd)" 21 | readonly PROJECT_ROOT 22 | fi 23 | source "${PROJECT_ROOT}/ci/etc/install-config.sh" 24 | 25 | readonly PLATFORM=$(printf "%s-%s" "$(uname -s)" "$(uname -m)" \ 26 | | tr '[:upper:]' '[:lower:]') 27 | 28 | readonly BAZEL_VERSION="${GOOGLE_CLOUD_CPP_BAZEL_VERSION}" 29 | readonly GITHUB_DL="https://github.com/bazelbuild/bazel/releases/download" 30 | readonly SCRIPT_NAME="bazel-${BAZEL_VERSION}-installer-${PLATFORM}.sh" 31 | wget -q "${GITHUB_DL}/${BAZEL_VERSION}/${SCRIPT_NAME}" 32 | wget -q "${GITHUB_DL}/${BAZEL_VERSION}/${SCRIPT_NAME}.sha256" 33 | 34 | # We want to protect against accidents (i.e., we don't want to download and 35 | # execute a 404 page), not malice, so downloading the checksum and the file 36 | # from the same source is Okay. 37 | sha256sum --check "${SCRIPT_NAME}.sha256" 38 | 39 | chmod +x "${SCRIPT_NAME}" 40 | if [[ "${USER:-}" = "root" ]] || [[ "${USER+x}" = "" ]]; then 41 | "./${SCRIPT_NAME}" 42 | else 43 | "./${SCRIPT_NAME}" --user 44 | fi 45 | -------------------------------------------------------------------------------- /ci/install-cloud-sdk.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright 2019 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -eu 18 | 19 | if [[ -z "${PROJECT_ROOT+x}" ]]; then 20 | PROJECT_ROOT="$(cd "$(dirname "$0")/.."; pwd)" 21 | readonly PROJECT_ROOT 22 | fi 23 | source "${PROJECT_ROOT}/ci/etc/install-config.sh" 24 | 25 | readonly SITE="https://dl.google.com/dl/cloudsdk/channels/rapid/downloads" 26 | readonly TARBALL="google-cloud-sdk-${GOOGLE_CLOUD_CPP_CLOUD_SDK_VERSION}-linux-x86_64.tar.gz" 27 | wget -q "${SITE}/${TARBALL}" 28 | 29 | echo "${GOOGLE_CLOUD_CPP_CLOUD_SDK_SHA256} ${TARBALL}" | sha256sum --check - 30 | tar x -C /usr/local -f "${TARBALL}" 31 | /usr/local/google-cloud-sdk/bin/gcloud --quiet components install cbt bigtable 32 | -------------------------------------------------------------------------------- /ci/kokoro/docker/Dockerfile.centos: -------------------------------------------------------------------------------- 1 | # Copyright 2020 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 | # http://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 | ARG DISTRO_VERSION=7 16 | FROM centos:${DISTRO_VERSION} 17 | 18 | # We need to install cmake3, which on CentOS-7 requires an extra source 19 | RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 20 | RUN yum install -y centos-release-scl 21 | RUN yum-config-manager --enable rhel-server-rhscl-7-rpms 22 | 23 | RUN yum makecache && \ 24 | yum install -y automake cmake3 curl-devel gcc gcc-c++ git libtool \ 25 | make openssl-devel pkgconfig tar wget which zlib-devel 26 | RUN ln -sf /usr/bin/cmake3 /usr/bin/cmake && ln -sf /usr/bin/ctest3 /usr/bin/ctest 27 | -------------------------------------------------------------------------------- /ci/kokoro/docker/Dockerfile.fedora: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Google Inc. 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 | # http://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 | ARG DISTRO_VERSION=30 16 | FROM fedora:${DISTRO_VERSION} 17 | 18 | RUN dnf makecache && dnf install -y \ 19 | autoconf \ 20 | automake \ 21 | c-ares-devel \ 22 | ccache \ 23 | clang \ 24 | clang-tools-extra \ 25 | cmake \ 26 | curl \ 27 | dia \ 28 | doxygen \ 29 | gcc-c++ \ 30 | git \ 31 | libcxx-devel \ 32 | libcxxabi-devel \ 33 | libtool \ 34 | make \ 35 | ncurses-term \ 36 | openssl-devel \ 37 | pkgconfig \ 38 | python3 \ 39 | shtool \ 40 | unzip \ 41 | wget \ 42 | which \ 43 | zlib-devel 44 | 45 | # Install Bazel because some of the builds need it. 46 | WORKDIR /var/tmp/ci 47 | COPY . /var/tmp/ci 48 | RUN /var/tmp/ci/install-bazel.sh 49 | -------------------------------------------------------------------------------- /ci/kokoro/docker/Dockerfile.ubuntu: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Google Inc. 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 | # http://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 | ARG DISTRO_VERSION=18.04 16 | FROM ubuntu:${DISTRO_VERSION} 17 | 18 | RUN apt-get update && \ 19 | apt-get --no-install-recommends install -y \ 20 | apt-transport-https \ 21 | apt-utils \ 22 | automake \ 23 | build-essential \ 24 | ca-certificates \ 25 | ccache \ 26 | clang \ 27 | cmake \ 28 | curl \ 29 | doxygen \ 30 | gawk \ 31 | git \ 32 | gcc \ 33 | g++ \ 34 | libssl-dev \ 35 | libtool \ 36 | lsb-release \ 37 | make \ 38 | ninja-build \ 39 | pkg-config \ 40 | python3 \ 41 | python3-pip \ 42 | shellcheck \ 43 | tar \ 44 | unzip \ 45 | wget \ 46 | zlib1g-dev 47 | 48 | # Install Bazel because some of the builds need it. 49 | WORKDIR /var/tmp/ci 50 | COPY . /var/tmp/ci 51 | RUN /var/tmp/ci/install-bazel.sh 52 | -------------------------------------------------------------------------------- /ci/kokoro/docker/asan-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/asan-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/asan.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/asan.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/bazel-dependency-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/bazel-dependency-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/bazel-dependency.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/bazel-dependency.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/check-api-presubmit.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | # Copyright 2019 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 | # http://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 | action { 17 | define_artifacts { 18 | regex: "**/src_compat_report.html" 19 | strip_prefix: "github/google-cloud-cpp-common/cmake-out/ubuntu-install-18.04-gcc-Debug-shared/compat_reports" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ci/kokoro/docker/check-api.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | # Copyright 2019 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 | # http://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 | action { 17 | define_artifacts { 18 | regex: "**/src_compat_report.html" 19 | strip_prefix: "github/google-cloud-cpp-common/cmake-out/ubuntu-install-18.04-gcc-Debug-shared/compat_reports" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ci/kokoro/docker/clang-3.8-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/clang-3.8-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/clang-3.8.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/clang-3.8.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/clang-9-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/clang-9-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/clang-9.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/clang-9.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/clang-tidy-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/clang-tidy-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/clang-tidy.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | # Copyright 2019 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 | # http://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 | -------------------------------------------------------------------------------- /ci/kokoro/docker/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | # Copyright 2019 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 | # http://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 | build_file: "google-cloud-cpp-common/ci/kokoro/docker/build.sh" 17 | timeout_mins: 120 18 | 19 | gfile_resources: "/bigstore/cloud-cpp-integration-secrets/gcr-service-account.json" 20 | gfile_resources: "/bigstore/cloud-cpp-integration-secrets/gcr-configuration.sh" 21 | -------------------------------------------------------------------------------- /ci/kokoro/docker/coverage-presubmit.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | # Copyright 2019 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 | # http://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 | gfile_resources: "/bigstore/cloud-cpp-integration-secrets/common/codecov-io-upload-token" 17 | -------------------------------------------------------------------------------- /ci/kokoro/docker/coverage.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | # Copyright 2019 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 | # http://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 | gfile_resources: "/bigstore/cloud-cpp-integration-secrets/common/codecov-io-upload-token" 17 | -------------------------------------------------------------------------------- /ci/kokoro/docker/cxx17-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/cxx17-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/cxx17.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/cxx17.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/dump-logs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright 2018 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -eu 18 | 19 | if [[ -z "${PROJECT_ROOT+x}" ]]; then 20 | readonly PROJECT_ROOT="$(cd "$(dirname "$0")/../../.."; pwd)" 21 | fi 22 | source "${PROJECT_ROOT}/ci/kokoro/define-docker-variables.sh" 23 | source "${PROJECT_ROOT}/ci/define-dump-log.sh" 24 | 25 | # Dump the emulator log file. Tests run in the google/cloud/bigtable/tests 26 | # directory. 27 | echo 28 | dump_log "${BUILD_OUTPUT}/google/cloud/bigtable/tests/emulator.log" 29 | dump_log "${BUILD_OUTPUT}/google/cloud/bigtable/tests/instance-admin-emulator.log" 30 | -------------------------------------------------------------------------------- /ci/kokoro/docker/dump-reports.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright 2018 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -eu 18 | 19 | if [[ -z "${PROJECT_ROOT+x}" ]]; then 20 | readonly PROJECT_ROOT="$(cd "$(dirname "$0")/../../.."; pwd)" 21 | fi 22 | source "${PROJECT_ROOT}/ci/kokoro/define-docker-variables.sh" 23 | 24 | # If w3m is installed there is nothing to do. 25 | if ! type w3m >/dev/null 2>&1; then 26 | # Try to install a HTML renderer, if this fails the script will exit. Note 27 | # that this runs on Kokoro, under Ubuntu, therefore the command to install 28 | # this package is well-known: 29 | sudo apt install -y w3m 30 | fi 31 | 32 | function dump_report() { 33 | local filename="$1" 34 | 35 | echo 36 | echo "================ ${filename} ================" 37 | w3m -dump "${filename}" 38 | } 39 | 40 | export -f dump_report 41 | 42 | # Find any analysis reports, currently ABI checks and Clang static analysis are 43 | # the two things that produce them. Note that the Clang static analysis reports 44 | # are copied into the scan-cmake-out directory by the build-docker.sh script. 45 | 46 | find "${BUILD_OUTPUT}" -name 'src_compat_report.html' \ 47 | -exec bash -c 'dump_report "$1"' _ {} \; 2>/dev/null || \ 48 | echo "No ABI compatibility reports found." 49 | 50 | find scan-cmake-out/ -name '*.html' \ 51 | -exec bash -c 'dump_report "$1"' _ {} \; 2>/dev/null || \ 52 | echo "No static analysis reports found." 53 | -------------------------------------------------------------------------------- /ci/kokoro/docker/gcc-4.8-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/gcc-4.8-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/gcc-4.8.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/gcc-4.8.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/gcc-9-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/gcc-9-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/gcc-9.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/gcc-9.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/libcxx-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/libcxx-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/libcxx.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/libcxx.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/msan-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/msan-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/msan.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/msan.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/ninja-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/ninja-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/ninja.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/ninja.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/no-tests-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/no-tests-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/no-tests.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/no-tests.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/noex-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/noex-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/noex.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/noex.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/publish-refdocs.cfg: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | # Format: //devtools/kokoro/config/proto/build.proto 16 | 17 | before_action { 18 | fetch_keystore { 19 | keystore_resource { 20 | keystore_config_id: 73713 21 | keyname: "docuploader_service_account" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ci/kokoro/docker/shared-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/shared-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/shared.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/shared.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/tsan-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/tsan-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/tsan.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/tsan.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/ubsan-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/ubsan-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/docker/ubsan.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/docker/ubsan.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/centos-7-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/centos-7-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/centos-7.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/centos-7.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/centos-8-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/centos-8-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/centos-8.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/centos-8.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | # Copyright 2019 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 | # http://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 | build_file: "google-cloud-cpp-common/ci/kokoro/install/build.sh" 17 | timeout_mins: 120 18 | 19 | gfile_resources: "/bigstore/cloud-cpp-integration-secrets/gcr-service-account.json" 20 | gfile_resources: "/bigstore/cloud-cpp-integration-secrets/gcr-configuration.sh" 21 | -------------------------------------------------------------------------------- /ci/kokoro/install/debian-buster-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/debian-buster-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/debian-buster.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/debian-buster.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/debian-stretch-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/debian-stretch-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/debian-stretch.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/debian-stretch.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/fedora-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/fedora-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/fedora.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/fedora.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/opensuse-leap-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/opensuse-leap-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/opensuse-leap.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/opensuse-leap.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/opensuse-tumbleweed-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/opensuse-tumbleweed-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/opensuse-tumbleweed.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/opensuse-tumbleweed.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/ubuntu-bionic-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/ubuntu-bionic-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/ubuntu-bionic.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/ubuntu-bionic.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/ubuntu-focal-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/ubuntu-focal-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/ubuntu-focal.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/ubuntu-focal.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/ubuntu-xenial-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/ubuntu-xenial-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/install/ubuntu-xenial.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/install/ubuntu-xenial.cfg -------------------------------------------------------------------------------- /ci/kokoro/macos/bazel-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/macos/bazel-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/macos/bazel.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/macos/bazel.cfg -------------------------------------------------------------------------------- /ci/kokoro/macos/cmake-super-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/macos/cmake-super-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/macos/cmake-super.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/macos/cmake-super.cfg -------------------------------------------------------------------------------- /ci/kokoro/macos/common.cfg: -------------------------------------------------------------------------------- 1 | # Copyright 2018 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 | # http://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 | build_file: "google-cloud-cpp-common/ci/kokoro/macos/build.sh" 16 | timeout_mins: 120 17 | -------------------------------------------------------------------------------- /ci/kokoro/readme/Dockerfile.centos-8: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | # 16 | # WARNING: This is an automatically generated file. Consider changing the 17 | # sources instead. You can find the source templates and scripts at: 18 | # https://github.com/googleapis/google-cloud-cpp-common/tree/master/ci/templates 19 | # 20 | 21 | ARG DISTRO_VERSION=8 22 | FROM centos:${DISTRO_VERSION} AS devtools 23 | 24 | ## [START README.md] 25 | 26 | # Install the development tools needed to compile the project: 27 | 28 | # ```bash 29 | RUN dnf makecache && \ 30 | dnf install -y cmake gcc-c++ git make openssl-devel pkgconfig \ 31 | zlib-devel 32 | # ``` 33 | 34 | ## [END README.md] 35 | 36 | FROM devtools AS readme 37 | ARG NCPU=4 38 | 39 | WORKDIR /home/build/super 40 | COPY . /home/build/super 41 | RUN cmake -Hsuper -Bcmake-out \ 42 | -DGOOGLE_CLOUD_CPP_EXTERNAL_PREFIX=$HOME/local 43 | RUN cmake --build cmake-out -- -j ${NCPU:-4} 44 | -------------------------------------------------------------------------------- /ci/kokoro/readme/Dockerfile.debian-buster: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | # 16 | # WARNING: This is an automatically generated file. Consider changing the 17 | # sources instead. You can find the source templates and scripts at: 18 | # https://github.com/googleapis/google-cloud-cpp-common/tree/master/ci/templates 19 | # 20 | 21 | ARG DISTRO_VERSION=buster 22 | FROM debian:${DISTRO_VERSION} AS devtools 23 | 24 | ## [START README.md] 25 | 26 | # First install the development tools. 27 | 28 | # ```bash 29 | RUN apt-get update && \ 30 | apt-get --no-install-recommends install -y apt-transport-https apt-utils \ 31 | automake build-essential ca-certificates cmake git gcc g++ cmake \ 32 | libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl-dev m4 make \ 33 | pkg-config tar wget zlib1g-dev 34 | # ``` 35 | 36 | ## [END README.md] 37 | 38 | FROM devtools AS readme 39 | ARG NCPU=4 40 | 41 | WORKDIR /home/build/super 42 | COPY . /home/build/super 43 | RUN cmake -Hsuper -Bcmake-out \ 44 | -DGOOGLE_CLOUD_CPP_EXTERNAL_PREFIX=$HOME/local 45 | RUN cmake --build cmake-out -- -j ${NCPU:-4} 46 | -------------------------------------------------------------------------------- /ci/kokoro/readme/Dockerfile.debian-stretch: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | # 16 | # WARNING: This is an automatically generated file. Consider changing the 17 | # sources instead. You can find the source templates and scripts at: 18 | # https://github.com/googleapis/google-cloud-cpp-common/tree/master/ci/templates 19 | # 20 | 21 | ARG DISTRO_VERSION=stretch 22 | FROM debian:${DISTRO_VERSION} AS devtools 23 | 24 | ## [START README.md] 25 | 26 | # First install the development tools. 27 | 28 | # ```bash 29 | RUN apt-get update && \ 30 | apt-get --no-install-recommends install -y apt-transport-https apt-utils \ 31 | automake build-essential cmake ca-certificates git gcc g++ cmake \ 32 | libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl1.0-dev m4 make \ 33 | pkg-config tar wget zlib1g-dev 34 | # ``` 35 | 36 | ## [END README.md] 37 | 38 | FROM devtools AS readme 39 | ARG NCPU=4 40 | 41 | WORKDIR /home/build/super 42 | COPY . /home/build/super 43 | RUN cmake -Hsuper -Bcmake-out \ 44 | -DGOOGLE_CLOUD_CPP_EXTERNAL_PREFIX=$HOME/local 45 | RUN cmake --build cmake-out -- -j ${NCPU:-4} 46 | -------------------------------------------------------------------------------- /ci/kokoro/readme/Dockerfile.fedora: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | # 16 | # WARNING: This is an automatically generated file. Consider changing the 17 | # sources instead. You can find the source templates and scripts at: 18 | # https://github.com/googleapis/google-cloud-cpp-common/tree/master/ci/templates 19 | # 20 | 21 | ARG DISTRO_VERSION=30 22 | FROM fedora:${DISTRO_VERSION} AS devtools 23 | 24 | ## [START README.md] 25 | 26 | # Install the minimal development tools: 27 | 28 | # ```bash 29 | RUN dnf makecache && \ 30 | dnf install -y cmake gcc-c++ git make openssl-devel pkgconfig \ 31 | zlib-devel 32 | # ``` 33 | 34 | ## [END README.md] 35 | 36 | FROM devtools AS readme 37 | ARG NCPU=4 38 | 39 | WORKDIR /home/build/super 40 | COPY . /home/build/super 41 | RUN cmake -Hsuper -Bcmake-out \ 42 | -DGOOGLE_CLOUD_CPP_EXTERNAL_PREFIX=$HOME/local 43 | RUN cmake --build cmake-out -- -j ${NCPU:-4} 44 | -------------------------------------------------------------------------------- /ci/kokoro/readme/Dockerfile.opensuse-leap: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | # 16 | # WARNING: This is an automatically generated file. Consider changing the 17 | # sources instead. You can find the source templates and scripts at: 18 | # https://github.com/googleapis/google-cloud-cpp-common/tree/master/ci/templates 19 | # 20 | 21 | ARG DISTRO_VERSION=latest 22 | FROM opensuse/leap:${DISTRO_VERSION} AS devtools 23 | 24 | ## [START README.md] 25 | 26 | # Install the minimal development tools: 27 | 28 | # ```bash 29 | RUN zypper refresh && \ 30 | zypper install --allow-downgrade -y cmake gcc gcc-c++ git gzip \ 31 | libcurl-devel libopenssl-devel make tar wget 32 | # ``` 33 | 34 | ## [END README.md] 35 | 36 | FROM devtools AS readme 37 | ARG NCPU=4 38 | 39 | WORKDIR /home/build/super 40 | COPY . /home/build/super 41 | RUN cmake -Hsuper -Bcmake-out \ 42 | -DGOOGLE_CLOUD_CPP_EXTERNAL_PREFIX=$HOME/local 43 | RUN cmake --build cmake-out -- -j ${NCPU:-4} 44 | -------------------------------------------------------------------------------- /ci/kokoro/readme/Dockerfile.opensuse-tumbleweed: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | # 16 | # WARNING: This is an automatically generated file. Consider changing the 17 | # sources instead. You can find the source templates and scripts at: 18 | # https://github.com/googleapis/google-cloud-cpp-common/tree/master/ci/templates 19 | # 20 | 21 | ARG DISTRO_VERSION=latest 22 | FROM opensuse/tumbleweed:${DISTRO_VERSION} AS devtools 23 | 24 | ## [START README.md] 25 | 26 | # Install the minimal development tools: 27 | 28 | # ```bash 29 | RUN zypper refresh && \ 30 | zypper install --allow-downgrade -y cmake gcc gcc-c++ git gzip \ 31 | libcurl-devel libopenssl-devel make tar wget zlib-devel 32 | # ``` 33 | 34 | ## [END README.md] 35 | 36 | FROM devtools AS readme 37 | ARG NCPU=4 38 | 39 | WORKDIR /home/build/super 40 | COPY . /home/build/super 41 | RUN cmake -Hsuper -Bcmake-out \ 42 | -DGOOGLE_CLOUD_CPP_EXTERNAL_PREFIX=$HOME/local 43 | RUN cmake --build cmake-out -- -j ${NCPU:-4} 44 | -------------------------------------------------------------------------------- /ci/kokoro/readme/Dockerfile.ubuntu-bionic: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | # 16 | # WARNING: This is an automatically generated file. Consider changing the 17 | # sources instead. You can find the source templates and scripts at: 18 | # https://github.com/googleapis/google-cloud-cpp-common/tree/master/ci/templates 19 | # 20 | 21 | ARG DISTRO_VERSION=bionic 22 | FROM ubuntu:${DISTRO_VERSION} AS devtools 23 | 24 | ## [START README.md] 25 | 26 | # Install the minimal development tools: 27 | 28 | # ```bash 29 | RUN apt-get update && \ 30 | apt-get --no-install-recommends install -y apt-transport-https apt-utils \ 31 | automake build-essential cmake ca-certificates git gcc g++ cmake \ 32 | libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl-dev m4 make \ 33 | pkg-config tar wget zlib1g-dev 34 | # ``` 35 | 36 | ## [END README.md] 37 | 38 | FROM devtools AS readme 39 | ARG NCPU=4 40 | 41 | WORKDIR /home/build/super 42 | COPY . /home/build/super 43 | RUN cmake -Hsuper -Bcmake-out \ 44 | -DGOOGLE_CLOUD_CPP_EXTERNAL_PREFIX=$HOME/local 45 | RUN cmake --build cmake-out -- -j ${NCPU:-4} 46 | -------------------------------------------------------------------------------- /ci/kokoro/readme/Dockerfile.ubuntu-xenial: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | # 16 | # WARNING: This is an automatically generated file. Consider changing the 17 | # sources instead. You can find the source templates and scripts at: 18 | # https://github.com/googleapis/google-cloud-cpp-common/tree/master/ci/templates 19 | # 20 | 21 | ARG DISTRO_VERSION=xenial 22 | FROM ubuntu:${DISTRO_VERSION} AS devtools 23 | 24 | ## [START README.md] 25 | 26 | # Install the minimal development tools: 27 | 28 | # ```bash 29 | RUN apt-get update && \ 30 | apt-get --no-install-recommends install -y apt-transport-https apt-utils \ 31 | automake build-essential cmake ca-certificates git gcc g++ m4 cmake \ 32 | libcurl4-openssl-dev libssl-dev make \ 33 | pkg-config tar wget zlib1g-dev 34 | # ``` 35 | 36 | ## [END README.md] 37 | 38 | FROM devtools AS readme 39 | ARG NCPU=4 40 | 41 | WORKDIR /home/build/super 42 | COPY . /home/build/super 43 | RUN cmake -Hsuper -Bcmake-out \ 44 | -DGOOGLE_CLOUD_CPP_EXTERNAL_PREFIX=$HOME/local 45 | RUN cmake --build cmake-out -- -j ${NCPU:-4} 46 | -------------------------------------------------------------------------------- /ci/kokoro/readme/centos-7-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/centos-7-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/centos-7.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/centos-7.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/centos-8-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/centos-8-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/centos-8.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/centos-8.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | # Copyright 2019 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 | # http://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 | # WARNING: This is an automatically generated file. Consider changing the 18 | # sources instead. You can find the source templates and scripts at: 19 | # https://github.com/googleapis/google-cloud-cpp-common/tree/master/ci/templates 20 | # 21 | 22 | build_file: "google-cloud-cpp-common/ci/kokoro/readme/build.sh" 23 | timeout_mins: 120 24 | 25 | gfile_resources: "/bigstore/cloud-cpp-integration-secrets/gcr-service-account.json" 26 | gfile_resources: "/bigstore/cloud-cpp-integration-secrets/gcr-configuration.sh" 27 | -------------------------------------------------------------------------------- /ci/kokoro/readme/debian-buster-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/debian-buster-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/debian-buster.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/debian-buster.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/debian-stretch-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/debian-stretch-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/debian-stretch.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/debian-stretch.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/fedora-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/fedora-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/fedora.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/fedora.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/opensuse-leap-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/opensuse-leap-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/opensuse-leap.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/opensuse-leap.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/opensuse-tumbleweed-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/opensuse-tumbleweed-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/opensuse-tumbleweed.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/opensuse-tumbleweed.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/ubuntu-bionic-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/ubuntu-bionic-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/ubuntu-bionic.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/ubuntu-bionic.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/ubuntu-xenial-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/ubuntu-xenial-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/readme/ubuntu-xenial.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/readme/ubuntu-xenial.cfg -------------------------------------------------------------------------------- /ci/kokoro/windows/bazel-presubmit.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/windows/bazel-presubmit.cfg -------------------------------------------------------------------------------- /ci/kokoro/windows/bazel.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/kokoro/windows/bazel.cfg -------------------------------------------------------------------------------- /ci/kokoro/windows/build-bazel-dependencies.ps1: -------------------------------------------------------------------------------- 1 | # !/usr/bin/env powershell 2 | # Copyright 2019 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 | # http://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 | Write-Host -ForegroundColor Yellow "`n$(Get-Date -Format o) No dependencies required for Bazel builds." 17 | -------------------------------------------------------------------------------- /ci/kokoro/windows/build.bat: -------------------------------------------------------------------------------- 1 | @REM Copyright 2018 Google LLC 2 | @REM 3 | @REM Licensed under the Apache License, Version 2.0 (the "License"); 4 | @REM you may not use this file except in compliance with the License. 5 | @REM You may obtain a copy of the License at 6 | @REM 7 | @REM http://www.apache.org/licenses/LICENSE-2.0 8 | @REM 9 | @REM Unless required by applicable law or agreed to in writing, software 10 | @REM distributed under the License is distributed on an "AS IS" BASIS, 11 | @REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | @REM See the License for the specific language governing permissions and 13 | @REM limitations under the License. 14 | 15 | REM Install Bazel using Chocolatey 16 | choco install -y bazel --version 2.0.0 17 | 18 | REM Change PATH to use chocolatey's version of Bazel 19 | set PATH=C:\ProgramData\chocolatey\bin;%PATH% 20 | bazel version 21 | 22 | REM Configure the environment to use MSVC 2019 and then switch to PowerShell. 23 | call "c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" 24 | 25 | REM The remaining of the build script is implemented in PowerShell. 26 | echo %date% %time% 27 | cd github\google-cloud-cpp-common 28 | powershell -exec bypass ci\kokoro\windows\build.ps1 29 | if %errorlevel% neq 0 exit /b %errorlevel% 30 | -------------------------------------------------------------------------------- /ci/kokoro/windows/cmake-presubmit.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | # Copyright 2019 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 | # http://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 | env_vars { 17 | key: "BUILD_CACHE" 18 | value: "gs://cloud-cpp-kokoro-results/build-artifacts/common/windows/cmake-vcpkg-installed.zip" 19 | } 20 | 21 | gfile_resources: "/bigstore/cloud-cpp-integration-secrets/build-results-service-account.json" 22 | -------------------------------------------------------------------------------- /ci/kokoro/windows/cmake.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | # Copyright 2019 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 | # http://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 | env_vars { 17 | key: "BUILD_CACHE" 18 | value: "gs://cloud-cpp-kokoro-results/build-artifacts/common/windows/cmake-vcpkg-installed.zip" 19 | } 20 | 21 | gfile_resources: "/bigstore/cloud-cpp-integration-secrets/build-results-service-account.json" 22 | -------------------------------------------------------------------------------- /ci/kokoro/windows/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | # Copyright 2019 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 | # http://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 | build_file: "google-cloud-cpp-common/ci/kokoro/windows/build.bat" 17 | timeout_mins: 120 18 | 19 | action { 20 | define_artifacts { 21 | regex: "**/win_minidumps/*.dmp" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ci/retry-command.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright 2018 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -eu 18 | 19 | # Make three attempts to install the dependencies. It is rare, but from time to 20 | # time the downloading the packages, building the Docker images, or an installer 21 | # Bazel, or the Google Cloud SDK fails. To make the CI build more robust, try 22 | # again when that happens. 23 | 24 | if (( $# < 1 )); then 25 | echo "Usage: $(basename "$0") program [arguments]" 26 | exit 1 27 | fi 28 | readonly PROGRAM=${1} 29 | shift 30 | 31 | # Initially, wait at least 2 minutes (the times are in seconds), because it 32 | # makes no sense to try faster. This used to be 180 seconds, but that ends with 33 | # sleeps close to 10 minutes, and Travis aborts builds that do not output in 34 | # 10m. 35 | min_wait=120 36 | # Do not exit on failures for this loop. 37 | set +e 38 | for i in 1 2 3; do 39 | "${PROGRAM}" "$@" 40 | if [[ $? -eq 0 ]]; then 41 | exit 0 42 | fi 43 | # Sleep for a few minutes before trying again. 44 | period=$(( (RANDOM % 60) + min_wait )) 45 | echo "${PROGRAM} failed; trying again in ${period} seconds." 46 | sleep ${period}s 47 | min_wait=$(( min_wait * 2 )) 48 | done 49 | 50 | exit 1 51 | -------------------------------------------------------------------------------- /ci/templates/README.md: -------------------------------------------------------------------------------- 1 | # Helper scripts to generate CI build scripts 2 | 3 | The Google Cloud C++ projects largely share their CI scripts, but there are some 4 | differences that cannot be (easily) handled by configuration files. This 5 | directory contains helper scripts to generate the scripts or configuration 6 | files that cannot be refactored in any other form. 7 | 8 | To use these scripts use: 9 | 10 | ```bash 11 | ./generate-kokoro-install.sh ${MY_CLONE_DIR} 12 | ``` 13 | 14 | where `MY_CLONE_DIR` is the location of a clone for one of the Google Cloud C++ 15 | projects. 16 | 17 | For example: 18 | 19 | ```bash 20 | git clone git@github.com:$GIT_USER_NAME/google-cloud-cpp-common 21 | git clone git@github.com:$GIT_USER_NAME/google-cloud-cpp-spanner 22 | cd google-cloud-cpp-common 23 | ./ci/templates/generate-kokoro-install.sh ../google-cloud-cpp-spanner 24 | ``` 25 | -------------------------------------------------------------------------------- /ci/templates/kokoro/docker-fragments-functions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2019 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 | # http://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 | read_into_variable() { 17 | # Reading a heredoc into a variable with `read` always exits with an error. 18 | read -r -d '' "${1}" || true 19 | } 20 | 21 | # We need a way to replace "variables" into a chunk of text, but this is 22 | # complicated because the text may (and does) contain shell special characters. 23 | # So we use `sed` to replace @VAR@ by the value of the variable, which is also 24 | # complicated because the text may contain newlines, and sed special characters. 25 | # With enough escaping things work for our purposes. 26 | replace_fragments() { 27 | local fragment_names=("$@" "GOOGLE_CLOUD_CPP_REPOSITORY") 28 | 29 | local sed_args=() 30 | for fragment in "${fragment_names[@]}"; do 31 | # shellcheck disable=SC2016 32 | sed_args+=("-e" "s,@${fragment}@,$(/bin/echo -n "${!fragment}" | 33 | # Note the use of \003 ("End of Text") as the magic character to 34 | # represent newlines. This must match the invert `tr` call below. It 35 | # allows us to escape newlines in the sed expression. 36 | tr '\n' '\003' | 37 | sed -e 's,\\,\\\\,g' -e 's/&/\\&/g' -e 's/,/\\,/g' -e 's/`/\\`/'),") 38 | done 39 | 40 | sed "${sed_args[@]}" | tr '\003' '\n' 41 | } 42 | -------------------------------------------------------------------------------- /ci/templates/kokoro/install/Dockerfile.debian-buster.in: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | @WARNING_GENERATED_FILE_FRAGMENT@ 16 | 17 | ARG DISTRO_VERSION=buster 18 | FROM debian:${DISTRO_VERSION} AS devtools 19 | ARG NCPU=4 20 | 21 | ## [START INSTALL.md] 22 | 23 | # Install the minimal development tools, libcurl, and OpenSSL: 24 | 25 | # ```bash 26 | RUN apt-get update && \ 27 | apt-get --no-install-recommends install -y apt-transport-https apt-utils \ 28 | automake build-essential ca-certificates ccache cmake git gcc g++ \ 29 | libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl-dev m4 make \ 30 | pkg-config tar wget zlib1g-dev 31 | # ``` 32 | 33 | # Debian 10 includes versions of gRPC and Protobuf that support the 34 | # Google Cloud Platform proto files. We simply install these pre-built versions: 35 | 36 | # ```bash 37 | RUN apt-get update && \ 38 | apt-get --no-install-recommends install -y libgrpc++-dev libprotobuf-dev libc-ares-dev \ 39 | protobuf-compiler protobuf-compiler-grpc 40 | # ``` 41 | 42 | @BUILD_AND_TEST_PROJECT_FRAGMENT@ 43 | -------------------------------------------------------------------------------- /ci/templates/kokoro/install/Dockerfile.fedora.in: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | @WARNING_GENERATED_FILE_FRAGMENT@ 16 | 17 | ARG DISTRO_VERSION=30 18 | FROM fedora:${DISTRO_VERSION} AS devtools 19 | ARG NCPU=4 20 | 21 | ## [START INSTALL.md] 22 | 23 | # Install the minimal development tools: 24 | 25 | # ```bash 26 | RUN dnf makecache && \ 27 | dnf install -y ccache cmake gcc-c++ git make openssl-devel pkgconfig \ 28 | zlib-devel 29 | # ``` 30 | 31 | # Fedora 30 includes packages for gRPC, libcurl, and OpenSSL that are recent 32 | # enough for the project. Install these packages and additional development 33 | # tools to compile the dependencies: 34 | 35 | # ```bash 36 | RUN dnf makecache && \ 37 | dnf install -y grpc-devel grpc-plugins \ 38 | libcurl-devel protobuf-compiler tar wget zlib-devel 39 | # ``` 40 | 41 | # The following steps will install libraries and tools in `/usr/local`. By 42 | # default pkg-config does not search in these directories. 43 | 44 | # ```bash 45 | ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig 46 | # ``` 47 | 48 | @BUILD_AND_TEST_PROJECT_FRAGMENT@ 49 | -------------------------------------------------------------------------------- /ci/templates/kokoro/install/Dockerfile.opensuse-tumbleweed.in: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | @WARNING_GENERATED_FILE_FRAGMENT@ 16 | 17 | ARG DISTRO_VERSION=latest 18 | FROM opensuse/tumbleweed:${DISTRO_VERSION} AS devtools 19 | ARG NCPU=4 20 | 21 | ## [START INSTALL.md] 22 | 23 | # Install the minimal development tools, libcurl and OpenSSL: 24 | 25 | # ```bash 26 | RUN zypper refresh && \ 27 | zypper install --allow-downgrade -y ccache cmake gcc gcc-c++ git gzip \ 28 | libcurl-devel libopenssl-devel make tar wget zlib-devel 29 | # ``` 30 | 31 | # The versions of gRPC and Protobuf packaged with openSUSE/Tumbleweed are recent 32 | # enough to support the Google Cloud Platform proto files. 33 | 34 | # ```bash 35 | RUN zypper refresh && \ 36 | zypper install -y grpc-devel 37 | # ``` 38 | 39 | # The following steps will install libraries and tools in `/usr/local`. By 40 | # default pkg-config does not search in these directories. 41 | 42 | # ```bash 43 | ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig 44 | # ``` 45 | 46 | @BUILD_AND_TEST_PROJECT_FRAGMENT@ 47 | -------------------------------------------------------------------------------- /ci/templates/kokoro/install/Dockerfile.ubuntu-bionic.in: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | @WARNING_GENERATED_FILE_FRAGMENT@ 16 | 17 | ARG DISTRO_VERSION=bionic 18 | FROM ubuntu:${DISTRO_VERSION} AS devtools 19 | ARG NCPU=4 20 | 21 | ## [START INSTALL.md] 22 | 23 | # Install the minimal development tools, libcurl, OpenSSL and libc-ares: 24 | 25 | # ```bash 26 | RUN apt-get update && \ 27 | apt-get --no-install-recommends install -y apt-transport-https apt-utils \ 28 | automake build-essential ccache cmake ca-certificates git gcc g++ \ 29 | libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl-dev m4 make \ 30 | pkg-config tar wget zlib1g-dev 31 | # ``` 32 | 33 | # #### Protobuf 34 | 35 | # We need to install a version of Protobuf that is recent enough to support the 36 | # Google Cloud Platform proto files: 37 | 38 | # ```bash 39 | @INSTALL_PROTOBUF_FROM_SOURCE@ 40 | # ``` 41 | 42 | # #### gRPC 43 | 44 | # We also need a version of gRPC that is recent enough to support the Google 45 | # Cloud Platform proto files. We install it using: 46 | 47 | # ```bash 48 | @INSTALL_GRPC_FROM_SOURCE@ 49 | # ``` 50 | 51 | @BUILD_AND_TEST_PROJECT_FRAGMENT@ 52 | -------------------------------------------------------------------------------- /ci/templates/kokoro/install/Dockerfile.ubuntu-focal.in: -------------------------------------------------------------------------------- 1 | # Copyright 2020 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 | # http://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 | @WARNING_GENERATED_FILE_FRAGMENT@ 16 | 17 | ARG DISTRO_VERSION=focal 18 | FROM ubuntu:${DISTRO_VERSION} AS devtools 19 | ARG NCPU=4 20 | 21 | ## [START INSTALL.md] 22 | 23 | # Install the minimal development tools, libcurl, OpenSSL and libc-ares: 24 | 25 | # ```bash 26 | ENV DEBIAN_FRONTEND=noninteractive 27 | RUN apt-get update && \ 28 | apt-get --no-install-recommends install -y apt-transport-https apt-utils \ 29 | automake build-essential ccache cmake ca-certificates git gcc g++ \ 30 | libc-ares-dev libc-ares2 libcurl4-openssl-dev libssl-dev m4 make \ 31 | pkg-config tar wget zlib1g-dev 32 | # ``` 33 | 34 | # #### Protobuf 35 | 36 | # We need to install a version of Protobuf that is recent enough to support the 37 | # Google Cloud Platform proto files: 38 | 39 | # ```bash 40 | @INSTALL_PROTOBUF_FROM_SOURCE@ 41 | # ``` 42 | 43 | # #### gRPC 44 | 45 | # We also need a version of gRPC that is recent enough to support the Google 46 | # Cloud Platform proto files. We install it using: 47 | 48 | # ```bash 49 | @INSTALL_GRPC_FROM_SOURCE@ 50 | # ``` 51 | 52 | @BUILD_AND_TEST_PROJECT_FRAGMENT@ 53 | -------------------------------------------------------------------------------- /ci/templates/kokoro/install/Dockerfile.ubuntu-xenial.in: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | @WARNING_GENERATED_FILE_FRAGMENT@ 16 | 17 | ARG DISTRO_VERSION=xenial 18 | FROM ubuntu:${DISTRO_VERSION} AS devtools 19 | ARG NCPU=4 20 | 21 | ## [START INSTALL.md] 22 | 23 | # Install the minimal development tools, OpenSSL and libcurl: 24 | 25 | # ```bash 26 | RUN apt-get update && \ 27 | apt-get --no-install-recommends install -y apt-transport-https apt-utils \ 28 | automake build-essential ccache cmake ca-certificates git gcc g++ \ 29 | libcurl4-openssl-dev libssl-dev libtool m4 make \ 30 | pkg-config tar wget zlib1g-dev 31 | # ``` 32 | 33 | # #### Protobuf 34 | 35 | # We need to install a version of Protobuf that is recent enough to support the 36 | # Google Cloud Platform proto files: 37 | 38 | # ```bash 39 | @INSTALL_PROTOBUF_FROM_SOURCE@ 40 | # ``` 41 | 42 | # #### c-ares 43 | 44 | # Recent versions of gRPC require c-ares >= 1.11, while Ubuntu-16.04 45 | # distributes c-ares-1.10. Manually install a newer version: 46 | 47 | # ```bash 48 | @INSTALL_C_ARES_FROM_SOURCE@ 49 | # ``` 50 | 51 | # #### gRPC 52 | 53 | # We also need a version of gRPC that is recent enough to support the Google 54 | # Cloud Platform proto files. We can install gRPC from source using: 55 | 56 | # ```bash 57 | @INSTALL_GRPC_FROM_SOURCE@ 58 | # ``` 59 | 60 | @BUILD_AND_TEST_PROJECT_FRAGMENT@ 61 | -------------------------------------------------------------------------------- /ci/test-api/google_cloud_cpp_common.expected.abi.dump.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/test-api/google_cloud_cpp_common.expected.abi.dump.gz -------------------------------------------------------------------------------- /ci/test-api/google_cloud_cpp_grpc_utils.expected.abi.dump.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-cpp-common/4192f662349a35bdd34090c20bade14839b1bfb7/ci/test-api/google_cloud_cpp_grpc_utils.expected.abi.dump.gz -------------------------------------------------------------------------------- /ci/test-install/BUILD: -------------------------------------------------------------------------------- 1 | # Copyright 2018 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 | # http://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:public"]) 16 | 17 | licenses(["notice"]) # Apache 2.0 18 | 19 | cc_test( 20 | name = "common_install_test", 21 | srcs = [ 22 | "common_install_test.cc", 23 | ], 24 | deps = [ 25 | "@com_github_googleapis_google_cloud_cpp_common//google/cloud:google_cloud_cpp_common", 26 | "@com_github_googleapis_google_cloud_cpp_common//google/cloud/grpc_utils:google_cloud_cpp_grpc_utils", 27 | ], 28 | ) 29 | -------------------------------------------------------------------------------- /ci/test-install/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 | # use this file except in compliance with the License. You may obtain a copy of 5 | # the License at 6 | # 7 | # http://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, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations under 13 | # the License. 14 | 15 | # A minimal CMakeList.txt to *test* the install Cloud Bigtable C++ client. 16 | # 17 | # This is not intended to be a demonstration of how to write good CMakeList.txt 18 | # files, nor is it a general solution to create CMake files for google-cloud- 19 | # cpp. It is simply a minimal CMake file to verify that (a) the installed 20 | # libraries contain all required headers, and (b) the installed CMake 21 | # configuration files are usable. 22 | 23 | cmake_minimum_required(VERSION 3.5) 24 | project(google-cloud-cpp-common-integration-test CXX C) 25 | 26 | set(CMAKE_CXX_STANDARD 11) 27 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 28 | 29 | find_package(Threads REQUIRED) 30 | find_package(google_cloud_cpp_grpc_utils REQUIRED) 31 | find_package(google_cloud_cpp_common REQUIRED) 32 | 33 | add_executable(common_install_test common_install_test.cc) 34 | target_link_libraries(common_install_test PRIVATE google_cloud_cpp_grpc_utils 35 | google_cloud_cpp_common) 36 | -------------------------------------------------------------------------------- /ci/test-install/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | # A simple Makefile to test the `install` target. 16 | # 17 | # This is not intended to be a demonstration of how to write good Makefiles, 18 | # nor is it a general solution on how to build Makefiles for google-cloud-cpp. 19 | # It is simply a minimal file to test the installed pkg-config support files. 20 | 21 | # The CXX, CXXFLAGS and CXXLD variables are hard-coded. These values work for 22 | # our tests, but applications would typically make them configurable parameters. 23 | CXX=g++ 24 | CXXFLAGS=-std=c++11 -pthread 25 | CXXLD=$(CXX) 26 | 27 | all: common_install_test 28 | 29 | # Configuration variables to compile and link against the Cloud C++ common 30 | # library. 31 | GCPP_DEPS := google_cloud_cpp_grpc_utils google_cloud_cpp_common grpc++ grpc 32 | GCPP_CXXFLAGS := $(shell pkg-config $(GCPP_DEPS) --cflags) 33 | GCPP_CXXLDFLAGS := $(shell pkg-config $(GCPP_DEPS) --libs-only-L) 34 | GCPP_LIBS := $(shell pkg-config $(GCPP_DEPS) --libs-only-l) 35 | 36 | # A target using the Cloud C++ common library. 37 | common_install_test: common_install_test.cc 38 | $(CXXLD) $(CXXFLAGS) $(GCPP_CXXFLAGS) $(GCPP_CXXLDFLAGS) -o $@ $^ $(GCPP_LIBS) 39 | -------------------------------------------------------------------------------- /ci/test-readme/extract-install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright 2019 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -eu 18 | 19 | readonly BINDIR=$(dirname "$0") 20 | 21 | sed -e '0,/^.*\[START INSTALL.md\].*$/d' \ 22 | -e '/^.*\[END INSTALL.md\].*$/,$d' "$@" | \ 23 | "${BINDIR}/dockerfile2markdown.sh" 24 | -------------------------------------------------------------------------------- /ci/test-readme/extract-readme.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright 2019 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -eu 18 | 19 | readonly BINDIR=$(dirname "$0") 20 | 21 | sed -e '0,/^.*\[START README.md\].*$/d' \ 22 | -e '/^.*\[END README.md\].*$/,$d' "$@" | \ 23 | "${BINDIR}/dockerfile2markdown.sh" 24 | -------------------------------------------------------------------------------- /cmake/EnableClangTidy.cmake: -------------------------------------------------------------------------------- 1 | # ~~~ 2 | # Copyright 2017 Google Inc. 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 | # http://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 | option(GOOGLE_CLOUD_CPP_CLANG_TIDY 18 | "If set compiles the Cloud Cloud C++ Libraries with clang-tidy." "") 19 | mark_as_advanced(GOOGLE_CLOUD_CPP_CLANG_TIDY) 20 | 21 | if (${CMAKE_VERSION} VERSION_LESS "3.6") 22 | message(STATUS "clang-tidy is not enabled because cmake version is too old") 23 | else () 24 | if (${CMAKE_VERSION} VERSION_LESS "3.8") 25 | message(WARNING "clang-tidy exit code ignored in this version of cmake") 26 | endif () 27 | find_program( 28 | GOOGLE_CLOUD_CPP_CLANG_TIDY_PROGRAM 29 | NAMES "clang-tidy" 30 | DOC "Path to clang-tidy executable") 31 | mark_as_advanced(GOOGLE_CLOUD_CPP_CLANG_TIDY_PROGRAM) 32 | if (NOT GOOGLE_CLOUD_CPP_CLANG_TIDY_PROGRAM) 33 | message(STATUS "clang-tidy not found.") 34 | else () 35 | message( 36 | STATUS "clang-tidy found: ${GOOGLE_CLOUD_CPP_CLANG_TIDY_PROGRAM}") 37 | endif () 38 | endif () 39 | -------------------------------------------------------------------------------- /cmake/EnableCxxExceptions.cmake: -------------------------------------------------------------------------------- 1 | # ~~~ 2 | # Copyright 2018 Google Inc. 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 | # http://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 | option(GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS "Enable C++ Exception Support" ON) 18 | 19 | # If the user disabled C++ exceptions we should give them a heads up about the 20 | # consequences. 21 | if (NOT GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS) 22 | message( 23 | WARNING 24 | "C++ Exceptions disabled, any operation that normally" 25 | " raises exceptions will instead log the error and call" 26 | " std::abort(). In addition, some examples and tests will not be" 27 | " compiled.") 28 | if (MSVC) 29 | set(GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG "/EHs-c-") 30 | else () 31 | set(GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG "-fno-exceptions") 32 | endif () 33 | else () 34 | set(GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG "") 35 | endif () 36 | -------------------------------------------------------------------------------- /cmake/IncludeNlohmannJson.cmake: -------------------------------------------------------------------------------- 1 | # ~~~ 2 | # Copyright 2018 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 | # http://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(ExternalProject) 18 | ExternalProject_Add( 19 | nlohmann_json_project 20 | PREFIX "${CMAKE_BINARY_DIR}/external/nlohmann_json" 21 | DOWNLOAD_COMMAND ${CMAKE_COMMAND} -DDEST=/src -P 22 | ${PROJECT_SOURCE_DIR}/cmake/DownloadNlohmannJson.cmake 23 | CONFIGURE_COMMAND 24 | "" # This is not great, we abuse the `build` step to create the target 25 | # directory. Unfortunately there is no way to specify two commands in 26 | # the install step. 27 | BUILD_COMMAND ${CMAKE_COMMAND} -E make_directory /include 28 | INSTALL_COMMAND 29 | ${CMAKE_COMMAND} -E copy /src/json.hpp 30 | /include/google/cloud/storage/internal/nlohmann_json.hpp 31 | LOG_DOWNLOAD ON 32 | LOG_INSTALL ON) 33 | 34 | add_library(nlohmann_json INTERFACE) 35 | add_dependencies(nlohmann_json nlohmann_json_project) 36 | target_include_directories( 37 | nlohmann_json 38 | INTERFACE 39 | $ 40 | $) 41 | -------------------------------------------------------------------------------- /cmake/SelectMSVCRuntime.cmake: -------------------------------------------------------------------------------- 1 | # ~~~ 2 | # Copyright 2019 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 | # http://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 | # When compiling against *-static vcpkg packages we need to use the static C++ 18 | # runtime with MSVC. The default is to use the dynamic runtime, which does not 19 | # work in this case. This seems to be the recommended way to change the 20 | # runtime: 21 | # 22 | # ~~~ 23 | # https://gitlab.kitware.com/cmake/community/wikis/FAQ#how-can-i-build-my-msvc-application-with-a-static-runtime 24 | # ~~~ 25 | # 26 | # Note that currently we use VCPKG_TARGET_TRIPLET to determine if the static 27 | # runtime is needed. In the future we may need to use a more complex expression 28 | # to determine this, but this is a good start. 29 | # 30 | if (MSVC AND VCPKG_TARGET_TRIPLET MATCHES "-static$") 31 | foreach (flag_var 32 | CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE 33 | CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) 34 | if (${flag_var} MATCHES "/MD") 35 | string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") 36 | endif () 37 | endforeach (flag_var) 38 | unset(flag_var) 39 | endif () 40 | -------------------------------------------------------------------------------- /doc/adr/2018-06-13-storage-always-retries.md: -------------------------------------------------------------------------------- 1 | ## The GCS Library retries all operations. 2 | 3 | **Status**: accepted 4 | 5 | **Context**: operations that change state in the server may complete with an 6 | indeterminate status code. For example: an error in the 500 range may be 7 | produced by a middle-tier server after the operation was started by the backend. 8 | Re-issuing the request may not work as expected for the application developer. 9 | 10 | **Decision**: by default the library will retry all requests, including 11 | non-idempotent ones. The library will allow application developers to override 12 | the definition of what operations are automatically retried. 13 | 14 | **Consequences**: most operations become easier to use for application 15 | developers. In very rare cases the operation will result in double uploads, or 16 | in a new generation of the object or metadata being created. In even more 17 | rare cases the operation may fail, for example, an operation to create an object 18 | with `IfGenerationMatch(0)` would fail on the second attempt. 19 | 20 | -------------------------------------------------------------------------------- /doc/adr/2018-06-19-do-not-duplicate-server-side-validation.md: -------------------------------------------------------------------------------- 1 | **Title**: Do not duplicate validation performed by the server-side. 2 | 3 | **Status**: accepted. 4 | 5 | **Context**: many APIs impose restrictions on their parameters. Names may have 6 | length limits, or strings may need to conform to specific formats, or ranges 7 | must be non-empty. It is tempting to validate these arguments in the 8 | client-side, since we *know* the API will fail if it is allowed to continue 9 | with the invalid parameters. However, any such validation is redundant, since 10 | the server is going to validate its inputs as well. Furthermore, any such 11 | validation is wasteful: most of the time the application will pass on valid 12 | arguments, checking them twice is just wasting client-side CPU cycles. Moreover, 13 | the server-side is the source of truth, so having the validations performed on 14 | the client side wil require extra work if the server restrictions are ever 15 | modified. 16 | 17 | **Decision**: the client libraries do not validate any of the request 18 | parameters beyond what is required to avoid local crashes. 19 | 20 | **Consequences**: the main downsides are: 21 | 22 | - The error messages could be better if generated locally. 23 | - The server must validate all inputs correctly. 24 | - Sometimes, we will need to validate inputs to avoid library crashes, and 25 | that will be confusing because it will seem like a violation of this ADR. 26 | -------------------------------------------------------------------------------- /doc/adr/2019-03-26-binary-distributions.md: -------------------------------------------------------------------------------- 1 | **Title**: We will not distribute/own/maintain binary packages, but we will 2 | support others doing so within reason. 3 | 4 | **Status**: accepted 5 | 6 | **Context**: Compiling google-cloud-cpp from source is not always possible nor 7 | desired by all users. Some users may want to install a binary package that 8 | contains our public headers and pre-compiled libraries so that they can link 9 | against our library. There is no single standard binary package manager in C++, 10 | instead there are a variety of others that users might want to use (e.g., dpkg, 11 | rpm, vcpkg). 12 | 13 | **Decision**: We will not directly support nor provide any binary packages. We 14 | will not test binary distributions of our code. And we will not host configs 15 | for binary distributions, since that would involve hosting files which we do 16 | not test. However, we will do our best to make our code easily packageable by 17 | others in a wide variety of formats. For more context, see 18 | [#333](https://github.com/googleapis/google-cloud-cpp/issues/333). 19 | 20 | **Consequences**: This decision will shield from endorsing any particular 21 | binary package management system. Other individuals who want to build and 22 | maintain a binary distribution of our code may do so without our permission or 23 | knowledge. If they need small and reasonable tweaks from us to support their 24 | binary distributions, they may file an issue and we'll do our best to 25 | accommodate them within reason. 26 | -------------------------------------------------------------------------------- /doc/adr/adr-template.md: -------------------------------------------------------------------------------- 1 | Use this template to create an Architecture Decision Record, look at existing 2 | ones for more detailed information. 3 | 4 | The filename should be the date (in YYYY-MM-DD format), followed by a dash 5 | followed by a mnemonic for the ADR, with the words separated by dashes. 6 | If we make two decisions in one day then just move one of the decisions to the 7 | next day during the PR review. 8 | 9 | **Title**: short present tense imperative phrase, less than 50 characters, like a git commit message. 10 | 11 | **Status**: proposed, accepted, rejected, deprecated, superseded, etc. 12 | 13 | **Context**: what is the issue that we're seeing that is motivating this decision or change. 14 | 15 | **Decision**: what is the change that we're actually proposing or doing. 16 | 17 | **Consequences**: what becomes easier or more difficult to do because of this change. 18 | 19 | -------------------------------------------------------------------------------- /doc/cutting-a-patch.md: -------------------------------------------------------------------------------- 1 | # Creating a new patch release of google-cloud-cpp-common 2 | 3 | The intended audience of this document are developers in the 4 | `google-cloud-cpp-common` project that need to create a new patch release. The 5 | audience is expected to be familiar with the project itself, [git][git-docs], 6 | [GitHub][github-guides], [semantic versioning](https://semver.org), and 7 | with how to [cut a release](cutting-a-release.md). 8 | 9 | ## Prepare a PR for the Release Branch 10 | 11 | We will assume that you have created a clone of your fork, as in: 12 | 13 | ```bash 14 | git clone git@github.com:${GITHUB_USERNAME}/google-cloud-cpp-common.git 15 | cd google-cloud-cpp-common 16 | git remote add upstream https://github.com/googleapis/google-cloud-cpp-common.git 17 | git fetch upstream 18 | ``` 19 | 20 | We will use some variables to represent the release branch and the patch 21 | version: 22 | 23 | ```bash 24 | RELEASE_BRANCH="v0.22.x" 25 | PATCH_VERSION="v0.22.1" 26 | ``` 27 | 28 | With these variables we create a branch out of the existing release branch: 29 | 30 | ```bash 31 | git checkout "${RELEASE_BRANCH}" 32 | git checkout -b "prepare-${PATCH_VERSION}-patch" 33 | ``` 34 | 35 | Then cherry-pick the changes you want, without committing them, for example: 36 | 37 | ```bash 38 | git cherry-pick -n 140c7e3d0ad06accd639e95164f5de2c4c82642e 39 | ``` 40 | 41 | Update the release notes to include these changes, and commit them, including 42 | your updates to the `CHANGELOG.md` file: 43 | 44 | ```bash 45 | git add CHANGELOG.md 46 | git commit 47 | ``` 48 | 49 | You may want to use the same description as in the change to `master`. 50 | 51 | Run the usual tests, push the changes and create a PR. You must use 52 | "${RELEASE_BRANCH}" as the target branch of your PR. 53 | 54 | ## Creating the release 55 | 56 | As of this writing the release script always cuts releases from `master`, 57 | so creating the release manually using the GitHub website is probably best. 58 | -------------------------------------------------------------------------------- /doc/landing/README.md: -------------------------------------------------------------------------------- 1 | # Support Files for googleapis.github.io Landing Page 2 | 3 | This directory contains hand-crafted HTML and resource files deployed to 4 | the [google-cloud-cpp landing page][docs link] 5 | 6 | [docs link]: https://googleapis.github.io/google-cloud-cpp 7 | -------------------------------------------------------------------------------- /doc/landing/version-redirect.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /doc/working-with-bazel-and-cmake.md: -------------------------------------------------------------------------------- 1 | # Working with Bazel and CMake 2 | 3 | The Google Cloud C++ Client Libraries support application developers that use 4 | either Bazel or CMake as their build system. This document describes how to 5 | keep the two build systems in sync, and how that works behind the scenes. 6 | 7 | The design is very simple, but requires a minimal of discipline to work. 8 | 9 | ## Keeping Bazel BUILD files and CMake in Sync 10 | 11 | Google Cloud C++ Client Library developers should add new files, tests and 12 | examples to the CMake files. The CMake configuration process automatically 13 | updates the corresponding `.bzl` files. 14 | 15 | The Cloud C++ Client Library developer **must** commit both their manual changes 16 | to the CMake files as well as the automatic changes to the `.bzl` files. If they 17 | forget one of the CI builds will break. 18 | 19 | ## How this works 20 | 21 | The Bazel BUILD files load the generated `.bzl` files to obtain the sources and 22 | headers for each library target, as well as the list of unit tests, examples, 23 | and integration tests for each library. The `.bzl` files are simply Python 24 | lists that the BUILD files inject in the correct places. 25 | 26 | ## Alternatives Considered 27 | 28 | We could manually kept the BUILD files and CMake files in sync. That increases 29 | the maintenance burden for the libraries, so we decided against it. 30 | 31 | We could change CMake to generate BUILD files, after all CMake is a build-file 32 | generator. That seemed like a much larger endeavor than we wanted to tackle. 33 | 34 | We could have used a common source for both the Bazel and CMake files, like gRPC 35 | does. That seemed more complicated than what we need at this time. 36 | -------------------------------------------------------------------------------- /google/cloud/README.md: -------------------------------------------------------------------------------- 1 | # Common Types and Functions for the Google Cloud C++ Libraries 2 | 3 | The source files in `google/cloud/` define types and functions shared by the 4 | several Google Cloud C++ libraries. Here is where you will find the 5 | implementation of types used throughout the libraries, such as 6 | `StatusOr`, `Status`, `future`, or `CompletionQueue`. 7 | 8 | We consider this code stable and generally available. Please note that the 9 | Google Cloud C++ client libraries do **not** follow 10 | [Semantic Versioning](http://semver.org/). 11 | 12 | Some sub-directories include **internal-only** types and functions. These are 13 | used in the implementation of the Google Cloud C++ libraries, but are **not** 14 | intended for general use. They are subject to change and/or removal without 15 | notice. These include `google/cloud/internal/`, and 16 | `google-cloud/testing_utils/`. 17 | 18 | ## Supported Platforms 19 | 20 | * Windows, macOS, Linux 21 | * C++11 (and higher) compilers (we test with GCC >= 4.9, Clang >= 3.8, 22 | and MSVC >= 2019) 23 | * Environments with or without exceptions 24 | * Bazel and CMake builds 25 | 26 | ## Documentation 27 | 28 | * [Reference doxygen documentation][doxygen-link] for each release of this 29 | library 30 | * Detailed header comments in our [public `.h`][source-link] files 31 | 32 | [doxygen-link]: https://googleapis.dev/cpp/google-cloud-common/latest/ 33 | [source-link]: https://github.com/googleapis/google-cloud-cpp-common/tree/master/google/cloud 34 | 35 | ## Contributing changes 36 | 37 | See [`CONTRIBUTING.md`](../../CONTRIBUTING.md) for details on how to 38 | contribute to this project, including how to build and test your changes 39 | as well as how to properly format your code. 40 | 41 | ## Licensing 42 | 43 | Apache 2.0; see [`LICENSE`](../../LICENSE) for details. 44 | -------------------------------------------------------------------------------- /google/cloud/async_operation.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_ASYNC_OPERATION_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_ASYNC_OPERATION_H 17 | 18 | #include "google/cloud/version.h" 19 | #include 20 | #include 21 | 22 | namespace google { 23 | namespace cloud { 24 | inline namespace GOOGLE_CLOUD_CPP_NS { 25 | /** 26 | * The result of an async timer operation. 27 | * 28 | * Callbacks for async timers will receive an object of this class. 29 | */ 30 | struct AsyncTimerResult { 31 | std::chrono::system_clock::time_point deadline; 32 | bool cancelled; 33 | }; 34 | 35 | /** 36 | * Represents a pending asynchronous operation. 37 | * 38 | * It can either be a simple RPC, or a more complex operation involving 39 | * potentially many RPCs, sleeping and processing. 40 | */ 41 | class AsyncOperation { 42 | public: 43 | virtual ~AsyncOperation() = default; 44 | 45 | /** 46 | * Requests that the operation be canceled. 47 | */ 48 | virtual void Cancel() = 0; 49 | }; 50 | 51 | } // namespace GOOGLE_CLOUD_CPP_NS 52 | } // namespace cloud 53 | } // namespace google 54 | 55 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_ASYNC_OPERATION_H 56 | -------------------------------------------------------------------------------- /google/cloud/background_threads.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BACKGROUND_THREADS_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BACKGROUND_THREADS_H 17 | 18 | #include "google/cloud/completion_queue.h" 19 | #include "google/cloud/version.h" 20 | 21 | namespace google { 22 | namespace cloud { 23 | inline namespace GOOGLE_CLOUD_CPP_NS { 24 | /** 25 | * A object representing the background threads available to a Client. 26 | */ 27 | class BackgroundThreads { 28 | public: 29 | virtual ~BackgroundThreads() = default; 30 | 31 | /// The completion queue used for the background operations. 32 | virtual CompletionQueue cq() const = 0; 33 | }; 34 | 35 | } // namespace GOOGLE_CLOUD_CPP_NS 36 | } // namespace cloud 37 | } // namespace google 38 | 39 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BACKGROUND_THREADS_H 40 | -------------------------------------------------------------------------------- /google/cloud/config-version.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright 2018 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 | # http://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 | set(PACKAGE_VERSION @DOXYGEN_PROJECT_NUMBER@) 16 | 17 | # This package has not reached 1.0, there are no compatibility guarantees 18 | # before then. 19 | if (@GOOGLE_CLOUD_CPP_CONFIG_VERSION_MAJOR@ EQUAL 0) 20 | if ("${PACKAGE_FIND_VERSION}" STREQUAL "") 21 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 22 | elseif ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") 23 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 24 | set(PACKAGE_VERSION_EXACT TRUE) 25 | else () 26 | set(PACKAGE_VERSION_UNSUITABLE TRUE) 27 | endif () 28 | elseif("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") 29 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 30 | else() 31 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 32 | if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") 33 | set(PACKAGE_VERSION_EXACT TRUE) 34 | endif() 35 | endif() 36 | -------------------------------------------------------------------------------- /google/cloud/config.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright 2018 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 | # http://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 | include(CMakeFindDependencyMacro) 16 | find_dependency(Threads) 17 | 18 | include("${CMAKE_CURRENT_LIST_DIR}/google_cloud_cpp_common-targets.cmake") 19 | -------------------------------------------------------------------------------- /google/cloud/config.pc.in: -------------------------------------------------------------------------------- 1 | # Copyright 2018 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 | # http://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 | prefix=@CMAKE_INSTALL_PREFIX@ 16 | exec_prefix=${prefix}/@CMAKE_INSTALL_BINDIR@ 17 | libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ 18 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 19 | 20 | Name: @GOOGLE_CLOUD_CPP_PC_NAME@ 21 | Description: @GOOGLE_CLOUD_CPP_PC_DESCRIPTION@ 22 | Requires: @GOOGLE_CLOUD_CPP_PC_REQUIRES@ 23 | Version: @DOXYGEN_PROJECT_NUMBER@ 24 | 25 | Libs: -L${libdir} @GOOGLE_CLOUD_CPP_PC_LIBS@ 26 | Cflags: -I${includedir} 27 | -------------------------------------------------------------------------------- /google/cloud/connection_options.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2020 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 | // http://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 | #include "google/cloud/connection_options.h" 16 | #include "google/cloud/internal/getenv.h" 17 | #include "google/cloud/internal/make_unique.h" 18 | #include "google/cloud/log.h" 19 | #include 20 | 21 | namespace google { 22 | namespace cloud { 23 | inline namespace GOOGLE_CLOUD_CPP_NS { 24 | namespace internal { 25 | std::set DefaultTracingComponents() { 26 | auto tracing = 27 | google::cloud::internal::GetEnv("GOOGLE_CLOUD_CPP_ENABLE_TRACING"); 28 | if (!tracing.has_value()) return {}; 29 | std::set result; 30 | std::istringstream is{*tracing}; 31 | std::string token; 32 | while (std::getline(is, token, ',')) { 33 | result.insert(token); 34 | } 35 | return result; 36 | } 37 | 38 | TracingOptions DefaultTracingOptions() { 39 | auto tracing_options = 40 | google::cloud::internal::GetEnv("GOOGLE_CLOUD_CPP_TRACING_OPTIONS"); 41 | if (!tracing_options) return {}; 42 | return TracingOptions{}.SetOptions(*tracing_options); 43 | } 44 | 45 | std::unique_ptr DefaultBackgroundThreads() { 46 | return google::cloud::internal::make_unique< 47 | AutomaticallyCreatedBackgroundThreads>(); 48 | } 49 | 50 | } // namespace internal 51 | } // namespace GOOGLE_CLOUD_CPP_NS 52 | } // namespace cloud 53 | } // namespace google 54 | -------------------------------------------------------------------------------- /google/cloud/future.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_FUTURE_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_FUTURE_H 17 | 18 | #include "google/cloud/internal/future_then_impl.h" 19 | 20 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_FUTURE_H 21 | -------------------------------------------------------------------------------- /google/cloud/google_cloud_cpp_common_unit_tests.bzl: -------------------------------------------------------------------------------- 1 | # Copyright 2018 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 | # http://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 | # DO NOT EDIT -- GENERATED BY CMake -- Change the CMakeLists.txt file if needed 16 | 17 | """Automatically generated unit tests list - DO NOT EDIT.""" 18 | 19 | google_cloud_cpp_common_unit_tests = [ 20 | "future_generic_test.cc", 21 | "future_generic_then_test.cc", 22 | "future_void_test.cc", 23 | "future_void_then_test.cc", 24 | "iam_bindings_test.cc", 25 | "internal/backoff_policy_test.cc", 26 | "internal/big_endian_test.cc", 27 | "internal/compiler_info_test.cc", 28 | "internal/env_test.cc", 29 | "internal/filesystem_test.cc", 30 | "internal/format_time_point_test.cc", 31 | "internal/future_impl_test.cc", 32 | "internal/invoke_result_test.cc", 33 | "internal/parse_rfc3339_test.cc", 34 | "internal/random_test.cc", 35 | "internal/retry_policy_test.cc", 36 | "internal/throw_delegate_test.cc", 37 | "internal/tuple_test.cc", 38 | "internal/utility_test.cc", 39 | "log_test.cc", 40 | "optional_test.cc", 41 | "status_or_test.cc", 42 | "status_test.cc", 43 | "terminate_handler_test.cc", 44 | "tracing_options_test.cc", 45 | ] 46 | -------------------------------------------------------------------------------- /google/cloud/google_cloud_cpp_grpc_utils.bzl: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | # DO NOT EDIT -- GENERATED BY CMake -- Change the CMakeLists.txt file if needed 16 | 17 | """Automatically generated source lists for google_cloud_cpp_grpc_utils - DO NOT EDIT.""" 18 | 19 | google_cloud_cpp_grpc_utils_hdrs = [ 20 | "async_operation.h", 21 | "background_threads.h", 22 | "completion_queue.h", 23 | "connection_options.h", 24 | "grpc_error_delegate.h", 25 | "grpc_utils/async_operation.h", 26 | "grpc_utils/completion_queue.h", 27 | "grpc_utils/grpc_error_delegate.h", 28 | "grpc_utils/version.h", 29 | "internal/async_read_stream_impl.h", 30 | "internal/async_retry_unary_rpc.h", 31 | "internal/background_threads_impl.h", 32 | "internal/completion_queue_impl.h", 33 | "internal/pagination_range.h", 34 | ] 35 | 36 | google_cloud_cpp_grpc_utils_srcs = [ 37 | "completion_queue.cc", 38 | "connection_options.cc", 39 | "grpc_error_delegate.cc", 40 | "internal/background_threads_impl.cc", 41 | "internal/completion_queue_impl.cc", 42 | ] 43 | -------------------------------------------------------------------------------- /google/cloud/google_cloud_cpp_grpc_utils_unit_tests.bzl: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | # DO NOT EDIT -- GENERATED BY CMake -- Change the CMakeLists.txt file if needed 16 | 17 | """Automatically generated unit tests list - DO NOT EDIT.""" 18 | 19 | google_cloud_cpp_grpc_utils_unit_tests = [ 20 | "completion_queue_test.cc", 21 | "connection_options_test.cc", 22 | "grpc_error_delegate_test.cc", 23 | "internal/async_retry_unary_rpc_test.cc", 24 | "internal/background_threads_impl_test.cc", 25 | "internal/pagination_range_test.cc", 26 | ] 27 | -------------------------------------------------------------------------------- /google/cloud/grpc_error_delegate.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_ERROR_DELEGATE_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_ERROR_DELEGATE_H 17 | 18 | #include "google/cloud/status.h" 19 | #include "google/cloud/version.h" 20 | #include 21 | #include 22 | 23 | namespace google { 24 | namespace cloud { 25 | inline namespace GOOGLE_CLOUD_CPP_NS { 26 | /** 27 | * Creates a google::cloud::Status from a grpc::Status. 28 | */ 29 | google::cloud::Status MakeStatusFromRpcError(grpc::Status const& status); 30 | 31 | /** 32 | * Creates a google::cloud::Status from a grpc::StatusCode and description. 33 | */ 34 | google::cloud::Status MakeStatusFromRpcError(grpc::StatusCode code, 35 | std::string what); 36 | 37 | /** 38 | * Creates a `google::cloud::Status` from a `google:rpc::Status` proto. 39 | * 40 | * Some gRPC services return the `google::rpc::Status` proto for errors. The 41 | * libraries in `google-cloud-cpp` represent these errors using a 42 | * `google::cloud::Status`. 43 | */ 44 | google::cloud::Status MakeStatusFromRpcError(google::rpc::Status const& status); 45 | 46 | } // namespace GOOGLE_CLOUD_CPP_NS 47 | } // namespace cloud 48 | } // namespace google 49 | 50 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_ERROR_DELEGATE_H 51 | -------------------------------------------------------------------------------- /google/cloud/grpc_utils/BUILD: -------------------------------------------------------------------------------- 1 | # Copyright 2020 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 | # http://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:public"]) 16 | 17 | licenses(["notice"]) # Apache 2.0 18 | 19 | # TODO(#171) - remove the backwards compatibility target. 20 | cc_library( 21 | name = "google_cloud_cpp_grpc_utils", 22 | srcs = [], 23 | hdrs = [ 24 | "async_operation.h", 25 | "completion_queue.h", 26 | "grpc_error_delegate.h", 27 | "version.h", 28 | ], 29 | deps = [ 30 | "//google/cloud:google_cloud_cpp_common", 31 | "//google/cloud:google_cloud_cpp_grpc_utils", 32 | ], 33 | ) 34 | -------------------------------------------------------------------------------- /google/cloud/grpc_utils/async_operation.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_UTILS_ASYNC_OPERATION_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_UTILS_ASYNC_OPERATION_H 17 | 18 | #include "google/cloud/async_operation.h" 19 | #include "google/cloud/version.h" 20 | 21 | namespace google { 22 | namespace cloud { 23 | namespace grpc_utils { 24 | inline namespace GOOGLE_CLOUD_CPP_NS { 25 | /// Use a type alias to maintain API backwards compatibility. 26 | using AsyncOperation = ::google::cloud::AsyncOperation; 27 | 28 | } // namespace GOOGLE_CLOUD_CPP_NS 29 | } // namespace grpc_utils 30 | } // namespace cloud 31 | } // namespace google 32 | 33 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_UTILS_ASYNC_OPERATION_H 34 | -------------------------------------------------------------------------------- /google/cloud/grpc_utils/completion_queue.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_UTILS_COMPLETION_QUEUE_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_UTILS_COMPLETION_QUEUE_H 17 | 18 | #include "google/cloud/completion_queue.h" 19 | #include "google/cloud/version.h" 20 | 21 | namespace google { 22 | namespace cloud { 23 | namespace grpc_utils { 24 | inline namespace GOOGLE_CLOUD_CPP_GRPC_UTILS_NS { 25 | /// Use a type alias to maintain API backwards compatibility. 26 | using CompletionQueue = ::google::cloud::CompletionQueue; 27 | 28 | } // namespace GOOGLE_CLOUD_CPP_GRPC_UTILS_NS 29 | } // namespace grpc_utils 30 | } // namespace cloud 31 | } // namespace google 32 | 33 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_UTILS_COMPLETION_QUEUE_H 34 | -------------------------------------------------------------------------------- /google/cloud/grpc_utils/config.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | include(CMakeFindDependencyMacro) 16 | # googleapis finds both gRPC and Protobuf, no need to load them here. 17 | find_dependency(googleapis) 18 | find_dependency(google_cloud_cpp_common) 19 | 20 | include("${CMAKE_CURRENT_LIST_DIR}/grpc_utils-targets.cmake") 21 | -------------------------------------------------------------------------------- /google/cloud/grpc_utils/grpc_error_delegate.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_UTILS_GRPC_ERROR_DELEGATE_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_UTILS_GRPC_ERROR_DELEGATE_H 17 | 18 | #include "google/cloud/grpc_error_delegate.h" 19 | #include "google/cloud/version.h" 20 | 21 | namespace google { 22 | namespace cloud { 23 | namespace grpc_utils { 24 | inline namespace GOOGLE_CLOUD_CPP_NS { 25 | using ::google::cloud::MakeStatusFromRpcError; 26 | } // namespace GOOGLE_CLOUD_CPP_NS 27 | } // namespace grpc_utils 28 | } // namespace cloud 29 | } // namespace google 30 | 31 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_UTILS_GRPC_ERROR_DELEGATE_H 32 | -------------------------------------------------------------------------------- /google/cloud/grpc_utils/version.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_UTILS_VERSION_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_UTILS_VERSION_H 17 | 18 | #include "google/cloud/version.h" 19 | #include 20 | 21 | namespace google { 22 | namespace cloud { 23 | /** 24 | * Contains all the Cloud C++ gRPC Utilities APIs. 25 | */ 26 | namespace grpc_utils { 27 | inline namespace GOOGLE_CLOUD_CPP_NS { 28 | using ::google::cloud::version; 29 | using ::google::cloud::version_major; 30 | using ::google::cloud::version_minor; 31 | using ::google::cloud::version_patch; 32 | using ::google::cloud::version_string; 33 | } // namespace GOOGLE_CLOUD_CPP_NS 34 | } // namespace grpc_utils 35 | } // namespace cloud 36 | } // namespace google 37 | 38 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_UTILS_VERSION_H 39 | -------------------------------------------------------------------------------- /google/cloud/iam_binding.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_IAM_BINDING_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_IAM_BINDING_H 17 | 18 | #include "google/cloud/version.h" 19 | #include 20 | 21 | namespace google { 22 | namespace cloud { 23 | inline namespace GOOGLE_CLOUD_CPP_NS { 24 | /** 25 | * Represents a Binding which associates a `member` with a particular `role` 26 | * which can be used for Identity and Access management for Cloud Platform 27 | * Resources. 28 | * 29 | * For more information about a Binding please refer to: 30 | * https://cloud.google.com/resource-manager/reference/rest/Shared.Types/Binding 31 | */ 32 | class IamBinding { 33 | public: 34 | IamBinding(std::string role, std::set members) 35 | : role_(std::move(role)), members_(std::move(members)) {} 36 | 37 | std::string const& role() const { return role_; }; 38 | std::set const& members() const { return members_; }; 39 | 40 | private: 41 | std::string role_; 42 | std::set members_; 43 | }; 44 | 45 | } // namespace GOOGLE_CLOUD_CPP_NS 46 | } // namespace cloud 47 | } // namespace google 48 | 49 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_IAM_BINDING_H 50 | -------------------------------------------------------------------------------- /google/cloud/iam_policy.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #include "google/cloud/iam_policy.h" 16 | #include 17 | 18 | namespace google { 19 | namespace cloud { 20 | inline namespace GOOGLE_CLOUD_CPP_NS { 21 | std::ostream& operator<<(std::ostream& os, IamPolicy const& rhs) { 22 | return os << "IamPolicy={version=" << rhs.version 23 | << ", bindings=" << rhs.bindings << ", etag=" << rhs.etag << "}"; 24 | } 25 | 26 | } // namespace GOOGLE_CLOUD_CPP_NS 27 | } // namespace cloud 28 | } // namespace google 29 | -------------------------------------------------------------------------------- /google/cloud/internal/README.md: -------------------------------------------------------------------------------- 1 | # Implementation Details for gogle/cloud/*.{h,cc} 2 | 3 | This directory contains implementation details for the files in `google/cloud/`. 4 | All the code in this directory, is subject to change without notice. 5 | -------------------------------------------------------------------------------- /google/cloud/internal/background_threads_impl.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2020 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 | // http://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 | #include "google/cloud/internal/background_threads_impl.h" 16 | 17 | namespace google { 18 | namespace cloud { 19 | inline namespace GOOGLE_CLOUD_CPP_NS { 20 | namespace internal { 21 | 22 | AutomaticallyCreatedBackgroundThreads::AutomaticallyCreatedBackgroundThreads() 23 | : runner_([](CompletionQueue cq) { cq.Run(); }, cq_) {} 24 | 25 | AutomaticallyCreatedBackgroundThreads:: 26 | ~AutomaticallyCreatedBackgroundThreads() { 27 | Shutdown(); 28 | } 29 | 30 | void AutomaticallyCreatedBackgroundThreads::Shutdown() { 31 | cq_.Shutdown(); 32 | if (runner_.joinable()) runner_.join(); 33 | } 34 | 35 | } // namespace internal 36 | } // namespace GOOGLE_CLOUD_CPP_NS 37 | } // namespace cloud 38 | } // namespace google 39 | -------------------------------------------------------------------------------- /google/cloud/internal/build_info.cc.in: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Google Inc. 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 | // http://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 | #include "google/cloud/internal/build_info.h" 16 | #include "google/cloud/internal/compiler_info.h" 17 | #include 18 | #include 19 | 20 | namespace google { 21 | namespace cloud { 22 | inline namespace GOOGLE_CLOUD_CPP_NS { 23 | namespace internal { 24 | 25 | // NOLINTNEXTLINE(readability-identifier-naming) 26 | std::string compiler() { 27 | return CompilerId() + " " + CompilerVersion(); 28 | } 29 | 30 | // NOLINTNEXTLINE(readability-identifier-naming) 31 | std::string compiler_flags() { 32 | // NOLINTNEXTLINE(modernize-avoid-c-arrays) 33 | static char const kCompilerFlags[] = 34 | R"""(@CMAKE_CXX_FLAGS@ ${CMAKE_CXX_FLAGS_${GOOGLE_CLOUD_CPP_BUILD_TYPE_UPPER}})"""; 35 | return kCompilerFlags; 36 | } 37 | 38 | // NOLINTNEXTLINE(readability-identifier-naming) 39 | std::string build_metadata() { 40 | // Sometimes GOOGLE_CLOUD_CPP_BUILD_METADATA string expands to nothing, and 41 | // then clang-tidy complains. 42 | // NOLINTNEXTLINE(readability-redundant-string-init,modernize-avoid-c-arrays) 43 | static char const kBuildMetadata[] = R"""(@GOOGLE_CLOUD_CPP_BUILD_METADATA@)"""; 44 | return kBuildMetadata; 45 | } 46 | 47 | } // namespace internal 48 | } // namespace GOOGLE_CLOUD_CPP_NS 49 | } // namespace cloud 50 | } // namespace google 51 | -------------------------------------------------------------------------------- /google/cloud/internal/build_info.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Google Inc. 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_BUILD_INFO_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_BUILD_INFO_H 17 | 18 | #include "google/cloud/version.h" 19 | 20 | namespace google { 21 | namespace cloud { 22 | inline namespace GOOGLE_CLOUD_CPP_NS { 23 | namespace internal { 24 | /// The compiler version. 25 | std::string compiler(); 26 | 27 | /// The compiler flags. 28 | std::string compiler_flags(); 29 | 30 | /// Build metadata injected by the build system. 31 | std::string build_metadata(); 32 | 33 | } // namespace internal 34 | } // namespace GOOGLE_CLOUD_CPP_NS 35 | } // namespace cloud 36 | } // namespace google 37 | 38 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_BUILD_INFO_H 39 | -------------------------------------------------------------------------------- /google/cloud/internal/compiler_info.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_COMPILER_INFO_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_COMPILER_INFO_H 17 | 18 | #include "google/cloud/version.h" 19 | 20 | namespace google { 21 | namespace cloud { 22 | inline namespace GOOGLE_CLOUD_CPP_NS { 23 | namespace internal { 24 | /** 25 | * Returns the compiler ID. 26 | * 27 | * The Compiler ID is a string like "GNU" or "Clang", as described by 28 | * https://cmake.org/cmake/help/v3.5/variable/CMAKE_LANG_COMPILER_ID.html 29 | */ 30 | std::string CompilerId(); 31 | 32 | /** 33 | * Returns the compiler version. 34 | * 35 | * This string will be something like "9.1.1". 36 | */ 37 | std::string CompilerVersion(); 38 | 39 | /** 40 | * Returns certain interesting compiler features. 41 | * 42 | * Currently this returns one of "ex" or "noex" to indicate whether or not 43 | * C++ exceptions are enabled. 44 | */ 45 | std::string CompilerFeatures(); 46 | 47 | /** 48 | * Returns the 4-digit year of the C++ language standard. 49 | */ 50 | std::string LanguageVersion(); 51 | 52 | } // namespace internal 53 | } // namespace GOOGLE_CLOUD_CPP_NS 54 | } // namespace cloud 55 | } // namespace google 56 | 57 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_COMPILER_INFO_H 58 | -------------------------------------------------------------------------------- /google/cloud/internal/conjunction.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_CONJUNCTION_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_CONJUNCTION_H 17 | 18 | #include "google/cloud/version.h" 19 | #include 20 | 21 | namespace google { 22 | namespace cloud { 23 | inline namespace GOOGLE_CLOUD_CPP_NS { 24 | namespace internal { 25 | 26 | /// A metafunction that folds && across a list of types, the specialization for 27 | /// an empty list. 28 | template 29 | struct conjunction : std::true_type {}; 30 | 31 | /// A metafunction that folds && across a list of types, the specialization for 32 | /// a single element. 33 | template 34 | struct conjunction : B1 {}; 35 | 36 | /// A metafunction that folds && across a list of types. 37 | template 38 | struct conjunction 39 | : std::conditional, B1>::type {}; 40 | 41 | } // namespace internal 42 | } // namespace GOOGLE_CLOUD_CPP_NS 43 | } // namespace cloud 44 | } // namespace google 45 | 46 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_CONJUNCTION_H 47 | -------------------------------------------------------------------------------- /google/cloud/internal/disjunction.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_DISJUNCTION_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_DISJUNCTION_H 17 | 18 | #include "google/cloud/version.h" 19 | #include 20 | 21 | namespace google { 22 | namespace cloud { 23 | inline namespace GOOGLE_CLOUD_CPP_NS { 24 | namespace internal { 25 | 26 | /// A metafunction that folds || across a list of types, the specialization for 27 | /// an empty list. 28 | template 29 | struct disjunction : std::false_type {}; 30 | 31 | /// A metafunction that folds || across a list of types, the specialization for 32 | /// a single element. 33 | template 34 | struct disjunction : B1 {}; 35 | 36 | /// A metafunction that folds || across a list of types. 37 | template 38 | struct disjunction 39 | : std::conditional>::type {}; 40 | 41 | } // namespace internal 42 | } // namespace GOOGLE_CLOUD_CPP_NS 43 | } // namespace cloud 44 | } // namespace google 45 | 46 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_DISJUNCTION_H 47 | -------------------------------------------------------------------------------- /google/cloud/internal/env_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2019 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 | // http://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 | #include "google/cloud/internal/getenv.h" 16 | #include "google/cloud/internal/setenv.h" 17 | #include 18 | 19 | using google::cloud::internal::GetEnv; 20 | using google::cloud::internal::SetEnv; 21 | using google::cloud::internal::UnsetEnv; 22 | 23 | /// @test Verify passing an empty string creates an environment variable. 24 | TEST(SetEnv, SetEmptyEnvVar) { 25 | SetEnv("foo", ""); 26 | #ifdef _WIN32 27 | EXPECT_FALSE(GetEnv("foo").has_value()); 28 | #else 29 | EXPECT_TRUE(GetEnv("foo").has_value()); 30 | #endif // _WIN32 31 | } 32 | 33 | /// @test Verify we can unset an environment variable with nullptr. 34 | TEST(SetEnv, UnsetEnvWithNullptr) { 35 | SetEnv("foo", "bar"); 36 | EXPECT_TRUE(GetEnv("foo").has_value()); 37 | SetEnv("foo", nullptr); 38 | EXPECT_FALSE(GetEnv("foo").has_value()); 39 | } 40 | 41 | /// @test Verify we can unset an environment variable. 42 | TEST(SetEnv, UnsetEnv) { 43 | SetEnv("foo", "bar"); 44 | EXPECT_TRUE(GetEnv("foo").has_value()); 45 | UnsetEnv("foo"); 46 | EXPECT_FALSE(GetEnv("foo").has_value()); 47 | } 48 | -------------------------------------------------------------------------------- /google/cloud/internal/future_fwd.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_FUTURE_FWD_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_FUTURE_FWD_H 17 | 18 | #include "google/cloud/version.h" 19 | 20 | namespace google { 21 | namespace cloud { 22 | inline namespace GOOGLE_CLOUD_CPP_NS { 23 | // Forward declare the promise type so we can write some helpers. 24 | template 25 | class promise; 26 | 27 | // Forward declare the future type so we can write some helpers. 28 | template 29 | class future; 30 | 31 | // Forward declare the specializations for references. 32 | template 33 | class promise; 34 | template 35 | class future; 36 | 37 | // Forward declare the specialization for `void`. 38 | template <> 39 | class promise; 40 | template <> 41 | class future; 42 | } // namespace GOOGLE_CLOUD_CPP_NS 43 | } // namespace cloud 44 | } // namespace google 45 | 46 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_FUTURE_FWD_H 47 | -------------------------------------------------------------------------------- /google/cloud/internal/future_impl.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #include "google/cloud/internal/future_impl.h" 16 | #include "google/cloud/terminate_handler.h" 17 | #include 18 | #include 19 | #include 20 | 21 | namespace google { 22 | namespace cloud { 23 | inline namespace GOOGLE_CLOUD_CPP_NS { 24 | namespace internal { 25 | [[noreturn]] void ThrowFutureError(std::future_errc ec, char const* msg) { 26 | #ifdef GOOGLE_CLOUD_CPP_HAVE_EXCEPTIONS 27 | (void)msg; // disable unused argument warning. 28 | throw std::future_error(ec); 29 | #else 30 | std::string full_msg = "future_error["; 31 | full_msg += std::make_error_code(ec).message(); 32 | full_msg += "]: "; 33 | full_msg += msg; 34 | google::cloud::Terminate(full_msg.c_str()); 35 | #endif // GOOGLE_CLOUD_CPP_HAVE_EXCEPTIONS 36 | } 37 | } // namespace internal 38 | } // namespace GOOGLE_CLOUD_CPP_NS 39 | } // namespace cloud 40 | } // namespace google 41 | -------------------------------------------------------------------------------- /google/cloud/internal/getenv.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #include "google/cloud/internal/getenv.h" 16 | #ifdef _WIN32 17 | // We need _dupenv_s() 18 | #include 19 | #else 20 | // On Unix-like systems we need setenv()/unsetenv(), which are defined here: 21 | #include 22 | #endif // _WIN32 23 | #include 24 | 25 | namespace google { 26 | namespace cloud { 27 | inline namespace GOOGLE_CLOUD_CPP_NS { 28 | namespace internal { 29 | 30 | optional GetEnv(char const* variable) { 31 | #if _WIN32 32 | // On Windows, std::getenv() is not thread-safe. It returns a pointer that 33 | // can be invalidated by _putenv_s(). We must use the thread-safe alternative, 34 | // which unfortunately allocates the buffer using malloc(): 35 | char* buffer; 36 | std::size_t size; 37 | _dupenv_s(&buffer, &size, variable); 38 | std::unique_ptr release(buffer, &free); 39 | #else 40 | char* buffer = std::getenv(variable); 41 | #endif // _WIN32 42 | if (buffer == nullptr) { 43 | return optional(); 44 | } 45 | return optional(std::string{buffer}); 46 | } 47 | 48 | } // namespace internal 49 | } // namespace GOOGLE_CLOUD_CPP_NS 50 | } // namespace cloud 51 | } // namespace google 52 | -------------------------------------------------------------------------------- /google/cloud/internal/getenv.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_GETENV_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_GETENV_H 17 | 18 | #include "google/cloud/optional.h" 19 | #include 20 | 21 | namespace google { 22 | namespace cloud { 23 | inline namespace GOOGLE_CLOUD_CPP_NS { 24 | namespace internal { 25 | 26 | /** 27 | * Return the value of an environment variable, or an unset optional. 28 | * 29 | * On Windows `std::getenv()` is not thread safe. We must write a wrapper to 30 | * portably get the value of the environment variables. 31 | */ 32 | optional GetEnv(char const* variable); 33 | 34 | } // namespace internal 35 | } // namespace GOOGLE_CLOUD_CPP_NS 36 | } // namespace cloud 37 | } // namespace google 38 | 39 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_GETENV_H 40 | -------------------------------------------------------------------------------- /google/cloud/internal/make_unique.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Google Inc. 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_MAKE_UNIQUE_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_MAKE_UNIQUE_H 17 | 18 | #include "google/cloud/version.h" 19 | #include 20 | 21 | namespace google { 22 | namespace cloud { 23 | inline namespace GOOGLE_CLOUD_CPP_NS { 24 | namespace internal { 25 | /** 26 | * A naive implementation of std::make_unique for C++11. 27 | * 28 | * We missed std::make_unique, but have to limit ourselves to C++11 and this 29 | * is a C++14 feature. This implementation is super naive and does not work for 30 | * array types. 31 | * 32 | * @tparam T The type of the object to wrap in a std::unique_ptr<> 33 | * @tparam Args the type of the constructor arguments. 34 | * @param a the constructor arguments. 35 | * @return a std::unique_ptr initialized with a new T object constructed with 36 | * the given parameters. 37 | */ 38 | template 39 | std::unique_ptr make_unique(Args&&... a) { 40 | static_assert( 41 | !std::is_array::value, 42 | "Sorry, array types not supported in bigtable::internal::make_unique"); 43 | return std::unique_ptr(new T(std::forward(a)...)); 44 | } 45 | 46 | } // namespace internal 47 | } // namespace GOOGLE_CLOUD_CPP_NS 48 | } // namespace cloud 49 | } // namespace google 50 | 51 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_MAKE_UNIQUE_H 52 | -------------------------------------------------------------------------------- /google/cloud/internal/parse_rfc3339.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_PARSE_RFC3339_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_PARSE_RFC3339_H 17 | 18 | #include "google/cloud/version.h" 19 | #include 20 | #include 21 | 22 | namespace google { 23 | namespace cloud { 24 | inline namespace GOOGLE_CLOUD_CPP_NS { 25 | namespace internal { 26 | /** 27 | * Parses @p timestamp assuming it is in RFC-3339 format. 28 | * 29 | * Google Cloud Storage uses RFC-3339 for timestamps, this function is used to 30 | * parse them and convert to `std::chrono::system_clock::time_point`, the C++ 31 | * class used to represent timestamps. Depending on the underlying C++ 32 | * implementation the timestamp may lose precision. C++ does not specify the 33 | * precision of the system clock, though most implementations have sub-second 34 | * precision, and nanoseconds is common. The RFC-3339 spec allows for arbitrary 35 | * precision in fractional seconds, though it would be surprising to see 36 | * femtosecond timestamp for Internet events. 37 | * 38 | * @see https://tools.ietf.org/html/rfc3339 39 | */ 40 | std::chrono::system_clock::time_point ParseRfc3339( 41 | std::string const& timestamp); 42 | 43 | } // namespace internal 44 | } // namespace GOOGLE_CLOUD_CPP_NS 45 | } // namespace cloud 46 | } // namespace google 47 | 48 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_PARSE_RFC3339_H 49 | -------------------------------------------------------------------------------- /google/cloud/internal/setenv.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #include "google/cloud/internal/setenv.h" 16 | #ifdef _WIN32 17 | // We need _putenv_s() 18 | #include 19 | #else 20 | // On Unix-like systems we need setenv()/unsetenv(), which are defined here: 21 | #include 22 | #endif // _WIN32 23 | 24 | namespace google { 25 | namespace cloud { 26 | inline namespace GOOGLE_CLOUD_CPP_NS { 27 | namespace internal { 28 | 29 | void UnsetEnv(char const* variable) { 30 | #ifdef _WIN32 31 | (void)_putenv_s(variable, ""); 32 | #else 33 | unsetenv(variable); 34 | #endif // _WIN32 35 | } 36 | 37 | void SetEnv(char const* variable, char const* value) { 38 | if (value == nullptr) { 39 | UnsetEnv(variable); 40 | return; 41 | } 42 | #ifdef _WIN32 43 | (void)_putenv_s(variable, value); 44 | #else 45 | (void)setenv(variable, value, 1); 46 | #endif // _WIN32 47 | } 48 | 49 | void SetEnv(char const* variable, optional value) { 50 | if (!value.has_value()) { 51 | UnsetEnv(variable); 52 | return; 53 | } 54 | SetEnv(variable, value->data()); 55 | } 56 | 57 | } // namespace internal 58 | } // namespace GOOGLE_CLOUD_CPP_NS 59 | } // namespace cloud 60 | } // namespace google 61 | -------------------------------------------------------------------------------- /google/cloud/internal/setenv.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_SETENV_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_SETENV_H 17 | 18 | #include "google/cloud/optional.h" 19 | 20 | namespace google { 21 | namespace cloud { 22 | inline namespace GOOGLE_CLOUD_CPP_NS { 23 | namespace internal { 24 | 25 | /// Unset (remove) an environment variable. 26 | void UnsetEnv(char const* variable); 27 | 28 | /** 29 | * Set the @p variable environment variable to @p value. 30 | * 31 | * If @value is the null pointer then the variable is unset. 32 | * 33 | * @note On Windows, due to the underlying API function, an empty @value unsets 34 | * the variable, while on Linux an empty environment variable is created. 35 | * 36 | * @see 37 | * https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv-s-wputenv-s?view=vs-2019 38 | */ 39 | void SetEnv(char const* variable, char const* value); 40 | 41 | /** 42 | * Set the @p variable environment variable to @p value. 43 | * 44 | * If @value is an unset optional then the variable is unset. 45 | */ 46 | void SetEnv(char const* variable, optional value); 47 | 48 | } // namespace internal 49 | } // namespace GOOGLE_CLOUD_CPP_NS 50 | } // namespace cloud 51 | } // namespace google 52 | 53 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_SETENV_H 54 | -------------------------------------------------------------------------------- /google/cloud/internal/utility_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2019 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 | // http://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 | #include "google/cloud/internal/utility.h" 16 | #include 17 | 18 | namespace google { 19 | namespace cloud { 20 | inline namespace GOOGLE_CLOUD_CPP_NS { 21 | namespace internal { 22 | 23 | TEST(MakeIndexSequence, Simple) { 24 | static_assert(std::is_same, 25 | make_index_sequence<0>>::value, 26 | ""); 27 | static_assert(std::is_same, 28 | make_index_sequence<5>>::value, 29 | ""); 30 | static_assert( 31 | std::is_same, make_integer_sequence>::value, 32 | ""); 33 | static_assert(std::is_same, 34 | make_integer_sequence>::value, 35 | ""); 36 | } 37 | 38 | } // namespace internal 39 | } // namespace GOOGLE_CLOUD_CPP_NS 40 | } // namespace cloud 41 | } // namespace google 42 | -------------------------------------------------------------------------------- /google/cloud/internal/version_info.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_VERSION_INFO_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_VERSION_INFO_H 17 | 18 | #define GOOGLE_CLOUD_CPP_VERSION_MAJOR 0 19 | #define GOOGLE_CLOUD_CPP_VERSION_MINOR 26 20 | #define GOOGLE_CLOUD_CPP_VERSION_PATCH 0 21 | 22 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_VERSION_INFO_H 23 | -------------------------------------------------------------------------------- /google/cloud/internal/version_info.h.in: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_VERSION_INFO_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_VERSION_INFO_H 17 | 18 | #define GOOGLE_CLOUD_CPP_VERSION_MAJOR @GOOGLE_CLOUD_CPP_VERSION_MAJOR@ 19 | #define GOOGLE_CLOUD_CPP_VERSION_MINOR @GOOGLE_CLOUD_CPP_VERSION_MINOR@ 20 | #define GOOGLE_CLOUD_CPP_VERSION_PATCH @GOOGLE_CLOUD_CPP_VERSION_PATCH@ 21 | 22 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_VERSION_INFO_H 23 | -------------------------------------------------------------------------------- /google/cloud/samples/BUILD: -------------------------------------------------------------------------------- 1 | # Copyright 2020 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 | # http://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:public"]) 16 | 17 | licenses(["notice"]) # Apache 2.0 18 | 19 | cc_test( 20 | name = "common_install_test", 21 | srcs = ["common_install_test.cc"], 22 | deps = [ 23 | "//google/cloud:google_cloud_cpp_common", 24 | "//google/cloud:google_cloud_cpp_grpc_utils", 25 | "//google/cloud/grpc_utils:google_cloud_cpp_grpc_utils", 26 | "@com_google_googletest//:gtest", 27 | ], 28 | ) 29 | -------------------------------------------------------------------------------- /google/cloud/samples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ~~~ 2 | # Copyright 2019 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 | # http://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 | find_package(gRPC) 18 | 19 | add_executable(common_install_test common_install_test.cc) 20 | target_link_libraries( 21 | common_install_test PRIVATE google_cloud_cpp_grpc_utils 22 | google_cloud_cpp_common gRPC::grpc++ gRPC::grpc) 23 | add_test(NAME common_install_test COMMAND common_install_test) 24 | -------------------------------------------------------------------------------- /google/cloud/samples/common_install_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2019 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 | // http://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 | #include "google/cloud/grpc_utils/completion_queue.h" 16 | #include "google/cloud/grpc_utils/grpc_error_delegate.h" 17 | #include "google/cloud/grpc_utils/version.h" 18 | #include "google/cloud/version.h" 19 | #include 20 | 21 | int main() { 22 | std::cout 23 | << "Verify symbols from google_cloud_cpp_common are usable. version=" 24 | << google::cloud::version_string() << "\n"; 25 | std::cout 26 | << "Verify symbols from google_cloud_cpp_grpc_utils are usable. version=" 27 | << google::cloud::grpc_utils::version_string() << "\n"; 28 | 29 | google::cloud::grpc_utils::CompletionQueue cq; 30 | std::thread t{[&cq] { cq.Run(); }}; 31 | std::cout 32 | << "Verify symbols from google_cloud_cpp_grpc_utils are usable. version=" 33 | << google::cloud::grpc_utils::MakeStatusFromRpcError( 34 | grpc::Status(grpc::StatusCode::UNKNOWN, "Just for testing")) 35 | << "\n"; 36 | cq.Shutdown(); 37 | t.join(); 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /google/cloud/testing_util/README.md: -------------------------------------------------------------------------------- 1 | # Testing Helpers for Google Cloud C++ Libraries 2 | 3 | This directory contains helper functions to test the Google Cloud C++ libraries. 4 | The functions and types provided here are not intended for general use, and are 5 | subject to change without notice. 6 | -------------------------------------------------------------------------------- /google/cloud/testing_util/assert_ok.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2019 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 | // http://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 | #include "google/cloud/testing_util/assert_ok.h" 16 | 17 | namespace testing { 18 | namespace internal { 19 | 20 | // A unary predicate-formatter for google::cloud::Status. 21 | testing::AssertionResult IsOkPredFormat(char const* expr, 22 | ::google::cloud::Status const& status) { 23 | if (status.ok()) { 24 | return testing::AssertionSuccess(); 25 | } 26 | return testing::AssertionFailure() 27 | << "Value of: " << expr << "\nExpected: is OK\nActual: " << status; 28 | } 29 | 30 | } // namespace internal 31 | } // namespace testing 32 | -------------------------------------------------------------------------------- /google/cloud/testing_util/assert_ok.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TESTING_UTIL_ASSERT_OK_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TESTING_UTIL_ASSERT_OK_H 17 | 18 | #include "google/cloud/status.h" 19 | #include "google/cloud/status_or.h" 20 | #include 21 | 22 | namespace testing { 23 | namespace internal { 24 | 25 | // A unary predicate-formatter for google::cloud::Status. 26 | testing::AssertionResult IsOkPredFormat(char const* expr, 27 | ::google::cloud::Status const& status); 28 | 29 | // A unary predicate-formatter for google::cloud::StatusOr. 30 | template 31 | testing::AssertionResult IsOkPredFormat( 32 | char const* expr, ::google::cloud::StatusOr const& status_or) { 33 | if (status_or) { 34 | return testing::AssertionSuccess(); 35 | } 36 | return IsOkPredFormat(expr, status_or.status()); 37 | } 38 | 39 | } // namespace internal 40 | } // namespace testing 41 | 42 | #define ASSERT_STATUS_OK(val) \ 43 | ASSERT_PRED_FORMAT1(::testing::internal::IsOkPredFormat, val) 44 | 45 | #define EXPECT_STATUS_OK(val) \ 46 | EXPECT_PRED_FORMAT1(::testing::internal::IsOkPredFormat, val) 47 | 48 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TESTING_UTIL_ASSERT_OK_H 49 | -------------------------------------------------------------------------------- /google/cloud/testing_util/capture_log_lines_backend.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #include "google/cloud/testing_util/capture_log_lines_backend.h" 16 | 17 | namespace google { 18 | namespace cloud { 19 | inline namespace GOOGLE_CLOUD_CPP_NS { 20 | namespace testing_util { 21 | 22 | void CaptureLogLinesBackend::Process(LogRecord const& lr) { 23 | // Break the records in lines, it is easier to analyze them as such. 24 | std::istringstream is(lr.message); 25 | std::string line; 26 | while (std::getline(is, line)) { 27 | log_lines.emplace_back(line); 28 | } 29 | } 30 | 31 | void CaptureLogLinesBackend::ProcessWithOwnership(LogRecord lr) { Process(lr); } 32 | 33 | } // namespace testing_util 34 | } // namespace GOOGLE_CLOUD_CPP_NS 35 | } // namespace cloud 36 | } // namespace google 37 | -------------------------------------------------------------------------------- /google/cloud/testing_util/capture_log_lines_backend.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TESTING_UTIL_CAPTURE_LOG_LINES_BACKEND_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TESTING_UTIL_CAPTURE_LOG_LINES_BACKEND_H 17 | 18 | #include "google/cloud/log.h" 19 | #include 20 | 21 | namespace google { 22 | namespace cloud { 23 | inline namespace GOOGLE_CLOUD_CPP_NS { 24 | namespace testing_util { 25 | /** 26 | * A log backend that stores all the log lines. 27 | * 28 | * This is useful in tests that want to verify specific messages are logged. 29 | */ 30 | class CaptureLogLinesBackend : public LogBackend { 31 | public: 32 | std::vector log_lines; 33 | 34 | void Process(LogRecord const& lr) override; 35 | void ProcessWithOwnership(LogRecord lr) override; 36 | }; 37 | 38 | } // namespace testing_util 39 | } // namespace GOOGLE_CLOUD_CPP_NS 40 | } // namespace cloud 41 | } // namespace google 42 | 43 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TESTING_UTIL_CAPTURE_LOG_LINES_BACKEND_H 44 | -------------------------------------------------------------------------------- /google/cloud/testing_util/config.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | include(CMakeFindDependencyMacro) 16 | find_dependency(GTest) 17 | include("${CMAKE_CURRENT_LIST_DIR}/FindGMockWithTargets.cmake") 18 | find_dependency(google_cloud_cpp_common) 19 | 20 | include("${CMAKE_CURRENT_LIST_DIR}/google_cloud_cpp_testing-targets.cmake") 21 | -------------------------------------------------------------------------------- /google/cloud/testing_util/custom_google_mock_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #include 16 | 17 | /** 18 | * @deprecated 19 | * Callers should instead directly use `::testing::InitGoogleMock`, or link 20 | * with googlemock's `:gmock_main` build target. See also 21 | * https://github.com/googleapis/google-cloud-cpp/issues/3713. 22 | */ 23 | int main(int argc, char* argv[]) { 24 | ::testing::InitGoogleMock(&argc, argv); 25 | return RUN_ALL_TESTS(); 26 | } 27 | -------------------------------------------------------------------------------- /google/cloud/testing_util/google_cloud_cpp_testing.bzl: -------------------------------------------------------------------------------- 1 | # Copyright 2019 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 | # http://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 | # DO NOT EDIT -- GENERATED BY CMake -- Change the CMakeLists.txt file if needed 16 | 17 | """Automatically generated source lists for google_cloud_cpp_testing - DO NOT EDIT.""" 18 | 19 | google_cloud_cpp_testing_hdrs = [ 20 | "assert_ok.h", 21 | "capture_log_lines_backend.h", 22 | "check_predicate_becomes_false.h", 23 | "chrono_literals.h", 24 | "expect_exception.h", 25 | "expect_future_error.h", 26 | "init_google_mock.h", 27 | "scoped_environment.h", 28 | "testing_types.h", 29 | ] 30 | 31 | google_cloud_cpp_testing_srcs = [ 32 | "assert_ok.cc", 33 | "capture_log_lines_backend.cc", 34 | "custom_google_mock_main.cc", 35 | "scoped_environment.cc", 36 | "testing_types.cc", 37 | ] 38 | -------------------------------------------------------------------------------- /google/cloud/testing_util/google_cloud_cpp_testing_grpc.bzl: -------------------------------------------------------------------------------- 1 | # Copyright 2020 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 | # http://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 | # DO NOT EDIT -- GENERATED BY CMake -- Change the CMakeLists.txt file if needed 16 | 17 | """Automatically generated source lists for google_cloud_cpp_testing_grpc - DO NOT EDIT.""" 18 | 19 | google_cloud_cpp_testing_grpc_hdrs = [ 20 | "is_proto_equal.h", 21 | "mock_async_response_reader.h", 22 | "mock_completion_queue.h", 23 | ] 24 | 25 | google_cloud_cpp_testing_grpc_srcs = [ 26 | "is_proto_equal.cc", 27 | ] 28 | -------------------------------------------------------------------------------- /google/cloud/testing_util/google_cloud_cpp_testing_grpc_unit_tests.bzl: -------------------------------------------------------------------------------- 1 | # Copyright 2020 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 | # http://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 | # DO NOT EDIT -- GENERATED BY CMake -- Change the CMakeLists.txt file if needed 16 | 17 | """Automatically generated unit tests list - DO NOT EDIT.""" 18 | 19 | google_cloud_cpp_testing_grpc_unit_tests = [ 20 | "is_proto_equal_test.cc", 21 | ] 22 | -------------------------------------------------------------------------------- /google/cloud/testing_util/google_cloud_cpp_testing_unit_tests.bzl: -------------------------------------------------------------------------------- 1 | # Copyright 2018 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 | # http://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 | # DO NOT EDIT -- GENERATED BY CMake -- Change the CMakeLists.txt file if needed 16 | 17 | """Automatically generated unit tests list - DO NOT EDIT.""" 18 | 19 | google_cloud_cpp_testing_unit_tests = [ 20 | "assert_ok_test.cc", 21 | "scoped_environment_test.cc", 22 | ] 23 | -------------------------------------------------------------------------------- /google/cloud/testing_util/init_google_mock.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TESTING_UTIL_INIT_GOOGLE_MOCK_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TESTING_UTIL_INIT_GOOGLE_MOCK_H 17 | 18 | #include "google/cloud/version.h" 19 | #include 20 | 21 | namespace google { 22 | namespace cloud { 23 | inline namespace GOOGLE_CLOUD_CPP_NS { 24 | namespace testing_util { 25 | /** 26 | * @deprecated 27 | * This function will be deleted soon. Callers should directly use 28 | * `::testing::InitGoogleMock` instead. 29 | * 30 | * We used to need to work around a gmock issue on Windows, but it has since 31 | * been fixed by https://github.com/google/googletest/pull/2372 and included in 32 | * googletest v1.10.0. 33 | * 34 | * See also https://github.com/googleapis/google-cloud-cpp/issues/3713. 35 | */ 36 | inline void InitGoogleMock(int& argc, char* argv[]) { 37 | ::testing::InitGoogleMock(&argc, argv); 38 | } 39 | } // namespace testing_util 40 | } // namespace GOOGLE_CLOUD_CPP_NS 41 | } // namespace cloud 42 | } // namespace google 43 | 44 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TESTING_UTIL_INIT_GOOGLE_MOCK_H 45 | -------------------------------------------------------------------------------- /google/cloud/testing_util/is_proto_equal.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2020 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 | // http://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 | #include "google/cloud/testing_util/is_proto_equal.h" 16 | #include 17 | 18 | namespace google { 19 | namespace cloud { 20 | inline namespace GOOGLE_CLOUD_CPP_NS { 21 | namespace testing_util { 22 | 23 | optional CompareProtos(google::protobuf::Message const& arg, 24 | google::protobuf::Message const& value) { 25 | std::string delta; 26 | google::protobuf::util::MessageDifferencer differencer; 27 | differencer.ReportDifferencesToString(&delta); 28 | auto const result = differencer.Compare(arg, value); 29 | if (result) return {}; 30 | return delta; 31 | } 32 | 33 | } // namespace testing_util 34 | } // namespace GOOGLE_CLOUD_CPP_NS 35 | } // namespace cloud 36 | } // namespace google 37 | -------------------------------------------------------------------------------- /google/cloud/testing_util/is_proto_equal.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TESTING_UTIL_IS_PROTO_EQUAL_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TESTING_UTIL_IS_PROTO_EQUAL_H 17 | 18 | #include "google/cloud/optional.h" 19 | #include "google/cloud/version.h" 20 | #include 21 | #include 22 | 23 | namespace google { 24 | namespace cloud { 25 | inline namespace GOOGLE_CLOUD_CPP_NS { 26 | namespace testing_util { 27 | 28 | optional CompareProtos(google::protobuf::Message const& arg, 29 | google::protobuf::Message const& value); 30 | 31 | MATCHER_P(IsProtoEqual, value, "Checks whether protos are equal") { 32 | optional delta = CompareProtos(arg, value); 33 | if (delta.has_value()) { 34 | *result_listener << "\n" << *delta; 35 | } 36 | return !delta.has_value(); 37 | } 38 | 39 | } // namespace testing_util 40 | } // namespace GOOGLE_CLOUD_CPP_NS 41 | } // namespace cloud 42 | } // namespace google 43 | 44 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TESTING_UTIL_IS_PROTO_EQUAL_H 45 | -------------------------------------------------------------------------------- /google/cloud/testing_util/is_proto_equal_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2020 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 | // http://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 | #include "google/cloud/testing_util/is_proto_equal.h" 16 | #include 17 | #include 18 | 19 | namespace google { 20 | namespace cloud { 21 | inline namespace GOOGLE_CLOUD_CPP_NS { 22 | namespace testing_util { 23 | namespace { 24 | 25 | using ::testing::Not; 26 | 27 | TEST(IsProtoEqual, Basic) { 28 | ::google::protobuf::StringValue actual; 29 | actual.set_value("Hello World"); 30 | ::google::protobuf::StringValue not_actual; 31 | 32 | EXPECT_THAT(actual, IsProtoEqual(actual)); 33 | EXPECT_THAT(actual, Not(IsProtoEqual(not_actual))); 34 | } 35 | 36 | } // namespace 37 | } // namespace testing_util 38 | } // namespace GOOGLE_CLOUD_CPP_NS 39 | } // namespace cloud 40 | } // namespace google 41 | -------------------------------------------------------------------------------- /google/cloud/testing_util/mock_completion_queue.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 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 | // http://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 | #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TESTING_UTIL_MOCK_COMPLETION_QUEUE_H 16 | #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TESTING_UTIL_MOCK_COMPLETION_QUEUE_H 17 | 18 | #include "google/cloud/internal/completion_queue_impl.h" 19 | 20 | namespace google { 21 | namespace cloud { 22 | inline namespace GOOGLE_CLOUD_CPP_NS { 23 | namespace testing_util { 24 | 25 | // Tests typically create an instance of this class, then create a 26 | // `google::cloud::bigtable::CompletionQueue` to wrap it, keeping a reference to 27 | // the instance to manipulate its state directly. 28 | class MockCompletionQueue 29 | : public google::cloud::internal::CompletionQueueImpl { 30 | public: 31 | std::unique_ptr CreateAlarm() const override { 32 | // grpc::Alarm objects are really hard to cleanup when mocking their 33 | // behavior, so we do not create an alarm, instead we return nullptr, which 34 | // the classes that care (AsyncTimerFunctor) know what to do with. 35 | return std::unique_ptr(); 36 | } 37 | 38 | using CompletionQueueImpl::empty; 39 | using CompletionQueueImpl::SimulateCompletion; 40 | using CompletionQueueImpl::size; 41 | }; 42 | 43 | } // namespace testing_util 44 | } // namespace GOOGLE_CLOUD_CPP_NS 45 | } // namespace cloud 46 | } // namespace google 47 | 48 | #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TESTING_UTIL_MOCK_COMPLETION_QUEUE_H 49 | -------------------------------------------------------------------------------- /google/cloud/testing_util/scoped_environment.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2020 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 | // http://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 | #include "google/cloud/testing_util/scoped_environment.h" 16 | #include "google/cloud/internal/getenv.h" 17 | #include "google/cloud/internal/setenv.h" 18 | 19 | namespace google { 20 | namespace cloud { 21 | inline namespace GOOGLE_CLOUD_CPP_NS { 22 | namespace testing_util { 23 | 24 | ScopedEnvironment::ScopedEnvironment(std::string variable, 25 | optional const& value) 26 | : variable_(std::move(variable)), 27 | prev_value_(internal::GetEnv(variable_.c_str())) { 28 | internal::SetEnv(variable_.c_str(), value); 29 | } 30 | 31 | ScopedEnvironment::~ScopedEnvironment() { 32 | internal::SetEnv(variable_.c_str(), std::move(prev_value_)); 33 | } 34 | 35 | } // namespace testing_util 36 | } // namespace GOOGLE_CLOUD_CPP_NS 37 | } // namespace cloud 38 | } // namespace google 39 | -------------------------------------------------------------------------------- /google/cloud/testing_util/testing_types.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | // http://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 | #include "google/cloud/testing_util/testing_types.h" 16 | 17 | namespace google { 18 | namespace cloud { 19 | inline namespace GOOGLE_CLOUD_CPP_NS { 20 | namespace testing_util { 21 | 22 | int Observable::default_constructor = 0; 23 | int Observable::value_constructor = 0; 24 | int Observable::copy_constructor = 0; 25 | int Observable::move_constructor = 0; 26 | int Observable::copy_assignment = 0; 27 | int Observable::move_assignment = 0; 28 | int Observable::destructor = 0; 29 | 30 | } // namespace testing_util 31 | } // namespace GOOGLE_CLOUD_CPP_NS 32 | } // namespace cloud 33 | } // namespace google 34 | -------------------------------------------------------------------------------- /google/cloud/tracing_options_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2020 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 | // http://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 | #include "google/cloud/tracing_options.h" 16 | #include 17 | 18 | namespace google { 19 | namespace cloud { 20 | inline namespace GOOGLE_CLOUD_CPP_NS { 21 | namespace { 22 | 23 | TEST(TracingOptionsTest, Defaults) { 24 | TracingOptions tracing_options; 25 | EXPECT_TRUE(tracing_options.single_line_mode()); 26 | EXPECT_TRUE(tracing_options.use_short_repeated_primitives()); 27 | EXPECT_EQ(128, tracing_options.truncate_string_field_longer_than()); 28 | 29 | // Unknown/unparseable options are ignored. 30 | tracing_options.SetOptions("foo=1,bar=T,baz=no"); 31 | EXPECT_TRUE(tracing_options.single_line_mode()); 32 | EXPECT_TRUE(tracing_options.use_short_repeated_primitives()); 33 | EXPECT_EQ(128, tracing_options.truncate_string_field_longer_than()); 34 | } 35 | 36 | TEST(TracingOptionsTest, Override) { 37 | TracingOptions tracing_options; 38 | tracing_options.SetOptions( 39 | ",single_line_mode=F" 40 | ",use_short_repeated_primitives=n" 41 | ",truncate_string_field_longer_than=256"); 42 | EXPECT_FALSE(tracing_options.single_line_mode()); 43 | EXPECT_FALSE(tracing_options.use_short_repeated_primitives()); 44 | EXPECT_EQ(256, tracing_options.truncate_string_field_longer_than()); 45 | } 46 | 47 | } // namespace 48 | } // namespace GOOGLE_CLOUD_CPP_NS 49 | } // namespace cloud 50 | } // namespace google 51 | -------------------------------------------------------------------------------- /google/cloud/version.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2019 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 | // http://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 | #include "google/cloud/version.h" 16 | #include "google/cloud/internal/build_info.h" 17 | #include 18 | 19 | namespace google { 20 | namespace cloud { 21 | inline namespace GOOGLE_CLOUD_CPP_NS { 22 | // NOLINTNEXTLINE(readability-identifier-naming) 23 | std::string version_string() { 24 | static std::string const kVersion = [] { 25 | std::ostringstream os; 26 | os << "v" << version_major() << "." << version_minor() << "." 27 | << version_patch(); 28 | auto metadata = google::cloud::internal::build_metadata(); 29 | if (!metadata.empty()) { 30 | os << "+" << metadata; 31 | } 32 | return os.str(); 33 | }(); 34 | return kVersion; 35 | } 36 | } // namespace GOOGLE_CLOUD_CPP_NS 37 | } // namespace cloud 38 | } // namespace google 39 | -------------------------------------------------------------------------------- /release/README.md: -------------------------------------------------------------------------------- 1 | This directory contains documents and tools for managing releases of the Google 2 | Cloud C++ client libraries. 3 | -------------------------------------------------------------------------------- /super/external/c-ares.cmake: -------------------------------------------------------------------------------- 1 | # ~~~ 2 | # Copyright 2018 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 | # http://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(ExternalProjectHelper) 18 | 19 | if (NOT TARGET c-ares-project) 20 | # Give application developers a hook to configure the version and hash 21 | # downloaded from GitHub. 22 | set(GOOGLE_CLOUD_CPP_C_ARES_URL 23 | "https://github.com/c-ares/c-ares/archive/cares-1_14_0.tar.gz") 24 | set(GOOGLE_CLOUD_CPP_C_ARES_SHA256 25 | "62dd12f0557918f89ad6f5b759f0bf4727174ae9979499f5452c02be38d9d3e8") 26 | 27 | set_external_project_build_parallel_level(PARALLEL) 28 | set_external_project_vars() 29 | 30 | include(ExternalProject) 31 | ExternalProject_Add( 32 | c-ares-project 33 | EXCLUDE_FROM_ALL ON 34 | PREFIX "${CMAKE_BINARY_DIR}/external/c-ares" 35 | INSTALL_DIR "${GOOGLE_CLOUD_CPP_EXTERNAL_PREFIX}" 36 | URL ${GOOGLE_CLOUD_CPP_C_ARES_URL} 37 | URL_HASH SHA256=${GOOGLE_CLOUD_CPP_C_ARES_SHA256} 38 | LIST_SEPARATOR | 39 | CMAKE_ARGS ${GOOGLE_CLOUD_CPP_EXTERNAL_PROJECT_CMAKE_FLAGS} 40 | -DCMAKE_PREFIX_PATH=${GOOGLE_CLOUD_CPP_PREFIX_PATH} 41 | -DCMAKE_INSTALL_RPATH=${GOOGLE_CLOUD_CPP_INSTALL_RPATH} 42 | -DCMAKE_INSTALL_PREFIX= 43 | BUILD_COMMAND ${CMAKE_COMMAND} --build ${PARALLEL} 44 | LOG_DOWNLOAD ON 45 | LOG_CONFIGURE ON 46 | LOG_BUILD ON 47 | LOG_INSTALL ON) 48 | endif () 49 | -------------------------------------------------------------------------------- /super/external/ssl.cmake: -------------------------------------------------------------------------------- 1 | # ~~~ 2 | # Copyright 2018 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 | # http://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 | if (NOT TARGET ssl-project) 18 | # For OpenSSL we don't really support external projects. OpenSSL build 19 | # system is notoriously finicky. Use vcpkg on Windows, or install OpenSSL 20 | # using your operating system packages instead. 21 | # 22 | # This file is here to simplify the definition of external projects, such as 23 | # curl and gRPC, that depend on a SSL library. 24 | find_package(OpenSSL REQUIRED) 25 | add_custom_target(ssl-project) 26 | endif () 27 | -------------------------------------------------------------------------------- /super/external/zlib.cmake: -------------------------------------------------------------------------------- 1 | # ~~~ 2 | # Copyright 2018 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 | # http://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 | if (NOT TARGET zlib-project) 18 | # Give application developers a hook to configure the version and hash 19 | # downloaded from GitHub. 20 | set(GOOGLE_CLOUD_CPP_ZLIB_URL 21 | "https://github.com/madler/zlib/archive/v1.2.11.tar.gz") 22 | set(GOOGLE_CLOUD_CPP_ZLIB_SHA256 23 | "629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff") 24 | 25 | set_external_project_build_parallel_level(PARALLEL) 26 | set_external_project_vars() 27 | 28 | include(ExternalProject) 29 | ExternalProject_Add( 30 | zlib-project 31 | EXCLUDE_FROM_ALL ON 32 | PREFIX "${CMAKE_BINARY_DIR}/external/zlib" 33 | INSTALL_DIR "${GOOGLE_CLOUD_CPP_EXTERNAL_PREFIX}" 34 | URL ${GOOGLE_CLOUD_CPP_ZLIB_URL} 35 | URL_HASH SHA256=${GOOGLE_CLOUD_CPP_ZLIB_SHA256} 36 | LIST_SEPARATOR | 37 | CMAKE_ARGS ${GOOGLE_CLOUD_CPP_EXTERNAL_PROJECT_CMAKE_FLAGS} 38 | -DCMAKE_PREFIX_PATH=${GOOGLE_CLOUD_CPP_PREFIX_PATH} 39 | -DCMAKE_INSTALL_RPATH=${GOOGLE_CLOUD_CPP_INSTALL_RPATH} 40 | -DCMAKE_INSTALL_PREFIX= 41 | BUILD_COMMAND ${CMAKE_COMMAND} --build ${PARALLEL} 42 | LOG_DOWNLOAD ON 43 | LOG_CONFIGURE ON 44 | LOG_BUILD ON 45 | LOG_INSTALL ON) 46 | endif () 47 | --------------------------------------------------------------------------------