Add extended_targets CMake hook for non-OSS JNI extensions#17947
Add extended_targets CMake hook for non-OSS JNI extensions#17947psiddh merged 2 commits intopytorch:mainfrom
Conversation
Add a generic hook in extension/android/CMakeLists.txt that conditionally includes extended_targets/CMakeLists.txt if it exists. This allows internal or partner-specific JNI extensions (e.g., Gemma3N) to plug into the Android JNI build without modifying OSS files. When extended_targets/CMakeLists.txt does not exist (as in OSS builds), the hook is a complete no-op.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17947
Note: Links to docs will display an error until the docs builds have been completed. ❌ 7 New Failures, 5 PendingAs of commit 73fbf55 with merge base e6f7d5e ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
Adds a small, optional CMake hook in the Android JNI extension build to allow internal/partner-specific JNI targets to be integrated via a separate extended_targets/CMakeLists.txt without modifying OSS files.
Changes:
- Conditionally includes
extension/android/extended_targets/CMakeLists.txtwhen present (no-op when absent).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Add a generic hook in
extension/android/CMakeLists.txtthat conditionally includesfb/extended_targets/CMakeLists.txtif it exists. This allows internal or partner-specific JNI extensions (e.g., Gemma3N) to plug into the Android JNI build without modifying OSS files.When
fb/extended_targets/CMakeLists.txtdoes not exist (as in OSS builds), the hook is a complete no-op.Motivation
PR #17942 added Gemma3N Android demo app support, but required modifying two OSS files (
extension/android/CMakeLists.txtandscripts/build_android_library.sh) with@oss-disablelines. This creates ongoing merge friction and scales poorly as more internal models are added.This PR introduces a one-time, stable hook so that:
fb/extended_targets/CMakeLists.txtwhich sets internal flagsfb/extended_targets/does not exist)Test plan
fb/extended_targets/directory does not exist, so theif(EXISTS ...)evaluates to false and is a no-op.CMakeLists.txtinextension/android/fb/extended_targets/to verify it gets included.