grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.57k stars 763 forks source link

bazel and nested deps crash build process #744

Closed gattytto closed 3 months ago

gattytto commented 4 years ago

I am using googleapis as a base to my project and I have this bazel rule:

proto_library(
    name = "product_proto",
    srcs = [
        "product.proto",
    ],
    deps = [
        "@com_google_googleapis//google/api:annotations_proto",
    ],
)

and then I have added this to my generated BUILD bazel file for the grpc_web lib:

load("@com_github_grpc_grpc_web//bazel:closure_grpc_web_library.bzl", "closure_grpc_web_library")
closure_grpc_web_library(
    name = "product_web_lib",
    deps = [
        ":product_proto",
    ]
)

after trying to build the "product_web_lib" target I get this:

ERROR: /projects/gopos/gopos/product/v1alpha1/BUILD.bazel:169:1: Generating GRPC Web product .grpc.js failed (Exit 1) process-wrapper failed: error executing command (cd /home/theia/.cache/bazel/_bazel_user/89380f62e48dd36cf68d64cb2e93a9c4/sandbox/processwrapper-sandbox/188/execroot/com_gopos_crudapis && \ exec env - \ TMPDIR=/tmp \ /home/theia/.cache/bazel/_bazel_user/install/5ebf8b49e779fb106d5801ee55f0fd49/process-wrapper '--timeout=0' '--kill_delay=15' bazel-out/host/bin/external/com_google_protobuf/protoc -I. -I. -Iexternal/com_google_googleapis -Iexternal/com_google_googleapis -Ibazel-out/k8-fastbuild/bin/external/com_google_protobuf '--plugin=protoc-gen-grpc-web=bazel-out/host/bin/external/com_github_grpc_grpc_web/javascript/net/grpc/web/protoc-gen-grpc-web' '--grpc-web_out=import_style=closure,mode=grpcwebtext,out=product.grpc.js:bazel-out/k8-fastbuild/bin/gopos/product/v1alpha1' gopos/product/v1alpha1/product.proto) google/protobuf/descriptor.proto: File not found. google/api/annotations.proto:20:1: Import "google/protobuf/descriptor.proto" was not found or had errors. google/api/annotations.proto:28:8: "google.protobuf.MethodOptions" is not defined. gopos/product/v1alpha1/product.proto:5:1: Import "google/api/annotations.proto" was not found or had errors. Target //gopos/product/v1alpha1:product_web_lib failed to build INFO: Elapsed time: 0.137s, Critical Path: 0.02s INFO: 0 processes. FAILED: Build did NOT complete successfully

so it seems like nested dependencies, in this case google/protobuf:descriptor_proto does not get detected and is not included in the "external/" folder in the folder that bazel creates for the build process.

how can I overcome this?

sampajano commented 3 months ago

Hi :) Closing due to being obsolescence — closure_grpc_web_library was cleaned up #1138. Thanks for the discussion :)