Skip to content

Commit

Permalink
fix: change folder prefix for adding headers (#2688)
Browse files Browse the repository at this point in the history
In this PR:
- Change post processor to add header when the folder name starts with
`proto-` or `grpc-`.
- Change post processor to add pom.xml when the folder name starts with
`proto-` or `grpc-`.

Context: we received a library generation request which the library name
doesn't start with `google-` (b/329445405). The generated library has
two issues: 1) pom.xml is not generated in `proto-` folder; 2) files in
`proto-` folder have no header. This library uses REST so no `grpc-`
folder was generated.
  • Loading branch information
JoeWang1127 authored Apr 25, 2024
1 parent e2680e1 commit 4e92be8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions library_generation/owlbot/src/fix-license-headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

# Until the generator generates license headers on generated proto
# classes, add the license headers in
for path in glob.glob("proto-google-*"):
for path in glob.glob("proto-*"):
java.fix_proto_headers(root / path)

# Until the generator generates license headers on generated grpc
# classes, add the license headers in
for path in glob.glob("grpc-google-*"):
for path in glob.glob("grpc-*"):
java.fix_grpc_headers(root / path, "unused")
4 changes: 2 additions & 2 deletions library_generation/owlbot/src/fix-poms.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def main(versions_file, monorepo):
# Missing Case 2: There's a new proto-XXX and grpc-XXX directory. It's a new
# version in the proto file to a library. Both a new library and existing
# library.
for path in glob.glob("proto-google-*"):
for path in glob.glob("proto-*"):
if not path in existing_modules:
existing_modules[path] = module.Module(
group_id=__proto_group_id(group_id),
Expand Down Expand Up @@ -422,7 +422,7 @@ def main(versions_file, monorepo):
release_version=main_module.release_version,
)

for path in glob.glob("grpc-google-*"):
for path in glob.glob("grpc-*"):
if not path in existing_modules:
existing_modules[path] = module.Module(
group_id=__proto_group_id(group_id),
Expand Down

0 comments on commit 4e92be8

Please sign in to comment.