alex-pinkus / tree-sitter-swift

A tree-sitter grammar for the Swift programming language.
MIT License
137 stars 34 forks source link

Add build artifacts in repository #362

Closed juli1 closed 6 months ago

juli1 commented 6 months ago

Tree-sitter grammars generally includes the parser.c and the tree_sitter directory which includes the header files (see example with Python or JavaScript). This helps to integrate with other tools who integrates with tree-sitter. Without these files, it's hard to integrate this grammar with other tree-sitter based tools.

There are currently some explanation as to why there is no parser.c but downloading the parser.c and other build artifacts make people lose the versions and other attributes of a build. This makes it pretty hard to include this grammar in project that includes other tree-sitter grammar since it requires a special build while other grammars do not and all their parsers are being versioned.

alex-pinkus commented 6 months ago

Is there a particular tool you’re having trouble integrating this with?

juli1 commented 6 months ago

Thank you for replying so quick 🙏

We are developing a static analyzer that integrates with multiple grammars and our build system assume that the scanner.c or parser.c are always available in the repository. The build system checkout a version of the repository and build the parser.c and scanner.c for each language.

We did not had this issue before with tree-sitter-swift because we were using the rust bindings but it no longer works since we upgraded to the latest version of tree-sitter.

A workaround consists in putting the scanner.c and parser.c on a separate repository and it works. But I would rather use this repository, which is the source of truth. If this is not possible to do this and/or you prefer to keep it like it is today, I totally understand, I just wanted to raise the potential needs for some integration.

Thank you,

alex-pinkus commented 6 months ago

Got it, thank you for the context.

Are you aware that these artifacts are slated to be removed from many other repositories? The tree-sitter 1.0 checklist states:

Cleanup - Remove generated files from all the grammar repos in the tree-sitter org

What is your plan once that 1.0 action item happens?

There is actually a workaround already in place, so you don’t have to create your own repo, I just want to make sure you’re well-positioned for the long term before I tell you what it is.

juli1 commented 6 months ago

Thank you for your quick reply. I was not aware of this change for the 1.0 and in this case, it totally changes this ask. We should adapt to it rather than asking you to adapt.

Thank you for the pointer, we will then adapt and prepare accordingly! I am closing this issue since this is no longer relevant.