Add Android native artifacts and CI coverage#150
Conversation
|
@bonede now binder and grammer fully compatible with android please merge i need this for my project
w
|
b790387 to
33fc91a
Compare
Add Android native library loading support, checked-in Android artifacts, all-grammar native CI coverage, source download retry handling, and third-party license notices for bundled native dependencies.
33fc91a to
e1ef550
Compare
|
Sorry, huge PR with AI generated content will not be merged. It's too much to review. |
Half of the file generated are regenerated binary |
Atleast check the pr which file change |
I mean good for you half of thing are regenerated binary never review single line then accuse other why use ai brother you use ai yourself stop moral policing about ai uses btw most of time i donot use ai anyway even if I do it doesnot matter it works |


Summary
This PR adds checked-in Android native artifacts for the core
tree-sitterlibrary and every grammar package, while keeping the existing desktop/native artifacts current for the previously refreshed modules.It also adjusts the Gradle build so regular tests consume the checked-in native libraries instead of rebuilding native code, while CI explicitly compiles native artifacts for every grammar project.
Finally, it adds explicit third-party license notices for the bundled OpenJDK 11 JNI headers, Gradle wrapper files, and Unicode
ConvertUTFsources.What changed
aarch64-linux-androidshared libraries for the coretree-sittermodule and every grammar module in this repository.NativeUtils:System.loadLibrary(...)on Android instead of extracting and loading the resource path manually.JNI_OnLoadfromJNI_VERSION_10toJNI_VERSION_1_6so the native library can load on Android runtimes that do not accept the newer JNI version.~/Library/Android/sdkwhen Android SDK environment variables are not set.ANDROID_NDK_HOME,ANDROID_NDK_ROOT,ANDROID_HOME, andANDROID_SDK_ROOT.tree-sitter-ocaml:buildNativeby pointing it at the OCaml grammar source layout undergrammars/ocaml/src.build.gradle:downloadSourceandbuildNativeonly for projects that definelibVersion.processResources/tests tobuildNative, so./gradlew testdoes not unexpectedly rebuild native artifacts../gradlew buildNativeso every grammar project's native task is compiled for each configured desktop target../gradlew buildNative -PtreeSitterTargets=aarch64-linux-androidin the Android job so Android native compilation also covers all grammar projects.THIRD_PARTY_NOTICES.mdLICENSEandADDITIONAL_LICENSE_INFOunderthird_party_licenses/openjdk-11third_party_licenses/gradlethird_party_licenses/apache-2.0third_party_licenses/unicodethird_party_licenses/zigthird_party_licenses/tree-sitter-corethird_party_licenses/tree-sitter-core/lib-src-unicodethird_party_licenses/grammars/<grammar-project>/LICENSEinclude/jnicarry OpenJDK GPLv2/classpath markers.tree-sitter/src/main/c/ConvertUTF.c,ConvertUTF.h, the relatedreadme.txt, and calls fromorg_treesitter_TSParser.c.Why
Android consumers need packaged native grammar libraries, but the desktop JVM loading path is not appropriate for Android. Android expects libraries to be loaded through the platform linker with
System.loadLibrary, and the JNI version returned byJNI_OnLoadmust be compatible with Android.The repository already vendors OpenJDK JNI headers, Gradle wrapper files, and Unicode conversion sources, so this PR also adds the corresponding license texts and a notice index.
Validation
./gradlew :tree-sitter-ocaml:buildNative -PtreeSitterTargets=aarch64-macos --stacktrace./gradlew buildNative -PtreeSitterTargets=aarch64-macos --stacktrace./gradlew :tree-sitter-ocaml:test --stacktrace./gradlew test --stacktracegit diff --checkrgfor OpenJDK GPL/classpath markers and Unicode native source usage