This implements changes to put native libs in ~/.pkl/editor-support/. When loading the parser, it first looks for libraries there, and if they don't exist, they get copied from bundled resources.
When building libraries, the os name and architecture get included in the resource path.
This enables starting the jar plainly without needing any extra argument (e.g. no need for CLI flag -Djava.library.path, and no need for the LD_LIBRARY_PATH env var), and eliminates the need to copy native libraries to the current working dir.
Note: java-tree-sitter doesn't provide any way to provide the library path. To get around this, I'm doing a pretty ugly hack to rewrite the TreeSitter.java source file to make it load the tree-sitter library from our custom dir.
This implements changes to put native libs in
~/.pkl/editor-support/
. When loading the parser, it first looks for libraries there, and if they don't exist, they get copied from bundled resources.When building libraries, the os name and architecture get included in the resource path.
This enables starting the jar plainly without needing any extra argument (e.g. no need for CLI flag
-Djava.library.path
, and no need for theLD_LIBRARY_PATH
env var), and eliminates the need to copy native libraries to the current working dir.Note: java-tree-sitter doesn't provide any way to provide the library path. To get around this, I'm doing a pretty ugly hack to rewrite the
TreeSitter.java
source file to make it load the tree-sitter library from our custom dir.