Skip to content

Commit

Permalink
chore: add library params (#2457)
Browse files Browse the repository at this point in the history
In this PR:
- Add parameters to `LibraryConfig'
  - `codeowner_team`, found in java-analytics-admin
  - `excluded_poms`, found in java-iam, java-compute
  - `excluded_dependencies` found in java-iam, java-compute
  • Loading branch information
JoeWang1127 authored and lqiu96 committed Feb 28, 2024
1 parent 09aa864 commit f74b29f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions library_generation/model/generation_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ def from_yaml(path_to_yaml: str) -> GenerationConfig:
release_level=__optional(library, "release_level", "preview"),
api_id=__optional(library, "api_id", None),
api_reference=__optional(library, "api_reference", None),
codeowner_team=__optional(library, "codeowner_team", None),
excluded_poms=__optional(library, "excluded_poms", None),
excluded_dependencies=__optional(library, "excluded_dependencies", None),
client_documentation=__optional(library, "client_documentation", None),
distribution_name=__optional(library, "distribution_name", None),
googleapis_commitish=__optional(library, "googleapis_commitish", None),
Expand Down
6 changes: 6 additions & 0 deletions library_generation/model/library_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ def __init__(
release_level: Optional[str] = None,
api_id: Optional[str] = None,
api_reference: Optional[str] = None,
codeowner_team: Optional[str] = None,
client_documentation: Optional[str] = None,
distribution_name: Optional[str] = None,
excluded_dependencies: Optional[str] = None,
excluded_poms: Optional[str] = None,
googleapis_commitish: Optional[str] = None,
group_id: Optional[str] = "com.google.cloud",
issue_tracker: Optional[str] = None,
Expand All @@ -53,6 +56,9 @@ def __init__(
self.release_level = release_level if release_level else "preview"
self.api_id = api_id
self.api_reference = api_reference
self.codeowner_team = codeowner_team
self.excluded_dependencies = excluded_dependencies
self.excluded_poms = excluded_poms
self.client_documentation = client_documentation
self.distribution_name = distribution_name
self.googleapis_commitish = googleapis_commitish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ libraries:
release_level: "stable"
issue_tracker: "https://issuetracker.google.com/issues/new?component=187210&template=0"
api_reference: "https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview"
codeowner_team: "@googleapis/analytics-dpe"
excluded_poms: proto-google-iam-v1-bom,google-iam-policy,proto-google-iam-v1
excluded_dependencies: google-iam-policy
GAPICs:
- proto_path: google/cloud/asset/v1
- proto_path: google/cloud/asset/v1p1beta1
Expand Down
6 changes: 6 additions & 0 deletions library_generation/test/unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ def test_from_yaml_succeeds(self):
library.api_description,
)
self.assertEqual("asset", library.library_name)
self.assertEqual("@googleapis/analytics-dpe", library.codeowner_team)
self.assertEqual(
"proto-google-iam-v1-bom,google-iam-policy,proto-google-iam-v1",
library.excluded_poms,
)
self.assertEqual("google-iam-policy", library.excluded_dependencies)
gapics = library.gapic_configs
self.assertEqual(5, len(gapics))
self.assertEqual("google/cloud/asset/v1", gapics[0].proto_path)
Expand Down
6 changes: 6 additions & 0 deletions library_generation/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,12 @@ def generate_prerequisite_files(

if library.api_reference:
repo_metadata["api_reference"] = library.api_reference
if library.codeowner_team:
repo_metadata["codeowner_team"] = library.codeowner_team
if library.excluded_dependencies:
repo_metadata["excluded_dependencies"] = library.excluded_dependencies
if library.excluded_poms:
repo_metadata["excluded_poms"] = library.excluded_poms
if library.issue_tracker:
repo_metadata["issue_tracker"] = library.issue_tracker
if library.rest_documentation:
Expand Down

0 comments on commit f74b29f

Please sign in to comment.