Skip to content

Commit b3b5998

Browse files
authored
docs: another pass on library-howto (#11880)
1 parent c348497 commit b3b5998

1 file changed

Lines changed: 20 additions & 13 deletions

File tree

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

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ cd $HOME/google-cloud-cpp
2323
```shell
2424
library=... # The name of your new library in the google-cloud-cpp repository
2525
subdir="google/cloud/${library}" # The path in googleapis repo, may not start with google/cloud/
26+
bazel_output_base="$(bazel info output_base)"
2627
```
2728

2829
## Verify the C++ rules exist
@@ -70,6 +71,13 @@ example, [here][retryable-status-codes].
7071

7172
Manually edit `generator/generator_config.textproto` and add the new service.
7273

74+
Find the list of `.proto` files that will need to be included:
75+
76+
```shell
77+
find "${bazel_output_base}/external/com_google_googleapis/${subdir}" -name '*.proto' -print0 |
78+
xargs -0 grep -l '^service'
79+
```
80+
7381
> **Note:**
7482
> While older service definitions may not include the version specification
7583
> in the `product_path` field, all new services are required to include the
@@ -119,7 +127,6 @@ external/googleapis/update_libraries.sh "${library}"
119127
Then run the micro-generator to create the scaffold and the C++ sources:
120128

121129
```shell
122-
bazel_output_base="$(bazel info output_base)"
123130
bazel run \
124131
//generator:google-cloud-cpp-codegen -- \
125132
--protobuf_proto_path="${bazel_output_base}"/external/com_google_protobuf/src \
@@ -184,25 +191,14 @@ Otherwise, if you are generating an experimental library, add it to
184191
`GOOGLE_CLOUD_CPP_EXPERIMENTAL_LIBRARIES` and note in a comment when the library
185192
was generated.
186193

187-
## Add the API baseline
188-
189-
For new GA libraries you need to create the API baseline. You can leave this
190-
running while you work on tweaks to the quickstart and documentation.
191-
192-
```shell
193-
env GOOGLE_CLOUD_CPP_CHECK_API=${library} ci/cloudbuild/build.sh -t check-api-pr
194-
git add ci/abi-dumps
195-
git commit -m"Add API baseline" ci/abi-dumps/
196-
```
197-
198194
## Update the quickstart
199195

200196
The generated quickstart will need some editing. Use a simple operation, maybe
201197
an admin operation listing top-level resources, to demonstrate how to use the
202198
API. Test your changes with:
203199

204200
```sh
205-
gcloud services enable --project=cloud-cpp-testing-resources ${lbrary}.googleapis.com
201+
gcloud services enable --project=cloud-cpp-testing-resources "${library}.googleapis.com"
206202
bazel run -- //google/cloud/${library}/quickstart:quickstart $params
207203
```
208204

@@ -211,6 +207,17 @@ arguments in the CI builds.
211207

212208
- `google/cloud/${library}/CMakeLists.txt`
213209

210+
## Add the API baseline
211+
212+
For new GA libraries you need to create the API baseline. You can leave this
213+
running while you work on tweaks to the quickstart and documentation.
214+
215+
```shell
216+
env GOOGLE_CLOUD_CPP_CHECK_API=${library} ci/cloudbuild/build.sh -t check-api-pr
217+
git add ci/abi-dumps
218+
git commit -m"Add API baseline" ci/abi-dumps/
219+
```
220+
214221
## Update the README files
215222

216223
The following files probably need some light copy-editing to read less like they

0 commit comments

Comments
 (0)