Skip to content

Commit 6f69363

Browse files
authored
bazel: Migrate java_grpc_library to use DefaultInfo (#12148)
We here address the following obstacles in grpc-java to using Bazel's --incompatible_disable_target_default_provider_fields flag: ``` ERROR: /private/var/tmp/_bazel_dws/7fd3cd5077fbf76d9e2ae421c39ef7ed/external/googleapis+/google/devtools/build/v1/BUILD.bazel:81:18: in _java_grpc_library rule @@googleapis+//google/devtools/build/v1:build_java_grpc: Traceback (most recent call last): File "/private/var/tmp/_bazel_dws/7fd3cd5077fbf76d9e2ae421c39ef7ed/external/grpc-java+/java_grpc_library.bzl", line 94, column 30, in _java_rpc_library_impl args.add(toolchain.plugin.files_to_run.executable, format = "--plugin=protoc-gen-rpc-plugin=%s") Error: Accessing the default provider in this manner is deprecated and will be removed soon. It may be temporarily re-enabled by setting --incompatible_disable_target_default_provider_fields=false. See bazelbuild/bazel#20183 for details. ERROR: /private/var/tmp/_bazel_dws/7fd3cd5077fbf76d9e2ae421c39ef7ed/external/googleapis+/google/devtools/build/v1/BUILD.bazel:81:18: Analysis of target '@@googleapis+//google/devtools/build/v1:build_java_grpc' failed ERROR: Analysis of target '//src:bazel' failed; build aborted: Analysis failed ```
1 parent 6cc2ff1 commit 6f69363

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

java_grpc_library.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ def _java_rpc_library_impl(ctx):
9191
srcjar = ctx.actions.declare_file("%s-proto-gensrc.jar" % ctx.label.name)
9292

9393
args = ctx.actions.args()
94-
args.add(toolchain.plugin.files_to_run.executable, format = "--plugin=protoc-gen-rpc-plugin=%s")
94+
args.add(toolchain.plugin[DefaultInfo].files_to_run.executable, format = "--plugin=protoc-gen-rpc-plugin=%s")
9595
args.add("--rpc-plugin_out={0}:{1}".format(toolchain.plugin_arg, srcjar.path))
9696
args.add_joined("--descriptor_set_in", descriptor_set_in, join_with = ctx.configuration.host_path_separator)
9797
args.add_all(srcs, map_each = _path_ignoring_repository)
9898

9999
ctx.actions.run(
100-
inputs = depset(srcs, transitive = [descriptor_set_in, toolchain.plugin.files]),
100+
inputs = depset(srcs, transitive = [descriptor_set_in, toolchain.plugin[DefaultInfo].files]),
101101
outputs = [srcjar],
102-
executable = toolchain.protoc.files_to_run,
102+
executable = toolchain.protoc[DefaultInfo].files_to_run,
103103
arguments = [args],
104104
use_default_shell_env = True,
105105
toolchain = None,

0 commit comments

Comments
 (0)