rules-proto-grpc / rules_proto_grpc

Bazel rules for building Protobuf and gRPC code and libraries from proto_library targets
https://rules-proto-grpc.com
Apache License 2.0
249 stars 156 forks source link

Dependencies of `com_github_grpc_grpc` are not loaded #291

Closed shs96c closed 9 months ago

shs96c commented 10 months ago

Issue Description

After loading //:repositories.bzl and calling rules_proto_grpc_repos, dependencies required by com_github_grpc_grpc are not loaded, notably build_bazel_rules_apple, which is used by grpc_build_system.bzl.

All the deps would be loaded properly if @com_github_grpc_grpc//bazel:grpc_dep.bzl was loaded and grpc_deps() called.

Log Output

$ bazel build //proto:amazing_python_grpc                                                                                                                                                                                                  
WARNING: Ignoring JAVA_HOME, because it must point to a JDK, not a JRE.
(14:19:09) INFO: Invocation ID: 3a397c32-9ccc-4c62-83bb-835c4f1fef99
(14:19:09) INFO: Current date is 2023-10-20
(14:19:09) ERROR: /private/var/tmp/_bazel_foo/4a6b5fb4d43043438536c2ea44abe23c/external/com_github_grpc_grpc/src/python/grpcio/grpc/BUILD.bazel:97:11: error loading package '@com_github_grpc_grpc//': at /private/var/tmp/_bazel_foo/4a6b5fb4d43043438536c2ea44abe23c/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl:35:6: Unable to find package for @build_bazel_rules_apple//apple/testing/default_runner:ios_test_runner.bzl: The repository '@build_bazel_rules_apple' could not be resolved: Repository '@build_bazel_rules_apple' is not defined. and referenced by '@com_github_grpc_grpc//src/python/grpcio/grpc:grpcio'
(14:19:09) ERROR: Analysis of target '//proto:amazing_python_grpc' failed; build aborted:
(14:19:09) INFO: Elapsed time: 0.096s
(14:19:09) INFO: 0 processes.
(14:19:09) FAILED: Build did NOT complete successfully (38 packages loaded, 0 targets configured)

rules_proto_grpc Version

4.3.0

Bazel Version

6.3.2

OS

macOS

Link to Demo Repo

No response

WORKSPACE Content

No response

BUILD Content

No response

Proto Content

No response

Any Other Content

No response

aaliddell commented 10 months ago

Yes you need to add those dependencies as documented in the per-lang docs: https://rules-proto-grpc.com/en/latest/lang/python.html#python-grpc-library. These have to be done by you at top level WORKSPACE, since we cannot both declare a dependency and load from it within rules_proto_grpc_repos or similar.

bbstilson commented 7 months ago

@aaliddell I'm sorry, but where are these extra dependencies documented? There don't seem to be any mention of additional dependency requirements on the link you shared. Is it the extra_deps()? Searching for the exact missing dependency yields 0 results: https://rules-proto-grpc.com/en/4.5.0/search.html?q=build_bazel_rules_apple&check_keywords=yes&area=default#

aaliddell commented 7 months ago

In the workspace section of the 4.5.0 docs there's a load and call to the extra deps: https://rules-proto-grpc.com/en/4.5.0/lang/python.html#id21

load("@rules_proto_grpc//python:repositories.bzl", rules_proto_grpc_python_repos = "python_repos")

rules_proto_grpc_python_repos()

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")

grpc_deps()

load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")

grpc_extra_deps()