-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
…ror toolchain (#1030) * move ast_plus_one_deps_strict_deps_unused_deps_error to //scala package also mention it in readme * add e2e tests to use ast_plus_one_deps_strict_deps_unused_deps_error * fix lint * rename ast_plus_one_deps_strict_deps_unused_deps_error to minimal_direct_source_deps
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,9 @@ scala_library( | |
scala_library( | ||
name = "scalapb_generator_lib", | ||
srcs = ["ScalaPBGenerator.scala"], | ||
unused_dependency_checker_ignored_targets = [ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ittaiz
Author
Member
|
||
"//external:io_bazel_rules_scala/dependency/com_google_protobuf/protobuf_java", | ||
], | ||
visibility = ["//visibility:public"], | ||
runtime_deps = [ | ||
"//external:io_bazel_rules_scala/dependency/com_google_protobuf/protobuf_java", | ||
|
@ittaiz here is what I think is happening
So when using plus one mode, then removing this dependency from deps works. But when using direct mode, it gives a compile error that something is missing. So +1 must be bringing in some dependency.
I suspect this is via the
//src/java/io/bazel/rulesscala/worker
which then depends on//third_party/bazel/src/main/protobuf:worker_protocol_java_proto
but am not 100% sure. (mainly I think this because I couldn't find any other deps of deps)I could not find a reference in the source code to com.google stuff which makes me suspect this is a case where we correctly identify the dep as unused in source code, and that when using +1 things just work (-ish, because not sure that we are getting the dependency correctly).
Am not fully sure why scalac needs the dependency but possibly it is the mention of
ScalaPbCodeGenerator
in ScalaPBGenerator.scala, which then here https://github.com/scalapb/ScalaPB/blob/master/compiler-plugin/src/main/scala/scalapb/ScalaPbCodeGenerator.scala has referencescom.google.protobuf.ExtensionRegistry
in the interface, which would be provided by//external:io_bazel_rules_scala/dependency/com_google_protobuf/protobuf_java
(is my guess).So maybe the
"//external:io_bazel_rules_scala/dependency/proto/scalapb_plugin"
(if that is the right dep which givesScalaPbCodeGenerator
) should declare a deps on//external:io_bazel_rules_scala/dependency/com_google_protobuf/protobuf_java
.Though that doesn't solve the problem which is that when using direct we need the dep but when using +1 we don't need it and it is unused.