Skip to content

Expand arg locations#809

Merged
hlopko merged 31 commits intobazelbuild:mainfrom
grafica:expand_arg_locations
Jul 1, 2021
Merged

Expand arg locations#809
hlopko merged 31 commits intobazelbuild:mainfrom
grafica:expand_arg_locations

Conversation

@sayrer
Copy link
Copy Markdown
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
Comment thread rust/private/utils.bzl Outdated
@hlopko hlopko self-requested a review June 28, 2021 11:36
@hlopko
Copy link
Copy Markdown
Member

hlopko commented Jun 28, 2021

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

Comment thread rust/private/rustc.bzl Outdated
@illicitonion
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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!

Comment thread rust/private/rustc.bzl Outdated
Copy link
Copy Markdown
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?

Comment thread rust/private/utils.bzl Outdated
Comment thread rust/private/utils.bzl Outdated
Comment thread examples/flag_locations/BUILD.bazel
Comment thread rust/private/rust.bzl
Comment thread examples/flag_locations/BUILD.bazel
Comment thread examples/flag_locations/main.rs Outdated
Comment thread rust/private/rust.bzl Outdated
Comment thread rust/private/utils.bzl
Comment thread test/unit/location_expansion/location_expansion_test.bzl
Comment thread test/unit/location_expansion/mylibrary.rs Outdated
@sayrer
Copy link
Copy Markdown
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
Copy Markdown
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