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

Generate only the needed subset of binaries for bindgen and proto #1751

Merged
merged 1 commit into from
Jan 4, 2023

Conversation

dtolnay
Copy link
Contributor

@dtolnay dtolnay commented Jan 4, 2023

This removes, for example, the protobuf-bin-gen-rust-do-not-use binary that was previously getting exposed.

alias(
name = "protobuf-codegen__protobuf-bin-gen-rust-do-not-use",
actual = "@rules_rust_proto__protobuf-codegen-2.8.2//:protobuf-bin-gen-rust-do-not-use__bin",
tags = ["manual"],
)

I had to change impl Add for CrateAnnotations to make crate-level gen_binaries work. It turns out in #1718 I didn't fully understand what this Add impl was supposed to do, and I had only tested gen_binaries before adding the global-level generate_binaries argument (#1718 (comment)). (I'm still not sure that I understand what this Add is supposed to do exactly, but at least now it appears to work in practice.)

The behavior I observed before the change in this PR was that global-level generate_binaries = True would do the right thing but crate-level gen_binaries would seem to get ignored whether or not global-level generate_binaries was set.

@dtolnay dtolnay marked this pull request as ready for review January 4, 2023 18:30
Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You’re doing the lord’s work here. Thank you so much!

@UebelAndre UebelAndre merged commit 7ebad4d into bazelbuild:main Jan 4, 2023
@dtolnay dtolnay deleted the specificbinaries branch January 4, 2023 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants