Commit 5ed3616
authored
Add extended_targets CMake hook for non-OSS JNI extensions (#17947)
## Summary
Add a generic hook in `extension/android/CMakeLists.txt` that
conditionally includes `fb/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 `fb/extended_targets/CMakeLists.txt` does 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.txt` and
`scripts/build_android_library.sh`) with `@oss-disable` lines. This
creates ongoing merge friction and scales poorly as more internal models
are added.
This PR introduces a one-time, stable hook so that:
| Build System | How it Works | Result |
| :--- | :--- | :--- |
| **Internal Buck CI** | Uses TARGETS files directly | No change needed
|
| **Internal CMake/Gradle** | Hook includes
`fb/extended_targets/CMakeLists.txt` which sets internal flags | Works |
| **OSS CMake/Gradle** | Hook is a no-op (`fb/extended_targets/` does
not exist) | Works |
## Test plan
- OSS builds: No behavior change. The `fb/extended_targets/` directory
does not exist, so the `if(EXISTS ...)` evaluates to false and is a
no-op.
- Internal builds: Place a `CMakeLists.txt` in
`extension/android/fb/extended_targets/` to verify it gets included.1 parent eb77ed4 commit 5ed3616
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
229 | 235 | | |
230 | 236 | | |
231 | 237 | | |
| |||
0 commit comments