-
Notifications
You must be signed in to change notification settings - Fork 502
Add option to set custom proto path #1920
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
base: main
Are you sure you want to change the base?
Conversation
|
Thanks for opening this PR. Just for my understanding this is a convenience and you could achieve the same with the current options by just passing the full path in the |
|
@FranzBusch Unfortunately not. The issue is when the protofiles use and |
FranzBusch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM! @glbrntt can you check if that makes sense for the gRPC plugin as well?
| /// Whether import statements should be preceded with visibility. | ||
| var useAccessLevelOnImports: Bool? | ||
| /// Overrides the path to look for protobuf files | ||
| var protoPath: String? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should likely be an array rather than a String as you can specify -I/--proto_path multiple times to protoc.
Given the example in the PR description it's not hard to imagine multiple git submodules being added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea, I changed it to array 👍
|
@glbrntt @FranzBusch In terms of using Consider: using {
"invocations": [
{
"protoFiles": [
"file1.proto",
"file2.proto",
"file3.proto",
"file4.proto"
],
"visibility": "public",
"protoPaths": ["proto_repo_submodule1/protos", "proto_repo_submodule2/protos"]
}
]
}we need to pass the
Alternatively, we should just provide the |
Allows the developer to supply a custom directory that will be used as the base of the protofiles.
{ "invocations": [ { "protoFiles": [ "file1.proto", "file2.proto", ], "visibility": "public", "protoPath": "proto_repo_submodule/protos" } ] }This is useful if you are storing protofiles inside a Git repo and adding that as a submodule to other repos. Giving you a directory structure like:
and any proto files will be importing other proto files relative to that "protos" directory:
such as in file1.proto