Please add proto_library attrs to adjust its "virtual path"
See original GitHub issueWhen a .proto file contains import "foo/bar/baz.proto"
, that path doesn’t actually have to exist as-is on the filesystem. It can be mapped to any arbitrary path by protoc by using an equals sign in --proto_path
: protoc --proto_path=foo/bar/baz.proto=some/other/path.proto
.
Please add attributes to proto_library()
to adjust the virtual path used to locate its source proto, similar to how cc_library()
allows changing the include path. Good attributes would be:
import_prefix
to add a prefix to the virtual path.strip_import_prefix
to remove a prefix from the virtual path.
The main use case is cross-repo includes, where we want to use nice short names in the filesystem but URL-prefixed names in the import paths:
# ./external/base/proto/BUILD
proto_library(
name = "build_info",
srcs = ["build_info.proto"],
import_prefix = "github.com/myorg/base",
)
# ./proto/BUILD
proto_library(
name = "helloworld",
srcs = ["helloworld.proto"],
deps = ["@base//proto:build_info],
)
# CURRENT ./proto/helloworld.proto
import "proto/build_info.proto";
# DESIRED ./proto/helloworld.proto
import "github.com/myorg/base/proto/build_info.proto";
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:24 (18 by maintainers)
Top Results From Across the Web
TFS Build release IIS Deployment Virtual path should begin ...
Please check the settings with the step IIS Web App Manage. Seems you did not set the Virtual path correctly. Virtual path:.
Read more >Configuring a Virtual Path
Note: A virtual path is a relative path that represents the actual mapped path to the physical file location. Virtual Path example: Loading...
Read more >question about virtual paths in UI for ASP.NET AJAX - Telerik
Yes, this is possible - RadFileExplorer works with virtual folders. You just need to set the corresponding virtual path in the configuration. for...
Read more >There is something about "Paths" for Asp.net beginners
Naturally, the server controls also have corresponding attributes that accepts the path values as relative URLs, and, set those into the ...
Read more >JBoss 6 Virtual Directory-Virtual Path
jsf , I have to include a xml file which is in Jboss data dir. I think I have to create a virtual/mapping...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi there; just to chime in - this issue is preventing us vendoring proto libraries which depend on other proto libraries in go projects - see bazelbuild/rules_go#900. A good example is the go Kubernetes Client library. Is there any chance someone might work on this any time soon, or should I take a stab?
Any chance this could be implemented soon?
This blocks Kubernetes and a number of related projects from using
proto_library
. They are having to pre-generate code with a separate system and check it in.