File tree Expand file tree Collapse file tree 6 files changed +50
-12
lines changed Expand file tree Collapse file tree 6 files changed +50
-12
lines changed Original file line number Diff line number Diff line change @@ -19,3 +19,9 @@ max_line_length = off
1919[* .{xml,yml,json} ]
2020indent_size = 2
2121max_line_length = off
22+
23+ [* .ps1 ]
24+ end_of_line = crlf
25+
26+ [* .patch ]
27+ trim_trailing_whitespace = false
Original file line number Diff line number Diff line change 1+ * text =auto eol =lf
2+
3+ scripts /jextract.ps1 eol =crlf
Original file line number Diff line number Diff line change 8989 <arg value =" ${project.basedir}" />
9090 <arg value =" ${project.build.directory}" />
9191 </exec >
92+ <exec executable =" git" dir =" ${project.build.directory}" failonerror =" true" >
93+ <arg value =" apply" />
94+ <arg value =" --no-index" />
95+ <arg value =" ${project.basedir}/scripts/TreeSitter_java.patch" />
96+ </exec >
9297 </target >
9398 </configuration >
9499 </execution >
Original file line number Diff line number Diff line change 1+ --- a/generated-sources/jextract/io/github/treesitter/jtreesitter/internal/TreeSitter.java
2+ +++ b/generated-sources/jextract/io/github/treesitter/jtreesitter/internal/TreeSitter.java
3+ @@ -55,9 +55,16 @@ public class TreeSitter {
4+ };
5+ }
6+
7+ - static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.libraryLookup(System.mapLibraryName("tree-sitter"), LIBRARY_ARENA)
8+ - .or(SymbolLookup.loaderLookup())
9+ - .or(Linker.nativeLinker().defaultLookup());
10+ + static final SymbolLookup SYMBOL_LOOKUP = findLibrary().or(Linker.nativeLinker().defaultLookup());
11+ +
12+ + private static final SymbolLookup findLibrary() {
13+ + try {
14+ + String library = System.mapLibraryName("tree-sitter");
15+ + return SymbolLookup.libraryLookup(library, LIBRARY_ARENA);
16+ + } catch (IllegalArgumentException e) {
17+ + return SymbolLookup.loaderLookup();
18+ + }
19+ + }
20+
21+ public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN;
22+ public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE;
Original file line number Diff line number Diff line change 1- # !/usr/bin/env pwsh
2-
3- $env: package = ' io.github.treesitter.jtreesitter.internal '
1+ $package = ' io.github.treesitter.jtreesitter.internal '
2+ $output = " $ ( $args [ 1 ] ) /generated-sources/jextract "
3+ $lib = " $ ( $args [ 0 ] ) /core/lib "
44
55& jextract.bat `
66 -- include- struct TSInput `
@@ -177,10 +177,10 @@ $env:package = 'io.github.treesitter.jtreesitter.internal'
177177 -- include- constant TSSymbolTypeRegular `
178178 -- include- constant TSSymbolTypeSupertype `
179179 -- header- class- name TreeSitter `
180- -- output " $ ( $args [ 1 ] ) /generated-sources/jextract " `
181- - t $env: package `
180+ -- output $output `
181+ - t $package `
182182 - l tree- sitter `
183- - I " $ ( $args [ 0 ] ) /core/ lib/src" `
184- - I " $ ( $args [ 0 ] ) /core/ lib/include" `
183+ - I " $lib /src" `
184+ - I " $lib /include" `
185185 - DTREE_SITTER_HIDE_SYMBOLS `
186- " $ ( $args [ 0 ] ) /core/ lib/include/tree_sitter/api.h"
186+ " $lib /include/tree_sitter/api.h"
Original file line number Diff line number Diff line change 11#! /bin/bash -eu
22
33package=io.github.treesitter.jtreesitter.internal
4+ output=" $2 /generated-sources/jextract"
5+ lib=" $1 /core/lib"
46
57exec jextract \
68 --include-struct TSInput \
@@ -178,10 +180,10 @@ exec jextract \
178180 --include-constant TSSymbolTypeRegular \
179181 --include-constant TSSymbolTypeSupertype \
180182 --header-class-name TreeSitter \
181- --output " $2 " /generated-sources/jextract \
183+ --output " $output " \
182184 -t " $package " \
183185 -l tree-sitter \
184- -I " $1 " /core/ lib/src \
185- -I " $1 " /core/ lib/include \
186+ -I " $lib /src" \
187+ -I " $lib /include" \
186188 -DTREE_SITTER_HIDE_SYMBOLS \
187- " $1 " /core/ lib/include/tree_sitter/api.h
189+ " $lib /include/tree_sitter/api.h"
You can’t perform that action at this time.
0 commit comments