Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

proto_lang_toolchain does not exclude blacklisted_protos #11498

Closed
bsravanin opened this issue May 27, 2020 · 3 comments
Closed

proto_lang_toolchain does not exclude blacklisted_protos #11498

bsravanin opened this issue May 27, 2020 · 3 comments
Labels
team-Rules-Server Issues for serverside rules included with Bazel type: bug untriaged

Comments

@bsravanin
Copy link

Description of the problem / feature request:

proto_lang_toolchain does not exclude blacklisted_protos

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Our setup does something like this:

proto_library(
    name = "all_wkt_proto",
    deps = [
        "@com_google_protobuf//:any_proto",
        "@com_google_protobuf//:api_proto",
        "@com_google_protobuf//:compiler_plugin_proto",
        "@com_google_protobuf//:descriptor_proto",
        "@com_google_protobuf//:duration_proto",
        "@com_google_protobuf//:empty_proto",
        "@com_google_protobuf//:field_mask_proto",
        "@com_google_protobuf//:source_context_proto",
        "@com_google_protobuf//:struct_proto",
        "@com_google_protobuf//:timestamp_proto",
        "@com_google_protobuf//:type_proto",
        "@com_google_protobuf//:wrappers_proto",
    ],
)

proto_lang_toolchain(
    name = "java_toolchain",
    blacklisted_protos = [":all_wkt_proto"],
    command_line = "--java_out=$(OUT)",
    runtime = <point to a local copy of https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java-util/3.12.1/protobuf-java-util-3.12.1.jar>,
)

When we run https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/rules/java/OneVersionCheckActionBuilder.java on the built jar, we are seeing one-version violations on all the @@com_google_protobuf protos for releases newer than 2.1.0.

What operating system are you running Bazel on?

OS X

What's the output of bazel info release?

release 3.2.0rc1. I am also getting the same error on releases 2.2.0, 3.0.0, and 3.1.0. Not on release 2.1.0.

Have you found anything relevant by searching the web?

The following issues seem related, but I couldn't understand whether this is a duplicate of those, especially considering the release versions:
#10484
#10590

@jin jin added team-Rules-Server Issues for serverside rules included with Bazel type: bug untriaged labels May 27, 2020
@jin
Copy link
Member

jin commented May 27, 2020

FYI @Yannic

@Yannic
Copy link
Contributor

Yannic commented May 27, 2020

This is caused by the (regrettable) difference between ProtoInfo#getDirectProtoSources() and ProtoInfo#getOriginalDirectProtoSources() [1]. Depending on the version of Protobuf, this is probably broken since Bazel 1.0 (around Protobuf < 3.9.x) or even earlier Bazel versions (Protobuf > 3.10.x).

Also, there may be a problem if a deps only (alias/facade) library is blacklisted. cc_proto_library already blacklists the transitive (original) sources because of that.

I'll send a fix.

[1] https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoAspect.java;l=267;drc=b100b1d65f45864efb8e9855cdce6e3de2deec66

@bsravanin
Copy link
Author

Hi. Is there any update on this issue? I noticed an open pull request.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Rules-Server Issues for serverside rules included with Bazel type: bug untriaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants