-
Notifications
You must be signed in to change notification settings - Fork 438
impl(generator): regenerate most doc files #15653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
6fec982
f10480f
072f22d
287ddf4
d93c262
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Copyright 2025 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| type: google.api.Service | ||
| config_version: 3 | ||
| name: test.googleapis.com | ||
| title: Test2 | ||
|
|
||
| apis: | ||
| - name: google.test.rest.only.v1.GoldenRestOnly |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Copyright 2025 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| type: google.api.Service | ||
| config_version: 3 | ||
| name: test.googleapis.com | ||
| title: Test Deprecated | ||
|
|
||
| apis: | ||
| - name: google.test.deprecated.v1.DeprecatedService |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ | |
| #include <google/protobuf/compiler/command_line_interface.h> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also to double check my understanding, is there were the doc generation logic lives?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The dox file templates are generated from calling GenerateScaffold. Additional content is injected when update-library-landing-dox.sh is invoked. |
||
| #include <google/protobuf/text_format.h> | ||
| #include <algorithm> | ||
| #include <array> | ||
| #include <fstream> | ||
| #include <future> | ||
| #include <iostream> | ||
|
|
@@ -231,6 +232,26 @@ std::vector<std::future<google::cloud::Status>> GenerateCodeFromProtos( | |
| if (generate_scaffold) { | ||
| GenerateScaffold(scaffold_vars, generator_args.scaffold_templates_path, | ||
| generator_args.output_path, service); | ||
| } else { | ||
| static constexpr std::array<char const*, 4> kOmittedDocDirs = { | ||
| "google/cloud/bigtable", "google/cloud/compute", | ||
| "google/cloud/pubsub", "google/cloud/spanner"}; | ||
|
|
||
|
Comment on lines
+243
to
+246
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you provide some context into why these modules are being excluded?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added comments to document the rationale. |
||
| if (!service.omit_client() && | ||
| !std::any_of(kOmittedDocDirs.begin(), kOmittedDocDirs.end(), | ||
| [&](auto s) { | ||
| // TODO(#15652): Remove when service is turned down. | ||
| if (absl::StartsWith(service.product_path(), | ||
| "google/cloud/pubsublite")) { | ||
| return false; | ||
| } | ||
| return absl::StartsWith(service.product_path(), s); | ||
| })) { | ||
| GenerateScaffold( | ||
| scaffold_vars, generator_args.scaffold_templates_path, | ||
| generator_args.output_path, service, | ||
| google::cloud::generator_internal::ScaffoldFiles::kDocDir); | ||
| } | ||
|
Comment on lines
+247
to
+261
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic within this bool omit_doc_dir = std::any_of(
kOmittedDocDirs.begin(), kOmittedDocDirs.end(),
[&](auto s) { return absl::StartsWith(service.product_path(), s); });
// TODO(#15652): Remove when service is turned down.
if (absl::StartsWith(service.product_path(), "google/cloud/pubsublite")) {
omit_doc_dir = false;
}
if (!service.omit_client() && !omit_doc_dir) {
GenerateScaffold(
scaffold_vars, generator_args.scaffold_templates_path,
generator_args.output_path, service,
google::cloud::generator_internal::ScaffoldFiles::kDocDir);
} |
||
| } | ||
| if (!service.omit_repo_metadata()) { | ||
| GenerateMetadata(scaffold_vars, generator_args.output_path, service, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is code duplication in this
if-elseblock. The list of documentation files to be generated (environment-variables.dox,override-authentication.dox, etc.) is present in both theifbranch (lines 347-351) and theelsebranch (lines 360-364). To improve maintainability and avoid potential inconsistencies in the future, consider extracting this common list of files into a separate variable and using it in both branches.