Skip to content

Commit

Permalink
remove template_excludes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeWang1127 committed May 24, 2024
1 parent a2f94b4 commit b3cba4b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 60 deletions.
14 changes: 0 additions & 14 deletions library_generation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ They are shared by library level parameters.
| grpc_version | No | inferred from the generator if not specified |
| googleapis-commitish | Yes | |
| libraries_bom_version | No | empty string if not specified |
| template_excludes | No | empty list if not specified |

### Library level parameters

Expand Down Expand Up @@ -147,19 +146,6 @@ gapic_generator_version: 2.34.0
protoc_version: 25.2
googleapis_commitish: 1a45bf7393b52407188c82e63101db7dc9c72026
libraries_bom_version: 26.37.0
destination_path: google-cloud-java
template_excludes:
- ".github/*"
- ".kokoro/*"
- "samples/*"
- "CODE_OF_CONDUCT.md"
- "CONTRIBUTING.md"
- "LICENSE"
- "SECURITY.md"
- "java.header"
- "license-checks.xml"
- "renovate.json"
- ".gitignore"
libraries:
- api_shortname: apigeeconnect
name_pretty: Apigee Connect
Expand Down
3 changes: 0 additions & 3 deletions library_generation/model/generation_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def __init__(
gapic_generator_version: str,
googleapis_commitish: str,
libraries: list[LibraryConfig],
template_excludes: Optional[list[str]] = None,
libraries_bom_version: Optional[str] = None,
grpc_version: Optional[str] = None,
protoc_version: Optional[str] = None,
Expand All @@ -43,7 +42,6 @@ def __init__(
self.libraries_bom_version = (
libraries_bom_version if libraries_bom_version else ""
)
self.template_excludes = template_excludes if template_excludes else []
self.libraries = libraries
self.grpc_version = grpc_version
self.protoc_version = protoc_version
Expand Down Expand Up @@ -151,7 +149,6 @@ def from_yaml(path_to_yaml: str) -> GenerationConfig:
googleapis_commitish=__required(
config, "googleapis_commitish", REPO_LEVEL_PARAMETER
),
template_excludes=__optional(config, "template_excludes", None),
grpc_version=__optional(config, "grpc_version", None),
protoc_version=__optional(config, "protoc_version", None),
libraries_bom_version=__optional(config, "libraries_bom_version", None),
Expand Down
17 changes: 0 additions & 17 deletions library_generation/test/model/generation_config_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def test_generation_config_default_value(self):
googleapis_commitish="",
libraries=[],
)
self.assertEqual([], config.template_excludes)
self.assertEqual("", config.libraries_bom_version)

def test_from_yaml_succeeds(self):
Expand All @@ -62,22 +61,6 @@ def test_from_yaml_succeeds(self):
"1a45bf7393b52407188c82e63101db7dc9c72026", config.googleapis_commitish
)
self.assertEqual("26.37.0", config.libraries_bom_version)
self.assertEqual(
[
".github/*",
".kokoro/*",
"samples/*",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.md",
"LICENSE",
"SECURITY.md",
"java.header",
"license-checks.xml",
"renovate.json",
".gitignore",
],
config.template_excludes,
)
library = config.libraries[0]
self.assertEqual("cloudasset", library.api_shortname)
self.assertEqual("Cloud Asset Inventory", library.name_pretty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@ gapic_generator_version: 2.34.0
protoc_version: 25.2
googleapis_commitish: 1a45bf7393b52407188c82e63101db7dc9c72026
libraries_bom_version: 26.37.0
template_excludes:
- ".github/*"
- ".kokoro/*"
- "samples/*"
- "CODE_OF_CONDUCT.md"
- "CONTRIBUTING.md"
- "LICENSE"
- "SECURITY.md"
- "java.header"
- "license-checks.xml"
- "renovate.json"
- ".gitignore"
libraries:
- api_shortname: cloudasset
name_pretty: Cloud Asset Inventory
Expand Down
13 changes: 0 additions & 13 deletions library_generation/test/utilities_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,19 +315,6 @@ def __get_a_gen_config(
return GenerationConfig(
gapic_generator_version="",
googleapis_commitish="",
template_excludes=[
".github/*",
".kokoro/*",
"samples/*",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.md",
"LICENSE",
"SECURITY.md",
"java.header",
"license-checks.xml",
"renovate.json",
".gitignore",
],
libraries=libraries,
)

Expand Down
15 changes: 14 additions & 1 deletion library_generation/utils/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,23 @@ def generate_prerequisite_files(

# generate owlbot.py
py_file = "owlbot.py"
template_excludes = [
".github/*",
".kokoro/*",
"samples/*",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.md",
"LICENSE",
"SECURITY.md",
"java.header",
"license-checks.xml",
"renovate.json",
".gitignore",
]
if not os.path.exists(f"{library_path}/{py_file}"):
render(
template_name="owlbot.py.j2",
output_name=f"{library_path}/{py_file}",
should_include_templates=True,
template_excludes=config.template_excludes,
template_excludes=template_excludes,
)

0 comments on commit b3cba4b

Please sign in to comment.