Comments (2)
I'm having the same issue. Is there a fix or workaround?
from rules_proto.
A few issues here:
-
The default behavior of the rules is to compile all protos at once. This has the benefit of being able to generate artifacts for the entire transitive proto dependency tree. It has disadvantages too, including the one(s) detailed here. This can be controlled by the
transitive = False
rule attribute. It's entirely possible thattransitive = True
is a misguided default value and that the default should beFalse
. Note that the gogo rules were not propagating this attribute which is now fixed by #50. -
One can do importmapping via the
importmap
dict attribute (not exactly well-documented). Here's the diff on your example repo that I used to get this to compile:
diff --git a/WORKSPACE b/WORKSPACE
index 456e1bf..6616ebf 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -16,9 +16,9 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_stack_rules_proto",
- sha256 = "36f11f56f6eb48a81eb6850f4fb6c3b4680e3fc2d3ceb9240430e28d32c47009",
- strip_prefix = "rules_proto-d86ca6bc56b1589677ec59abfa0bed784d6b7767",
- urls = ["https://github.com/stackb/rules_proto/archive/d86ca6bc56b1589677ec59abfa0bed784d6b7767.tar.gz"],
+ urls = ["https://github.com/stackb/rules_proto/archive/91cbae9bd71a9c51406014b8b3c931652fb6e660.tar.gz"],
+ sha256 = "5474d1b83e24ec1a6db371033a27ff7aff412f2b23abba86fedd902330b61ee6",
+ strip_prefix = "rules_proto-91cbae9bd71a9c51406014b8b3c931652fb6e660",
)
load("@build_stack_rules_proto//github.com/gogo/protobuf:deps.bzl", "gogo_proto_compile", "gogo_proto_library")
diff --git a/bar/BUILD.bazel b/bar/BUILD.bazel
index 6d59081..40b833b 100644
--- a/bar/BUILD.bazel
+++ b/bar/BUILD.bazel
@@ -24,9 +24,14 @@ gogo_proto_library(
name = "bar_go_proto",
go_deps = [
"@com_github_gogo_protobuf//gogoproto:go_default_library",
+ "//foo:foo_go_proto",
],
importpath = "github.com/jf647/stackb_example/bar",
+ importmap = {
+ "foo/foo.proto": "github.com/jf647/stackb_example/foo",
+ },
deps = [
":bar_proto",
],
+ transitive = False,
)
diff --git a/foo/BUILD.bazel b/foo/BUILD.bazel
index fae9e0d..317b971 100644
--- a/foo/BUILD.bazel
+++ b/foo/BUILD.bazel
@@ -29,4 +29,6 @@ gogo_proto_library(
deps = [
":foo_proto",
],
+ visibility = ["//bar:__pkg__"],
+ verbose = 3,
)
from rules_proto.
Related Issues (20)
- `proto_gazelle()` failed to use `config.yaml` HOT 5
- Some deps will not be resolved if run for only a dir HOT 1
- grpc server reflection failed in golang HOT 1
- WorkspaceSnippet is ignored in deps gen HOT 2
- Migrate to new rules_js/aspect_rules_ts? HOT 3
- rules_proto & rules_go problems / general dependency problems HOT 1
- checksum changed for `rules_proto` and dependencies HOT 1
- question: could you pinpoint the protoc version of this repository compared to bazelbuild/rules_proto? HOT 1
- bzlmod support HOT 4
- No such package '@com_github_grpc_grpc// HOT 1
- Bad syntax for proto_repository_tools_srcs.bzl HOT 3
- Publish a new release? HOT 2
- Support for rules_go 0.41.0 and gazelle 0.32.0
- proto_gazelle is not gathering up all data for runfiles
- fatal error: concurrent map read and map write HOT 4
- proto_compile_assets not working when strip_import_prefix is used HOT 3
- imports calculation for proto_py_library is broken
- Document starlark API better
- gazelle <0.35 no longer supported HOT 2
- error loading package '@build_stack_rules_proto//': cannot load '//rules:proto_gazelle.bzl' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rules_proto.