-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat: Support numeric enums: BUILD file updates, new Go BUILD files #111
Conversation
This commit contains two changes: 1. When updating BUILD files, any pre-existing values of the `rest_numeric_enums` parameter will be preserved. This feature will be enabled for each language as they add support for that parameter in BUILD.bazel.gapic_api.mustache, which they'lltypically do in separate CLs once they implement the parameter in their BUILD rule definition. 2. We also add support for `rest_numeric_enums` in BUILD.bazel.gapic_api.mustache for Go, since that will be the first language where the feature will be rolled out. As much as we would have preferred to have these be separate commits, they are entangled by the fact that testing (1) requires changes to the template for one language, which is why we are doing (2) at the same time.
// Multiple languages: | ||
PRESERVED_PROTO_LIBRARY_STRING_ATTRIBUTES.put("package_name", null); | ||
PRESERVED_PROTO_LIBRARY_STRING_ATTRIBUTES.put("transport", null); | ||
PRESERVED_PROTO_LIBRARY_STRING_ATTRIBUTES.put("rest_numeric_enums", "False"); |
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.
would it be a string "False"
, or a boolean False
? I feel there is a possibility of an inconsistency here.
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.
Or, if I'm guessing correctly, for a string, it should be "\"False\""
?
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.
After looking at the remaining code, I must say it is still unclear to me. Would it be possible to inspect the actual content of the build file that had False
value added? Something tells me that it would be a string "False"
rather than a boolean.
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.
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.
Definitely a boolean False
.
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
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 from Go side
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
This helps ensure that updated parameters are quoted or not, as expected. Note that with this commit, updated values of rest_numeric_enums are quoted, which is incorrect. TODO next: Fix this
The renaming makes it explicit they operate on string values.
The "overrides" (i.e. preserving previous values in the BUILD file) were always inserting values as strings. Fixed that and added tests. PTAL. |
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, thank you for fixing the non-string case!
This commit contains two changes:
When updating BUILD files, any pre-existing values of the
rest_numeric_enums
parameter will be preserved. This feature willbe enabled for each language as they add support for that parameter
in
BUILD.bazel.gapic_api.mustache
, which they'll typically do inseparate CLs once they implement the parameter in their BUILD rule
definition.
We also add support for
rest_numeric_enums
inBUILD.bazel.gapic_api.mustache
for Go, since that will be the firstlanguage where the feature will be rolled out.
As much as we would have preferred to have these be separate commits,
they are entangled by the fact that testing (1) requires changes to
the template for one language, which is why we are doing (2) at the
same time.