Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Avoid repeating dependencies in cc_eventuals_library #483

Open
rjhuijsman opened this issue Jul 20, 2022 · 0 comments
Open

Avoid repeating dependencies in cc_eventuals_library #483

rjhuijsman opened this issue Jul 20, 2022 · 0 comments

Comments

@rjhuijsman
Copy link
Contributor

rjhuijsman commented Jul 20, 2022

In this file we have an example where we use cc_eventuals_library:

cc_eventuals_library(
    name = "object_store_eventuals_generated",
    srcs = [":object_store.proto"],
    deps = [
        ":object_store_proto",
        # We need to repeat all of the dependencies of `object_store_proto` here.
        # That's not very nice.
        ":location_proto",
        ":reference_proto",

The dependency on the target :object_store_proto brings in the following:

proto_library(
    name = "object_store_proto",
    srcs = [":object_store.proto"],
    visibility = ["//visibility:public"],
    deps = [
        # [...]
        ":reference_proto",
        ":location_proto",
    ],
)

As can be seen, :object_store_proto already depends on :location_proto and :reference_proto. My normal Bazel intuition is that by having :object_store_eventuals_generated depend on :object_store_proto it implicitly also depends on :location_proto and :reference_proto. However, that is not currently the case.

If I remove e.g. :location_proto from :object_store_eventuals_generated I get the following error:

ERROR: /workspaces/respect/respect/v1alpha1/BUILD.bazel:49:21: Action respect/v1alpha1/object_store.eventuals.h failed: (Exit 1): bash failed: error executing command 
  (cd /home/vscode/.cache/dazel/respect/sandbox/processwrapper-sandbox/174/execroot/com_github_reboot_dev_respect && \
  exec env - \
    CC=clang \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
  /bin/bash -c 'bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/protoc $@' '' '--plugin=protoc-gen-eventuals=bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_github_3rdparty_eventuals/protoc-gen-eventuals/protoc-gen-eventuals' --eventuals_out bazel-out/k8-fastbuild/bin -I. respect/v1alpha1/object_store.proto -I. respect/v1alpha1/reference.proto -Ibazel-out/k8-fastbuild/bin/external/com_google_protobuf/_virtual_imports/any_proto/ google/protobuf/any.proto)
# Configuration: 46a7f64f870c329619da053f6350d1d07765664ca94faddfff8d52d8343f9324
# Execution platform: @local_config_platform//:host

I would like to avoid having to re-specify all transitive dependencies when using cc_eventuals_library.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant