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: allow pb2 files to be included in the output of py_gapic_assembly_pkg #1855

Merged
merged 4 commits into from
Nov 9, 2023

Conversation

parthea
Copy link
Contributor

@parthea parthea commented Nov 9, 2023

This PR is needed to unblock googleapis/python-api-common-protos#3.

Fixes #1854 🦕

To validate the changes,

  1. Check out the code in this branch
  2. In the WORKSPACE file of googleapis/googleapis, make the following change
#http_archive(
#    name = "gapic_generator_python",
#    strip_prefix = "gapic-generator-python-%s" % _gapic_generator_python_version,
#    urls = ["https://github.com/googleapis/gapic-generator-python/archive/v%s.zip" % _gapic_generator_python_version],
#)
local_repository (
  name = "gapic_generator_python",
  path = "<absolute path to your clone of gapic-generator-python>",
)
  1. Add the following code to BUILD.bazel
  2. Run bazel build //google/type:google-type-py
py_gapic_assembly_pkg(
    name = "google-type-py",
    deps = [
        ":calendar_period_py_proto",
    ],
)
  1. Confirm that pb2 files appear in the tar file at <path to googleapis>/bazel-bin/google/type/google-type-py.tar.gz
(py31013) partheniou@partheniou-vm-3:~/git/googleapis$ bazel build //google/type:google-type-py
INFO: Analyzed target //google/type:google-type-py (1 packages loaded, 4 targets configured).
INFO: Found 1 target...
INFO: From Action google/type/google-type-py.tar.gz:
tar: google-type-py: file changed as we read it
/usr/local/google/home/partheniou/.cache/bazel/_bazel_partheniou/9063cec94a6a99d93035235cd3e5a885/sandbox/linux-sandbox/4/execroot/com_google_googleapis
Target //google/type:google-type-py up-to-date:
  bazel-bin/google/type/google-type-py.tar.gz
INFO: Elapsed time: 0.328s, Critical Path: 0.04s
INFO: 2 processes: 1 internal, 1 linux-sandbox.
INFO: Build completed successfully, 2 total actions
(py31013) partheniou@partheniou-vm-3:~/git/googleapis$ tar -tf bazel-bin/google/type/google-type-py.tar.gz
google-type-py/
google-type-py/calendar_period_pb2.py

@parthea parthea requested a review from a team as a code owner November 9, 2023 14:49
@product-auto-label product-auto-label bot added the size: xs Pull request size is extra small. label Nov 9, 2023
@product-auto-label product-auto-label bot added size: s Pull request size is small. and removed size: xs Pull request size is extra small. labels Nov 9, 2023
@parthea parthea enabled auto-merge (squash) November 9, 2023 15:27
@parthea parthea merged commit e374734 into main Nov 9, 2023
52 checks passed
@parthea parthea deleted the add-pb2-to-pkg-assembly branch November 9, 2023 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow generated pb2 files to be included in googleapis-gen
2 participants