Skip to content

Add automatic Android NDK provisioning#147

Merged
bonede merged 1 commit into
bonede:mainfrom
subham8907:beta/android-ndk-bootstrap
May 1, 2026
Merged

Add automatic Android NDK provisioning#147
bonede merged 1 commit into
bonede:mainfrom
subham8907:beta/android-ndk-bootstrap

Conversation

@subham8907

Copy link
Copy Markdown
Contributor

@bonede This PR makes Android native builds bootstrap the Android NDK automatically when no local NDK is configured.

What changed

  • Add a downloadAndroidNdk Gradle task that downloads the configured Android NDK version into build/android-ndk.
  • Make buildNative depend on that task when treeSitterTargets includes Android.
  • Keep support for existing ANDROID_NDK_HOME, ANDROID_NDK_ROOT, ANDROID_HOME, and ANDROID_SDK_ROOT setups.
  • Add Windows host compiler-name handling and document the Android build behavior.

Why

Android native builds currently fail on machines without a preconfigured NDK. This keeps installed NDKs working while allowing a fresh checkout to provision the required toolchain through Gradle.

Validation

  • ./gradlew tasks --all --dry-run
  • ./gradlew :tree-sitter:buildNative --dry-run
  • ./gradlew :tree-sitter:build -PtreeSitterTargets=x86_64-macos
  • ./gradlew :buildSrc:test
  • Confirmed the configured Android NDK archive URL returns HTTP 200.

@subham8907

Copy link
Copy Markdown
Contributor Author

@bonede This is the final PR for the Android NDK auto-provisioning change. It keeps existing local NDK setups working and adds a Gradle-managed fallback for fresh checkouts.

@bonede
bonede merged commit 52f2d14 into bonede:main May 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants