Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Allow generated pb2 files to be included in googleapis-gen #1854

@parthea

Description

@parthea

The generated pb2 files for google.type don't appear in googleapis-gen here
https://github.com/googleapis/googleapis-gen/tree/master/google/type

The issue is that pb2 files are not included in the generated package created by bazel.

In the _py_gapic_src_pkg_impl function, we're only including directories and files with extension srcjar, jar and zip

if f.is_directory:
dir_srcs.append(f)
elif f.extension in ("srcjar", "jar", "zip"):
srcjar_srcs.append(f)

As a test, add the following code to BUILD.bazel and run bazel build //google/type:google-type-py

py_gapic_assembly_pkg(
    name = "google-type-py",
    deps = [
        ":calendar_period_py_proto",
    ],
)

Notice the _pb2 files aren't included in the generated package located in 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/3/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.453s, 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/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions