-
Notifications
You must be signed in to change notification settings - Fork 61
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: add generate_library.sh
without post processing
#1916
feat: add generate_library.sh
without post processing
#1916
Conversation
This reverts commit 3d612f8.
The differences in the comparison is because the entries in However, in a recent submit (cl/536794833), This is not a source code difference and there are some approaches
@meltsufin @blakeli0 @suztomo WDYT? |
Can you take a look at the commit history? It might be manually added. |
The CL's title suggested that it's auto-generated but I think the proto file is added manually.
I think by sorting the proto files, the result is deterministic and it is also hermetic as given the same proto files and dependencies, the generated code is the same. I added an approach in my previous comment that the generator can generate the two files with sorted proto files, is that possible? If we choose to list the proto files as BUILD does, we are tied with BUILD and we need to change the list whenever a new proto files is added (or deleted) in |
This is not a sustainable approach as there could be many manual changes.
In order for us to make a decision, we need to understand the usage of
This would be the only approach if the order matters in |
The The Of course there maybe other use cases and I'll do some research. |
library_generation/README.md
Outdated
|
||
## Prerequisite | ||
In order to generate a GAPIC library, you need to pull `google/` from [googleapis](https://github.com/googleapis/googleapis) | ||
and put it into the directory containing `generate_library.sh` since protos in `google/` |
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.
We have to copy the whole google/
folder? Or maybe only the common protos?
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.
Some protos reference google/api
, google/iam
, google/type
. I'm not sure whether we have a exhausted list of protos such that only those protos can be referenced. So copy google
folder is a safe option.
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.
Not part of this PR, but I think we should come up with an exhaustive list before we switch to use it in our generation process. As google/
folder contains protos from all services, which is a lot more than what we need, and it could easily confuse people in the future.
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.
We can do that, but do we have a guidance that a proto should not reference a proto outside of a list? If not, the list is likely changing and we are back to copy google
.
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.
Theoretically, the service team can reference protos from anywhere, but cross service proto depedencies are not allowed per https://google.aip.dev/213, so the service protos should only reference common protos from a few selected folders. I think we may have two services that have cross service proto dependencies but all other services should obey it.
Now regarding common protos, we don't have a guidance on where they should be and it's possible that new common protos are added to new locations. But if it happens, I think it would be better to explicitly add it, similar to explicitly declare a new dependency
vs getting a new dependency transitively from a existing dependency
in Maven's world.
We can discuss more in next project meeting.
## An example to generate a client library | ||
``` | ||
library_generation/generate_library.sh \ | ||
-p google/cloud/confidentialcomputing/v1 \ |
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.
Can you please add comments or more examples regarding proto_path
that all protos referenced in the path has to be in the current working directory(assuming my understanding is correct from another comment)?
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 added an example of generating showcase client.
[gapic-generator-java-root] Kudos, SonarCloud Quality Gate passed! |
[java_showcase_integration_tests] Kudos, SonarCloud Quality Gate passed! |
[java_showcase_unit_tests] Kudos, SonarCloud Quality Gate passed! |
Fixes #1922 ☕️