Skip to content
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

fix(codegen): modify generator scripts after separation of bazel rules #1351

Merged
merged 4 commits into from
Nov 21, 2022

Conversation

emmileaf
Copy link
Contributor

@emmileaf emmileaf commented Nov 21, 2022

This PR: edits generator scripts given the separation of the java_gapic_spring_library rule in googleapis/sdk-platform-java#1065 (please see its description for context of edits).

The script now makes local edits to:

  • googleapis/repository_rules.bzl (add switch)
  • google/cloud/<client_lib_name>/v1/BUILD.bazel (add rule name to load, and rule definition using similar arguments as java_gapic_library)

Note for review: the initial goal of these changes is to have something to unblock the code generation workflow, but there's currently a lot of perl mess so any suggestions on cleaner/more reliable file processing would be welcomed!

Copy link
Contributor

@zhumin8 zhumin8 left a comment

Choose a reason for hiding this comment

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

I agree on unblocking the generation workflow. So we could probably merge this in while working on improvements.
On making it more robust, I found this buildozer tool that looks neat. E.g. these two commands can achieve most of what we want building the java_gapic_spring_library rule.

# Add a new rule at the end of the file
buildozer 'new java_library foo' //pkg:__pkg__

# Copy an attribute from `protolib` to `py_protolib`.
buildozer 'copy testonly protolib' //pkg:py_protolib

Drawback is that it has dependencies on Go. But GithubAction does have https://github.com/actions/setup-go, so I guess it's not that bad.

@emmileaf
Copy link
Contributor Author

emmileaf commented Nov 21, 2022

On making it more robust, I found this buildozer tool that looks neat. E.g. these two commands can achieve most of what we want building the java_gapic_spring_library rule.

Oh buildozer does look like a better tool for handling BUILD.bazel file changes (esp. copying over attributes) - thanks for the suggestion @zhumin8 ! I’ll look into how to bring it in for our workflow, and will mark this PR as ready for review in the meanwhile.

@emmileaf emmileaf marked this pull request as ready for review November 21, 2022 16:25
generator/generate-one.sh Outdated Show resolved Hide resolved
Copy link
Contributor

@diegomarquezp diegomarquezp left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@emmileaf emmileaf merged commit 631a1af into main Nov 21, 2022
@emmileaf emmileaf deleted the codegen-bazel-split branch November 21, 2022 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants