-
Notifications
You must be signed in to change notification settings - Fork 265
[extractors] Add an extractor for rust-project.json #6168
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks John, and sorry about the delay. Easter and then I got sick...
My main high-level comments are:
- aggregating transitive sets of source dirs into a data structure, far away from where it's used, seems unnecessary (and I think gets exclude dirs wrong)
- I think passing the input
rust-project.json
through unmodified for every CU is a bit magic/risky, and would rather we synthesized one per CU that (explicitly) drops unused crates and (implicitly) drops unknown fields
Otherwise the approach looks sound to me, and I'll try it out with some existing projects.
(I haven't tried yet as I'm pretty sure e.g. the absence of implicit include
of the root_module
dir means things will not work with the rust-project.json generators I've been using)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I've addressed all your comments, but I've also broken the indexing pipeline somehow: my kzips look correct but the decorations service returns no decorations for expected source files.
I'll continue to dig into that on Monday. It's likely some misconfiguration on my end.
os.Exit(1) | ||
} | ||
|
||
project_json_digest, err := kzip_writer.AddFile(bytes.NewReader(buf.Bytes())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually thought you wanted the entire rust-project.json in each CU! So that's good to know.
I've added synthesizeProjectJson
which creates a custom rust-project.json for each CU. Please let me know if you see issues with it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! LG with a few comments - most of these are minor/style and optional, up to you how to resolve.
let's do one more pass & then I'll merge
Thanks! All comments resolved, I'm going to make sure the pipeline works before we merge. |
17932df
to
d88554e
Compare
I've confirmed that I've got decorations back for my Fuchsia pipeline. It turned out to be three separate bugs. If you're happy, let's merge! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ship it!
/gcbrun |
/gcbrun |
Many projects using Rust with complicated build systems use rust-project.json to tell rust-analyzer about their source files. We can transform rust-project.json into a .kzip pretty trivially, without needing build system integration. This is simpler than integrating an extractor into every possible build system which large Rust projects use. Add an extractor called rust_project_to_kzip which takes in a rust-project.json and outputs a .kzip. This kzip will have one CompilationUnit per Rust crate, and each CompilationUnit will include a copy of rust-project.json for the Kythe Rust indexer. This extractor doesn't yet extract non-.rs files or the stdlib. Test: added unit tests Fixes kythe#6167
/gcbpush |
/gcbrun |
Many projects using Rust with complicated build systems use rust-project.json to tell rust-analyzer about their source files. We can transform rust-project.json into a .kzip pretty trivially, without needing build system integration. This is simpler than integrating an extractor into every possible build system which large Rust projects use.
Add an extractor called rust_project_to_kzip which takes in a rust-project.json and outputs a .kzip. This kzip will have one CompilationUnit per Rust crate, and each CompilationUnit will include a copy of rust-project.json for the Kythe Rust indexer.
This extractor doesn't yet extract non-.rs files or the stdlib.
Test: added unit tests
Fixes #6167