Skip to content

Commit 852cff0

Browse files
authored
docs: add more cases for generating new libraries (#14806)
* docs: add more cases for generating new libraries * fix
1 parent bf3bf1c commit 852cff0

File tree

2 files changed

+27
-13
lines changed

2 files changed

+27
-13
lines changed

doc/contributor/howto-guide-adding-generated-libraries.md

+25-11
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,31 @@ cd $HOME/google-cloud-cpp
2828
```shell
2929
library=... # The name of your new library in the google-cloud-cpp repository
3030
subdir="google/cloud/${library}" # The path in googleapis repo, may not start with google/cloud/
31-
bazel_output_base="$(bazel info output_base)"
31+
bazel_output_base="$(bazelisk info output_base)"
3232
```
3333

3434
### Verify the C++ rules exist
3535

36+
You may need to
37+
[Send a PR to update the googleapis SHA to the latest version](../contributor/howto-guide-update-googleapis-sha.md).
38+
Wait until that is submitted before proceeding any further for the following 2
39+
cases:
40+
41+
1. The dependency does not exist at the pinned version of the googleapis repo.
42+
3643
```shell
37-
bazel --batch query --noshow_progress --noshow_loading_progress \
44+
bazelisk --batch query --noshow_progress --noshow_loading_progress \
3845
"kind(cc_library, @com_google_googleapis//${subdir}/...)"
3946
```
4047

41-
If the command fails, it returns something like this:
48+
- If the command fails, it returns something like this:
4249

4350
```shell
4451
ERROR: no targets found beneath 'commerce'
4552
```
4653

47-
This means the dependency does not exist at the pinned version of the googleapis
48-
repo.
49-
[Send a PR to update the googleapis SHA to the latest version](../contributor/howto-guide-update-googleapis-sha.md).
50-
Wait until that is submitted before proceeding any further.
54+
2. Check `$bazel_output_base/external/googleapis~/api-index-v1.json`, if
55+
`$library` with the correct version is not in `apis` section.
5156

5257
### Edit the scripts and configuration
5358

@@ -143,7 +148,7 @@ external/googleapis/update_libraries.sh "${library}"
143148
Then run the micro-generator to create the scaffold and the C++ sources:
144149

145150
```shell
146-
bazel run \
151+
bazelisk run \
147152
//generator:google-cloud-cpp-codegen -- \
148153
--protobuf_proto_path="${bazel_output_base}"/external/protobuf~/src \
149154
--googleapis_proto_path="${bazel_output_base}"/external/googleapis~ \
@@ -226,7 +231,7 @@ API. Test your changes with:
226231

227232
```sh
228233
gcloud services enable --project=cloud-cpp-testing-resources "${library}.googleapis.com"
229-
bazel run -- //google/cloud/${library}/quickstart:quickstart $params
234+
bazelisk run -- //google/cloud/${library}/quickstart:quickstart $params
230235
```
231236

232237
Edit the tests so this new quickstart receives the right command-line arguments
@@ -245,6 +250,15 @@ git add ci/abi-dumps
245250
git commit -m "Add API baseline"
246251
```
247252

253+
The following error is expected for the first run, because the command generates
254+
the ABI dump and fails because there is no previous ABI dump to compare to. When
255+
you run once more, the error is gone.
256+
257+
```
258+
grep: cmake-out/compat_reports/google_cloud_cpp_parallelstore/src_compat_report.html: No such file or directory
259+
2024-10-25T19:00:49Z (+57s): ABI Compliance error: google_cloud_cpp_parallelstore
260+
```
261+
248262
### Update the README files
249263

250264
The following files probably need some light copy-editing to read less like they
@@ -279,7 +293,7 @@ ci/cloudbuild/build.sh -t checkers-pr
279293
### Verify everything compiles
280294

281295
```shell
282-
bazel build //google/cloud/${library}/...
296+
bazelisk build //google/cloud/${library}/...
283297
ci/cloudbuild/build.sh -t cmake-install-pr
284298
```
285299

@@ -359,7 +373,7 @@ git commit -am "generated changes"
359373
### Verify everything compiles
360374

361375
```shell
362-
bazel build //google/cloud/${library}/...
376+
bazelisk build //google/cloud/${library}/...
363377
ci/cloudbuild/build.sh -t cmake-install-pr
364378
```
365379

external/googleapis/update_libraries.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,12 @@ for library in "${keys[@]}"; do
349349
if [[ -z "${rule}" ]]; then continue; fi
350350
path="${rule%:*}"
351351
echo "=== $library $rule $path"
352-
bazel query --noshow_progress --noshow_loading_progress \
352+
bazelisk query --noshow_progress --noshow_loading_progress \
353353
"deps(${rule})" |
354354
grep "${path}" |
355355
grep -E '\.proto$' \
356356
>>"external/googleapis/protolists/${library}.list" || true
357-
bazel query --noshow_progress --noshow_loading_progress \
357+
bazelisk query --noshow_progress --noshow_loading_progress \
358358
"deps(${rule})" |
359359
grep "@com_google_googleapis//" | grep _proto |
360360
grep -v "${path}" \

0 commit comments

Comments
 (0)