Skip to content
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

[tree-sitter] add multiple ports #26272

Closed
wants to merge 9 commits into from

Conversation

kylo252
Copy link
Contributor

@kylo252 kylo252 commented Aug 10, 2022

Description

This PR aims to provide support for building tree-sitter parsers across platforms

  • add tree-sitter-common
    provides vcpkg_ts_parser_add helper functions for installing tree-sitter parsers
  • add tree-sitter-{bash,c,cpp,css,javascript,json,lua,python,rust,typescript,yaml}
Background about parsers
  • all of tree-sitter’s parsing functionality is exposed through C APIs
  • each parser is composed of at least one C file parser.c and sometimes a scanner.{c,cc}
  • parser files themselves do not include any external C/C++ dependencies
  • each parser has an ABI version to indicate compatibility with libtree-sitter
List of some popular consumers of tree-sitter parsers

github-actions[bot]
github-actions bot previously approved these changes Aug 10, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have modified or added at least one vcpkg.json where you should check the license field.

If you feel able to do so, please consider adding a "license" field to the following files:

  • ports/tree-sitter-common/vcpkg.json

Valid values for the license field can be found in the documentation

github-actions[bot]
github-actions bot previously approved these changes Aug 10, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have modified or added at least one vcpkg.json where you should check the license field.

If you feel able to do so, please consider adding a "license" field to the following files:

  • ports/tree-sitter-common/vcpkg.json

Valid values for the license field can be found in the documentation

@BillyONeal
Copy link
Member

BillyONeal commented Aug 10, 2022

How are these related to the port tree-sitter?

@kylo252
Copy link
Contributor Author

kylo252 commented Aug 10, 2022

How are these related to the port tree-sitter?

I think these will have two major use-cases

  • dynamically loaded (probably with manifest mode)
  • statically built alongside tree-sitter

My original plan was introducing these as features, but I decided that they needed dedicated ports instead of trying to lump them all in one. However, now I'm unsure if I should expose them through the main library or not. Note: it's useful that we'd be able to install parsers regardless!

I've also planned to build the tree-sitter-cli tool (used as a code-generator) internally, but it requires cargo and it turned out to be a lot of work, see #20619, so for now it's vendored through npm

https://github.com/microsoft/vcpkg/blob/002f3039c3df12b284e1fecfd5feaf110bb0d48e/ports/tree-sitter-common/vcpkg_ts_parser_add.cmake#L25-L43

@JackBoosY JackBoosY added the category:new-port The issue is requesting a new library to be added; consider making a PR! label Aug 11, 2022
@JackBoosY
Copy link
Contributor

so for now it's vendored through npm

Use npm to install the dependencies automaticly is a bad idea.
We should not limit the installation tools that users can use. Users should choose system-related dependencies to install them.
For example:

  • Ubuntu-apt
  • CentOS-yum
  • OSX-brew

@JackBoosY
Copy link
Contributor

If your project is too large, we should split it into several separate PRs.

@kylo252

This comment was marked as outdated.

@JackBoosY JackBoosY assigned Adela0814 and unassigned JackBoosY Oct 14, 2022
@Adela0814
Copy link
Contributor

Pinging @kylo252 for response. Is work still being done for this PR?

@kylo252
Copy link
Contributor Author

kylo252 commented Oct 14, 2022

Pinging @kylo252 for response. Is work still being done for this PR?

@Adela0814, this is already complete if we keep going with installing tree-sitter-cli with npm.

I've been hoping to be able to build it from source, but bootstrapping rust is the blocker, see #20619

An alternative would be to install tree-sitter-cli as a tool with npm, it would be its own portfile in that case, maybe we could go with that for now?

@Adela0814
Copy link
Contributor

An alternative would be to install tree-sitter-cli as a tool with npm, it would be its own portfile in that case, maybe we could go with that for now?

Yes, I think it's a good idea.

github-actions[bot]
github-actions bot previously approved these changes Oct 14, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have modified or added at least one vcpkg.json where you should check the license field.

If you feel able to do so, please consider adding a "license" field to the following files:

  • ports/tree-sitter-common/vcpkg.json

Valid values for the license field can be found in the documentation

github-actions[bot]
github-actions bot previously approved these changes Oct 14, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have modified or added at least one vcpkg.json where you should check the license field.

If you feel able to do so, please consider adding a "license" field to the following files:

  • ports/tree-sitter-common/vcpkg.json

Valid values for the license field can be found in the documentation

github-actions[bot]
github-actions bot previously approved these changes Oct 14, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have modified or added at least one vcpkg.json where you should check the license field.

If you feel able to do so, please consider adding a "license" field to the following files:

  • ports/tree-sitter-common/vcpkg.json

Valid values for the license field can be found in the documentation

github-actions[bot]
github-actions bot previously approved these changes Oct 14, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have modified or added at least one vcpkg.json where you should check the license field.

If you feel able to do so, please consider adding a "license" field to the following files:

  • ports/tree-sitter-common/vcpkg.json

Valid values for the license field can be found in the documentation

github-actions[bot]
github-actions bot previously approved these changes Oct 14, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have modified or added at least one vcpkg.json where you should check the license field.

If you feel able to do so, please consider adding a "license" field to the following files:

  • ports/tree-sitter-common/vcpkg.json

Valid values for the license field can be found in the documentation

@BillyONeal
Copy link
Member

(Of course you don't have to include the CMake output and stuff, I just included that to show that those 3 files together build something that works)

@kylo252 kylo252 dismissed stale reviews from Adela0814 and github-actions via 8037d79 October 25, 2022 15:35
github-actions[bot]
github-actions bot previously approved these changes Oct 25, 2022
github-actions[bot]
github-actions bot previously approved these changes Oct 28, 2022
github-actions[bot]
github-actions bot previously approved these changes Oct 28, 2022
* feat: add tree-sitter-common
    provides `vcpkg_ts_parser_add` helper functions for installing parsers

* feat: add tree-sitter-bash
* feat: add tree-sitter-c
* feat: add tree-sitter-cpp
* feat: add tree-sitter-css
* feat: add tree-sitter-javascript
* feat: add tree-sitter-json
* feat: add tree-sitter-lua
* feat: add tree-sitter-python
* feat: add tree-sitter-rust
* feat: add tree-sitter-typescript
* feat: add tree-sitter-yaml
github-actions[bot]
github-actions bot previously approved these changes Oct 28, 2022
@kylo252
Copy link
Contributor Author

kylo252 commented Oct 28, 2022

@BillyONeal, I've added a basic integration with pkg-config, along with usage instructions.

here's an example of how to use it: https://github.com/kylo252/tree-sitter-registry/tree/master/example

@Adela0814
Copy link
Contributor

Convert this PR to draft since there is no progress. Please ping us if this PR is ready for review again.

@Adela0814 Adela0814 marked this pull request as draft December 2, 2022 02:57
@Adela0814
Copy link
Contributor

Closing this PR since it seems that no progress is being made. Please ping us to reopen if work is still being done.

@Adela0814 Adela0814 closed this Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:new-port The issue is requesting a new library to be added; consider making a PR!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants