Skip to content

Protobuf sources does not work with parametrized resolves #21409

Open
@omri-cavnue

Description

@omri-cavnue

Describe the bug
When introducing multiple resolves into the repo, all of the python sources and test targets seem to work. However, the protobuf_sources does not work against multiple resolves. On a single resolve, the target works. But when parametrizing against multiple resolves, it complains about proto files not being found when they are imported into other proto files.

Pants version
2.21.0

OS
Both mac and linux

Additional info
The repo structure is similart to:

   ├── proto
    | └── messages
    │    └── example
    │       └── v1
    │           └── person.proto
         └── example_2
            └── v1
    │           └── dog.proto
    | └── BUILD
   ├── python
    | └── packages
    │    └── messages
    |         └── src

Here, the dog.proto would import person.proto to identify an owner.

syntax = "proto3";
package messages.example_v2.v1;
import "messages/example/v1/owner.proto";

message Dog {
   string name = 1;
   example.v1.Person owner = 2;
}

and it complains about messages/example/v1/person.proto File not found.
The BUILD file is as follows:

protobuf_sources(
    name = "protos",
    python_source_root = "python/packages/messages/src",
    sources = ["messages/**/*.proto"],
    python_resolve = parametrize("core", "dev"),
)

With one resolve, this works as expected. With multiple resolves, it complains that the person.proto file is not found when trying to create python sources for the dog proto

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions