-
Notifications
You must be signed in to change notification settings - Fork 319
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
Conversation
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.
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.
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. |
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.
LGTM
Kudos, SonarCloud Quality Gate passed! |
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 asjava_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!