Skip to content

Commit

Permalink
[CI] Added a gRPC_BUILD_TESTS guard to third_party protos (grpc#38179)
Browse files Browse the repository at this point in the history
When not having submodules under the `third_party` directory, CMake throws an error in building gRPC because it couldn't find proto files in those directories even though those files are only used for tests.

```
CMake Error at CMakeLists.txt:611 (file):
  file COPY cannot find
  "/root/grpc/third_party/googleapis/google/api/annotations.proto": No such
  file or directory.
Call Stack (most recent call first):
  CMakeLists.txt:1184 (protobuf_generate_grpc_cpp_with_import_path_correction)
```

There's a interesting quirk in the CMake build process:

- Empty `third_party/googleapis` directory: Build fails.
- No `third_party/googleapis` directory: Build succeeds.

This inconsistency went undetected by our distrib-test because it completely removes the third_party/googleapis directory. However, Cloud C++ encountered this issue because it downloads a tarball that creates an empty third_party/googleapis directory.

This fix hides those proto targets when `gRPC_BUILD_TESTS` is not turned on to not run ino this problem.

Closes grpc#38179

COPYBARA_INTEGRATE_REVIEW=grpc#38179 from veblush:cmake-proto b8c9ca9
PiperOrigin-RevId: 699286689
  • Loading branch information
veblush authored and copybara-github committed Nov 22, 2024
1 parent 7826ddc commit cfda657
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
14 changes: 14 additions & 0 deletions templates/CMakeLists.txt.template

0 comments on commit cfda657

Please sign in to comment.