Skip to content

Document content_roots for prefix removal #138

@kriswuollett

Description

@kriswuollett

Perhaps it is just a configuration mistake, but I suspect protofetch works on the assumption that protos are stored at the root of a git repository. I'm using proto_out_dir = "protos" with the following dependency:

[grpc_health_v1]
url = "github.com/grpc/grpc"
revision = "b8a04acbbf18fd1c805e5d53d62ed9fa4721a4d1" # v1.64.0
protocol = "https"
allow_policies = ["src/proto/grpc/health/v1/*"]

Instead of finding a file at protos/grpc/health/v1/health.proto, it is actually at protos/src/proto/grpc/health/v1/health.proto. I assumed maybe protofetch had the logic to automatically strip prefixes based on the proto package name.

I tried using url = "github.com/grpc/grpc/src/proto" as a configuration option to see if something like that was undocumented, but instead I get this error:

ERROR Could not build a valid descriptor from a protofetch toml file due to err Missing url component `forge` in string `github.com/grpc/grpc/src/proto`
ERROR IO error reading configuration toml: No such file or directory (os error 2)

If one wants to compile multiple unrelated proto dependency trees at once, I believe they need to be rooted in the same directory? Is there a way I am currently supposed to use protofetch so all my dependencies could end up in the same logical & physical directory tree?

For example adding this to my config:

[envoy_api_v2]
url = "github.com/envoyproxy/envoy"
revision = "72d653e2540cc5f77e2acdc1c9a57a10263d74dc"
protocol = "https"
allow_policies = ["api/envoy/api/v2/*"]

Fetching it (155 MB cached, 53 seconds):

% time protofetch fetch
INFO Resolving github.com/grpc/grpc
INFO Resolving github.com/envoyproxy/envoy
INFO Wrote lockfile to /Users/kris/Code/appbiotic/corp/protofetch.lock
INFO Fetching dependencies source files...
INFO Copying proto files from corp descriptor...
INFO Creating new worktree for envoy_api_v2 at /Users/kris/.cache/protofetch/dependencies/envoy_api_v2/72d653e2540cc5f77e2acdc1c9a57a10263d74dc.
INFO Found existing worktree for grpc_health_v1 at /Users/kris/.cache/protofetch/dependencies/grpc_health_v1/b8a04acbbf18fd1c805e5d53d62ed9fa4721a4d1.
protofetch fetch  15.70s user 3.55s system 36% cpu 53.142 total

The QuicProtocolOptions message is inprotos/api/envoy/api/v2/listener/quic_config.proto not protos/envoy/api/v2/listener/quic_config.proto.

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