-
Notifications
You must be signed in to change notification settings - Fork 63
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
Consider replacing javaparser gRPC/subprocess with tree-sitter #318
Comments
This would make it significantly easier to compile the rules_jvm gazelle language into custom Using tree-sitter via go-tree-sitter has been pretty simple in the gazelle extensions I've done, and I think other gazelle extensions are using tree-sitter as well. Compilation is essentially just a fetch of the language definition and a few lines of go. Then you can use the I would definitely recommend it 👍 |
@stevebarrau I think you were pretty excited about this idea - any thoughts/context/experiments/desire? If anyone's looking at picking this up, https://github.com/bazel-contrib/rules_jvm/blob/main/java/test/com/github/bazel_contrib/contrib_rules_jvm/javaparser/generators/ClasspathParserTest.java has a pretty thorough set of tests for what we currently parse out with Java code (which is currently only doing AST parsing of single files, nothing fancy like using a classpath, so should be relatively easy for any parser to do), and you should be able to test our a new implementation by replacing this line with a call to a Go implementation. |
Yeah we started with javaparser because we weren't sure how much we'd need to parse, and figured that was likely to be more accurate than a tree-sitter implementation. But if it passes the test suite it would be a nice improvement to have, I don't think anyone was a fan of the "gRPC → Java" bit. |
Just FYI since I'm closing the tab, I started reading through some of the logic here ![]() This process is facilitated by gen AI which does a decent job of getting to a 75% working query. |
@stevebarrau any chance you'd like to put in some effort here? Aspect is happy to help as well since we'd like to be able to statically link this into our CLI. Here's a proposed sequencing:
|
It's unlikely that @stevebarrau or myself will have time for this in the immediate future, but we'll happily review and land PRs. |
rules_python made this change in bazelbuild/rules_python#1895
because tree-sitter is crazy fast, and it also relieves the need for the gazelle Go binary to spawn subprocesses that require other language runtimes, instead it's statically linked.
I'm seeing an issue just trying to run the tests in a clean clone of this repo:
which I think is because it's not hermetic in locating a JRE to execute this.
The Java/gRPC dependency also makes this repo a lot more complicated than it needs to be.
The text was updated successfully, but these errors were encountered: