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

Make rust analyzer aspect follow rust_test.crate attribute #751

Merged
merged 6 commits into from
Jun 9, 2021

Conversation

hlopko
Copy link
Member

@hlopko hlopko commented May 20, 2021

Before, generated rust-project.json did not contain dependencies from the rust_library when rust_test used .crate attribute and the test was the only root in the targets attribute of rust_analyzer rule.

This PR depends on #754 and #760.

@google-cla google-cla bot added the cla: yes label May 20, 2021
@hlopko hlopko force-pushed the fix_rust_analyzer branch 2 times, most recently from 2515d40 to a82d193 Compare May 27, 2021 09:17
@hlopko hlopko changed the title Use crate_info.deps and others instead of ctx.rule.attr.deps in rust analyzer aspect Make rust analyzer aspect follow rust_test.crate attribute May 27, 2021
@hlopko
Copy link
Member Author

hlopko commented May 27, 2021

CC @djmarcin

@hlopko hlopko marked this pull request as ready for review May 27, 2021 10:28
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.

Sorta feels like there's two changes here? They seem good but curious as to what brought on the harness attribute.

Oops, there's another PR 😅

But yeah, was it necessary for this or just a nicety?

rust/private/rust.bzl Outdated Show resolved Hide resolved
test/rust_analyzer/BUILD.bazel Outdated Show resolved Hide resolved
test/unit/rust_analyzer/rust_analyzer_test.bzl Outdated Show resolved Hide resolved
@hlopko
Copy link
Member Author

hlopko commented May 27, 2021

Sorta feels like there's two changes here? They seem good but curious as to what brought on the harness attribute.

Oops, there's another PR 😅

But yeah, was it necessary for this or just a nicety?

I pass a path to rust-project.json as a command line arg to the test.

  • libtest doesn't support custom arguments
  • It felt weird to have std::env::args() in a regular #[test].
  • The code was a tiny little bit longer using libtest.

Now that I'm forced to think about this more, I found alternatives:

  • pass the path to the rust-project.json through environment variable.
  • access the file through runfiles.

I'm inclined to pursue the runfiles alternative (but I think the harness PR still makes sense and can go in).

@google-cla
Copy link

google-cla bot commented May 27, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no and removed cla: yes labels May 27, 2021
@hlopko
Copy link
Member Author

hlopko commented May 27, 2021

@googlebot I fixed it.

@google-cla
Copy link

google-cla bot commented May 27, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

1 similar comment
@google-cla
Copy link

google-cla bot commented May 27, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: yes and removed cla: no labels May 27, 2021
@hlopko hlopko force-pushed the fix_rust_analyzer branch 2 times, most recently from 7127fe1 to da8b3ab Compare June 1, 2021 20:43
@hlopko hlopko requested a review from UebelAndre June 1, 2021 20:49
@hlopko
Copy link
Member Author

hlopko commented Jun 2, 2021

And finally we have a green CI. PTAL :)

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.

This looks good to me! a small nit and one question that's more of an aside 😅

test/unit/rust_analyzer/rust_analyzer_test.bzl Outdated Show resolved Hide resolved
test/unit/rust_analyzer/rust_analyzer_test.bzl Outdated Show resolved Hide resolved
@UebelAndre
Copy link
Collaborator

This looks good to me! Feel free to merge whenever you'd like 😄 and thanks!

@hlopko hlopko merged commit 087bcab into bazelbuild:main Jun 9, 2021
@hlopko hlopko deleted the fix_rust_analyzer branch June 9, 2021 10:02
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.

None yet

4 participants