Skip to content

feat(generator): generate quickstart scaffold#7676

Merged
coryan merged 4 commits into
googleapis:mainfrom
coryan:feat-generator-improve-scaffold
Dec 1, 2021
Merged

feat(generator): generate quickstart scaffold#7676
coryan merged 4 commits into
googleapis:mainfrom
coryan:feat-generator-improve-scaffold

Conversation

@coryan
Copy link
Copy Markdown
Contributor

@coryan coryan commented Nov 30, 2021

Modify the generator to also create a scaffold for the quickstart
program. Then I used the generator to create the scaffold for the
logging, pubsublite, secretmanager, and tasks libraries.

The generated code requires some editing, but these are fairly small.

These quickstarts are compiled in the cmake-install build, where we
can compile them in parallel. This was very useful, it found several
bugs in the generated CMake files.

Sorry for the gigantic PR. Most of it is generated code, I think you
should pay attention to:

  • Anything in generator/
  • google/cloud/*/doc/main.dox had some light editing
  • google/cloud/*/quickstart/README.md has some light editing
  • google/cloud/*/quickstart/quickstart.cc has some significant editing
  • Other files in google/cloud/*/quickstart/* are generated

This change is Reviewable

Modify the generator to also create a scaffold for the quickstart
program. Then I used the generator to create the scaffold for the
`logging`, `pubsublite`, `secretmanager`, and `tasks` libraries.

The generated code requires some editing, but these are fairly small.

These quickstarts are compiled in the `cmake-install` build, where we
can compile them in parallel. This was very useful, it found several
bugs in the generated CMake files.
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Nov 30, 2021
@google-cloud-cpp-bot
Copy link
Copy Markdown
Contributor

Google Cloud Build Logs
For commit: 2252f138286788b0ed8544f3cd7951d10f74976e

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 30, 2021

Codecov Report

Merging #7676 (45e0846) into main (b92933b) will decrease coverage by 0.00%.
The diff coverage is 96.19%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7676      +/-   ##
==========================================
- Coverage   95.28%   95.28%   -0.01%     
==========================================
  Files        1254     1254              
  Lines      113312   113414     +102     
==========================================
+ Hits       107972   108067      +95     
- Misses       5340     5347       +7     
Impacted Files Coverage Δ
generator/internal/scaffold_generator.cc 86.54% <91.83%> (+2.12%) ⬆️
generator/internal/scaffold_generator_test.cc 100.00% <100.00%> (ø)
google/cloud/bigtable/async_read_stream_test.cc 97.32% <0.00%> (-0.67%) ⬇️
...le/cloud/storage/internal/curl_download_request.cc 89.25% <0.00%> (-0.38%) ⬇️
...ud/spanner/integration_tests/client_stress_test.cc 86.18% <0.00%> (+0.65%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b92933b...45e0846. Read the comment docs.

@google-cloud-cpp-bot
Copy link
Copy Markdown
Contributor

Google Cloud Build Logs
For commit: f185a12c570e98c9b493a55b4ee083dfd1806b12

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@google-cloud-cpp-bot
Copy link
Copy Markdown
Contributor

Google Cloud Build Logs
For commit: 17c0fd895709bb5585082205261fa6e421b78457

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@coryan coryan marked this pull request as ready for review December 1, 2021 00:43
@coryan coryan requested a review from a team December 1, 2021 00:43
Copy link
Copy Markdown
Member

@dbolduc dbolduc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all nits. nothing functional.

### Setting up your repo

In order to use the $title$ C++ client library from your own code,
you'll need to configure your build system how to fetch and compile the Cloud
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/how to/to/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


In order to use the $title$ C++ client library from your own code,
you'll need to configure your build system how to fetch and compile the Cloud
C++ client libraries. The Cloud C++ client libraries natively supports the
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/supports/support/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


- `GOOGLE_CLOUD_CPP_ENABLE_TRACING=rpc` turns on tracing for most gRPC
calls. The library injects an additional Stub decorator that prints each gRPC
request and response. Unless you have configured you own logging backend,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/you/your/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

including whether messages will be output on multiple lines, or whether
string/bytes fields will be truncated.

- `GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes` turns on logging in the library, basically
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/, basically/. Basically/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


- `GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes` turns on logging in the library, basically
the library always "logs" but the logging infrastructure has no backend to
actually print anything until the application sets a backend or they set this
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/they set/it sets/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

[`StatusOr<T>`][status-or-header] if an error is possible. This is an "outcome"
type, when the operation is successful a `StatusOr<T>` converts to `true` in
boolean context (and its `.ok()` member function returns `true`), the
application can then use `operator->` or `operator*` to access then `T` value.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/access then/access the/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

boolean context (and its `.ok()` member function returns `true`), the
application can then use `operator->` or `operator*` to access then `T` value.
When the operation fails a `StatusOr<T>` converts to `false` (and `.ok()`
returns false). It is undefined behavior to use the value in this case.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/false/false/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

[github-link]: https://github.com/googleapis/google-cloud-cpp 'GitHub Repository'
<!-- The ugly %2E disables auto-linking in Doxygen -->
[github-readme]: https://github.com/googleapis/google-cloud-cpp/blob/main/google/cloud/$library$/README%2Emd
[github-install]: https://github.com/googleapis/google-cloud-cpp/blob/main/doc/packagin%2Emd
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/packagin/packaging/ ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# Fetch the Google Cloud C++ libraries.
# NOTE: Update this version and SHA256 as needed.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm. this is a little weird. but I think renovate-bot would update it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I figured that the benefit of trying to generate a perfect WORKSPACE file was not worth it since it will get updated anyway.

@google-cloud-cpp-bot
Copy link
Copy Markdown
Contributor

Google Cloud Build Logs
For commit: 45e0846596522aad4ee698f040f609d2e75c06b3

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@coryan
Copy link
Copy Markdown
Contributor Author

coryan commented Dec 1, 2021

PTAL

@coryan coryan merged commit fc6a1af into googleapis:main Dec 1, 2021
@coryan coryan deleted the feat-generator-improve-scaffold branch December 1, 2021 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants