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

Rust Analyzer: Generate rust-project.json without explicit target list #1010

Merged
merged 18 commits into from
Nov 17, 2021

Conversation

UebelAndre
Copy link
Collaborator

@UebelAndre UebelAndre commented Nov 11, 2021

This is a follow up of #907 (special thanks to @djmarcin!!) but with some comments addressed and an integration test added.

This change increases the min supported Bazel version from 3.5.0 to 4.0.0 (this is a factor from the original PR).

@UebelAndre
Copy link
Collaborator Author

f1b887a should be a squashed commit of all changes in #907 for easier reviewing

@UebelAndre UebelAndre force-pushed the rust_analyzer branch 5 times, most recently from a47ecde to eaa3fe7 Compare November 11, 2021 17:00
@UebelAndre
Copy link
Collaborator Author

@hlopko Hey, I'd really love to get these changes in so we can continue to get more feedback on rust-analyzer. Having played around with it

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 for taking this over! By luck I see you're fixing one bug I was meaning to look into :P

rust/private/rust_analyzer.bzl Outdated Show resolved Hide resolved
rust/private/rust_analyzer.bzl Show resolved Hide resolved
rust/private/rust_analyzer.bzl Outdated Show resolved Hide resolved
rust/private/rust_analyzer.bzl Outdated Show resolved Hide resolved
rust/private/rust_analyzer.bzl Outdated Show resolved Hide resolved
rust/private/rust_analyzer.bzl Show resolved Hide resolved
tools/rust_analyzer/main.rs Outdated Show resolved Hide resolved
tools/rust_analyzer/rust_project.rs Show resolved Hide resolved
tools/rust_analyzer/rust_project.rs Show resolved Hide resolved
@UebelAndre
Copy link
Collaborator Author

@hlopko for context on my involvement here. I've been interested in these changes for a while and saw there was no activity on the original PR. I spent a few late nights to test the changes out and to write some integration tests, which to my understanding were the biggest missing component to the last PR. I agree with some of the changes you're proposing but since my experience with this code is mostly as a user, some of the proposals are not quick changes for me. Are these things that can be done post-merge, given that the rust-analzyer rules are still experimental? Or what would be the core changes required to get this merged? Not trying to skip the review process here but don't want these changes to continue to be blocked behind our increasingly limited availability.

@UebelAndre
Copy link
Collaborator Author

That said, I can vouch for these changes in my workspaces and they're awesome. Even enabled it for rules_rust and it was night and day in the developer experience

@UebelAndre
Copy link
Collaborator Author

@djmarcin would you be able to speak to some of the comments left by @hlopko?

Copy link
Contributor

@djmarcin djmarcin left a comment

Choose a reason for hiding this comment

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

Thanks so much for picking this up @UebelAndre, let me know if you need any assistance finalizing this PR.

rust/private/rust_analyzer.bzl Outdated Show resolved Hide resolved
tools/rust_analyzer/main.rs Outdated Show resolved Hide resolved
tools/rust_analyzer/rust_project.rs Show resolved Hide resolved
@UebelAndre
Copy link
Collaborator Author

@djmarcin I'm hoping to get these changes in ASAP so more folks can use them and updates become more targeted. If any of @hlopko's feedback would be a quick thing for you, I'd hugely appreciate it if you were able to make those changes 🙏 😅.

djmarcin and others added 2 commits November 15, 2021 16:53
Use bazel-like space separated target specification
@purkhusid
Copy link

Super pumped about trying this out, good work!

test/rust_analyzer/rust_analyzer_test_runner.sh Outdated Show resolved Hide resolved
echo "Testing..."
bazel test //...
echo "Building with Aspects..."
bazel build //... --config=strict
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need the build, test, and build --config=strict?

Copy link
Contributor

@djmarcin djmarcin Nov 17, 2021

Choose a reason for hiding this comment

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

Oh I think I see -- it copies in the WORKSPACE and BUILD.bazel files and then the test //... ends up running the rust-analyzer manual tests because the manual tag gets stripped out.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct!


pushd "${workspace}" &> /dev/null
echo "Generating rust-project.json..."
bazel run "@rules_rust//tools/rust_analyzer:gen_rust_project"
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to just validate that gen_rust_project runs at all and doesn't validate the output, is that correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The test targets the selves consume a rust-project.json which should be doing that validation. Otherwise what are the tests testing?

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!

@UebelAndre UebelAndre merged commit 8c05ac7 into bazelbuild:main Nov 17, 2021
@UebelAndre UebelAndre deleted the rust_analyzer branch November 17, 2021 20:50
ddeville pushed a commit to ddeville/rules_rust that referenced this pull request Nov 22, 2021
bazelbuild#1010)

* Emit rust_analyzer_crate_spec files for all workspace crates

* Regenerated cargo-raze outputs

* Address PR feedback

* Increase Bazel min test version

* Addressed PR feedback

* Make sysroot_src a data dependency

* Fix runfiles path specifier

* Use bazel-like space separated target specification

* Fix out-of-date comment

* Addressed PR feedback

* Added additional testing

* Added test comment

Co-authored-by: David Marcin <david@metawork.com>
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