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

Expand arg locations #809

Merged
merged 31 commits into from
Jul 1, 2021
Merged

Expand arg locations #809

merged 31 commits into from
Jul 1, 2021

Conversation

sayrer
Copy link
Contributor

@sayrer sayrer commented Jun 27, 2021

This fixed #801 for me.

@google-cla google-cla bot added the cla: yes label Jun 27, 2021
rust/private/utils.bzl Outdated Show resolved Hide resolved
@hlopko hlopko self-requested a review June 28, 2021 11:36
@hlopko
Copy link
Member

hlopko commented Jun 28, 2021

Just a quick drive by - could you add a test?

rust/private/rustc.bzl Outdated Show resolved Hide resolved
@illicitonion
Copy link
Collaborator

Just a quick drive by - could you add a test?

An easy way to do this could be to generate in a genrule a file which sets a --cfg flag, and then pass @$(location :generated-file) as a rustc_flags value, and then assert in a main method that that cfg is set. Possibly this could conveniently live in https://github.com/bazelbuild/rules_rust/tree/main/examples/env_locations :)

@sayrer
Copy link
Contributor Author

sayrer commented Jun 28, 2021

Just a quick drive by - could you add a test?

An easy way to do this could be to generate in a genrule a file which sets a --cfg flag, and then pass @$(location :generated-file) as a rustc_flags value, and then assert in a main method that that cfg is set. Possibly this could conveniently live in https://github.com/bazelbuild/rules_rust/tree/main/examples/env_locations :)

Oh... maybe you meant I should make a separate test file. Happy to do so if it matters.

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.

Oh... maybe you meant I should make a separate test file. Happy to do so if it matters.

I personally think it's better to add a small and focused use use of this functionality to the test module but I'll defer to @hlopko on this one.

Otherwise looks good to me! 😄

Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

LGTM - thanks!

rust/private/rustc.bzl Outdated Show resolved Hide resolved
Copy link
Member

@hlopko hlopko left a comment

Choose a reason for hiding this comment

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

Thank you so so much for a solid PR. Could you update docs of rule attributes that are affected by this PR to mention that macros are expanded?

rust/private/utils.bzl Outdated Show resolved Hide resolved
rust/private/utils.bzl Outdated Show resolved Hide resolved
examples/flag_locations/BUILD.bazel Show resolved Hide resolved
examples/flag_locations/BUILD.bazel Show resolved Hide resolved
examples/flag_locations/main.rs Outdated Show resolved Hide resolved
rust/private/rust.bzl Outdated Show resolved Hide resolved
rust/private/utils.bzl Show resolved Hide resolved
test/unit/location_expansion/mylibrary.rs Outdated Show resolved Hide resolved
@sayrer
Copy link
Contributor Author

sayrer commented Jul 1, 2021

It looks to me like the only issues remaining here might be small documentation / test changes, although I think I've resolved all of the comments.

I don't feel strongly about any of them, so I'd suggest merging this and then changing any of those things in a follow-up, rather than leaving comments here. That will make it easier to work on a California vs. Munich schedule.

Copy link
Member

@hlopko hlopko left a comment

Choose a reason for hiding this comment

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

Thank you so much! Looks great to me!

@hlopko hlopko merged commit 4bf51b3 into bazelbuild:main Jul 1, 2021
@sayrer sayrer deleted the expand_arg_locations branch July 1, 2021 20:39
@sayrer sayrer restored the expand_arg_locations branch July 1, 2021 20:39
@sayrer sayrer deleted the expand_arg_locations branch July 2, 2021 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

What's the best way to vary crate_features?
4 participants