protofetch icon indicating copy to clipboard operation
protofetch copied to clipboard

Clarification of correct use of `transitive` dependencies and well-known `google` dependencies

Open gshuflin opened this issue 2 years ago • 1 comments

My organization has a number of protobuf files in repo G of the form:

syntax = "proto3";

import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "common/v1/common.proto";

<further content>

Here, common refers to another repo in our organization containing a set of common protobuf files, and google is well-known Google protobufs that we don't have locally at all.

The protofetch.toml file for my project looks like:

name = "my-project"
description = "my-description"
proto_out_dir = "protos"

[G]
protocol = "https"
url = "github.com/my-org/G-repo"
branch = "main"
prune = true

[common]
protocol = "https"
url = "github.com/my-org/common-repo"
branch = "main"
transitive = true

When I run protobuf fetch, protofetch is able to successfully pull protofetch files from the G repo; but it is not able to discover that the import "common/v1/common.proto" lines in those files correspond to protobuf files contained in the common repo, despite the transitive = true flag. Instead, protofetch looks for those common protobuf within the G repo and exits with an error when it can't find them. I'm also having trouble understanding how the prune and transitive options are intended to be used from the README documentation.

Additionally, I also can't see any way to tell protofetch to avoid trying to find the google protobufs itself at all. Our protobuf-building code is capable of fetching those from Google itself, so it would be fine if protofetch could completely ignore them, rather than trying and failing to find them and then exiting with an error.

gshuflin avatar Sep 11 '23 22:09 gshuflin

Transitive and prune are poorly designed and confusing. They need to be re-implemented. For the case you are mentioning I don't think you need to use either

saraiva132 avatar Sep 24 '23 21:09 saraiva132