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
bash: use libtree-sitter-bash.so from system if available #367
Conversation
A few things I thought about
|
Codecov Report
@@ Coverage Diff @@
## master #367 +/- ##
=======================================
Coverage 95.50% 95.50%
=======================================
Files 54 54
Lines 7366 7368 +2
Branches 1785 1785
=======================================
+ Hits 7035 7037 +2
Misses 204 204
Partials 127 127
Continue to review full report at Codecov.
|
66aedcb
to
349e03e
Compare
Hey, there's even a bug for it: https://bugs.gentoo.org/834135 |
349e03e
to
4283e26
Compare
935ed6a
to
7cc545f
Compare
@arthurzam @radhermit any feedback on this? |
Document tree-sitter-bash as a dependency. |
Could you update the CI test matrix to test both building against system and bundled tree-sitter-bash? |
Sure. |
The language version (13) determines which versions of tree-sitter the grammar is compatible with. I don't think we need to worry about it too much because newer tree-sitter versions are backwards compatible with old grammars. I think the problem is if a new version renames or removes any node types because this would break pkgcheck's queries. Unsure on what upstream's policy for that is, but if you look at the commit history for the grammar it seems stable. |
OK, I won't worry about it then, thanks :-) |
@mgorny I started looking at this, but it turns out that it'll require fetching a snapshot of tree-sitter-bash, building and manually installing it to get it working as ubuntu doesn't package libtree-sitter-bash yet (only libtree-sitter-dev exists afaict). I can do it (I think), but it's gonna take a bit more work than I anticipated. |
5f9ecf0
to
8bcf5ee
Compare
objects=( parser.o scanner.o ) | ||
make CFLAGS="-I${PWD}" CXXFLAGS="-I${PWD}" "${objects[@]}" | ||
g++ -Wl,-O1 -Wl,--as-needed -shared parser.o scanner.o -Wl,--soname=libtree-sitter-bash.so.13 -o libtree-sitter-bash.so.13 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is heavily inspired by tree-sitter-grammar.eclass.
f566ca0
to
cf27177
Compare
c7b0757
to
ac7ab90
Compare
Prefer to load a shared library already installed for tree-sitter-bash. Tested on Gentoo by emerging dev-libs/tree-sitter-bash. Bug: https://bugs.gentoo.org/834135 Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
0faff44
to
ee28d80
Compare
If the environment variable USE_SYSTEM_TREE_SITTER_BASH is set then the bundled version is not build or installed.
The upstream version (0.19.0) that this is vendored from deleted this file. Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
ee28d80
to
2687cc8
Compare
I think this is as far as I'll take it for now. @mgorny has suggested that setup.py be replaced, maybe by flit, but I'd prefer to do that in another PR if that's OK. Just to summarize:
|
77b669b
to
fef7bc6
Compare
Also fail the build if the bundled tree-sitter-bash isn't built when it's supposed to.
fef7bc6
to
78a604a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. But let's wait some in case @radhermit has any comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @laumann
@laumann You can do that PR for 9999 now 😉 |
Prefer to load a shared library already installed for tree-sitter-bash.
Tested on Gentoo by emerging dev-libs/tree-sitter-bash.
Signed-off-by: Thomas Bracht Laumann Jespersen t@laumann.xyz