feat(bindings): add Java bindings#4681
Conversation
07ed427 to
f7a90b7
Compare
9aad3eb to
d20e44f
Compare
Maven CentralPros
Cons
JitPackPros
Cons
|
|
I'd like some user opinions regarding the packaging. /cc @stackoverflow @bioball @Emmeral @maloewe-ona |
|
So if I understand this correctly, the actual binaries will not be uploaded to the remote repository but only the bindings class and the user of the bindings needs to supply the binaries themself? |
I don't have a specific opinion on the Maven Central vs JitPack topic. For my use case, I would need to modify the pom in both cases. |
d20e44f to
882f6cf
Compare
|
The cons of Maven Central seem significantly worse to me than those for JitPack. |
|
Perhaps, but something like this is not possible in JitPack:
|
|
I'm leaning towards Maven Central after all since it allows us to fully control the release process. |
882f6cf to
b615968
Compare
|
Just to clarify:
Does this mean that individual grammar / parser authors need to setup and maintain these bits over the long term then? |
|
They also need (if they want) to set up and maintain tokens for npmjs, pypi, and crates. The only extra here is the GPG key. |
|
I wonder about the practicality of this kind of arrangement over the longer term. It seems to me that many a grammar / parser author has lost interest after a certain point. In a nicer world, may be there would be two or more folks looking after a given grammar / parser for robustness (though OFC that's a larger attack surface as well...). I've been ok with looking after a few grammars, but I have no interest in setting up and properly looking after additional accounts and/or tokens (and thereby becoming a slightly more juicier target). Perhaps this is a minority position though. |
|
Although, now that I think about it, those can also be installed directly from git. |
amaanq
left a comment
There was a problem hiding this comment.
Looks fine to me, I don't know Java but I assume this has been tested with a grammar locally and works.
cada7b3 to
129b25b
Compare
WillLillis
left a comment
There was a problem hiding this comment.
Assuming local tests are working on your end, let's give this a spin.
There was a problem hiding this comment.
Missing documentation under https://tree-sitter.github.io/tree-sitter/cli/init.html#the-bindings-field
(which is also missing the Zig bindings!)
(and shouldn't list the Kotlin bindings until they're actually available)
I believe the Java bindings are now stable enough to include (opt-in) in 0.26.
The parser namespace (by default
io.github.tree-sitter) is converted toio.github.treesitter.jtreesitter.parsernamefor the package name and
main/java/io/github/treesitter/jtreesitter/parsernamefor the directory.The

pom.xmlincludes the necessary configuration to publish packages to Maven Central.However, the user must have a Sonatype account and a GPG key and add 4 secrets to the workflow…
Alternatively, we can publish to JitPack which doesn't require any secrets or workflows.
Instead, it needs a
jitpack.ymlfile and the namespace must start withcom.github.Also, end users must add its repository to their build files alongside Maven Central.