Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

How are the languages published to maven central? #20

Closed
AntonPieper opened this issue Jun 15, 2023 · 2 comments
Closed

How are the languages published to maven central? #20

AntonPieper opened this issue Jun 15, 2023 · 2 comments

Comments

@AntonPieper
Copy link

More generally, how can I add another Tree-sitter grammar? Specifically I want to use GLSL. I see that you have forks of tree-sitter-java and the like, but there does not seem to be the source of the maven module. So how can I add my own grammar? Ideally without using maven

@itsaky
Copy link
Member

itsaky commented Jun 15, 2023

The Gradle modules for the grammars are almost identical (just some minor differences in CMakeLists and the Java binding class). Therefore,

The generated modules are located in rootDir/grammar-modules directory.

To add a new grammar :

  1. Add the grammar source to the grammars directory. You can add a submodule with the following command :
git submodule add <remote_url> grammars/<language_name>
  1. The language_name must be the simple name of the language (i.e without the tree-sitter- prefix). This name is used to generate the shared library and the Gradle module. For example, if the language_name is abc :
    • Module tree-sitter-abc will be generated.
    • The name of the generated shared library will be libtree-sitter-abc.so.
  2. Update the grammars.json file to include the newly added grammar.
  3. Sync the project to generate the module for the grammar.

Also, make sure you read the prerequisites for building the project.

@itsaky
Copy link
Member

itsaky commented Jun 18, 2023

The README has been updated to include information about using/loading external grammars i.e. grammars that are not published to Maven Central along with this project.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants