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

feat(bazel): support generation with x-api deps #138

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

noahdietz
Copy link
Contributor

Support BUILD.bazel file generation with cross-API dependencies. Such a dependency is identified by the presence of a version in the import path e.g. google/cloud/foo/v1/bar.proto, which would normally be converted into a dependency label like google/cloud/foo/v1:bar_proto. However, generated BUILD.bazel files in googleapis have proto_library targets that represent the entire package rather than one target per-proto-file. So, the API package is parsed out of the import path and used as the replacement in the label e.g. google/cloud/foo/v1:foo_proto.

Note: This implementation generates a py_proto_library dependency that will not have been generated into the dependency package and must be added manually. This can be fixed when py_gapic_library targets can be used in their place (something @parthea has mentioned wanting to fix for this specific x-api dep scenario).

Fixes http://b/269312831.

@noahdietz
Copy link
Contributor Author

Just a friendly bump on this @alexander-fenster and @parthea. Tony, I'd love your take on how this will impact/how this could aid Python GAPIC generation & the migration of py_proto_library to py_gapic_library targets.

@noahdietz
Copy link
Contributor Author

@alexander-fenster could you review this when you have a chance please? Thanks

@parthea
Copy link

parthea commented Mar 31, 2023

@noahdietz py_gapic can now be used as a dependency instead of py_proto for python. I found that the dependency needs to be imported with py_import first.

See cl/520334574 as an example

@noahdietz
Copy link
Contributor Author

@noahdietz py_gapic can now be used as a dependency instead of py_proto for python. I found that the dependency needs to be imported with py_import first.

Wonderful! I will adjust this PR accordingly.

@noahdietz
Copy link
Contributor Author

@parthea sounds like we can resolve #46 too in a way. I think I will do this in a separate CL and have this one gated on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants