Skip to content

Zbobr fix 72 make zenoh kotlin depend on zenoh jni runtime#651

Merged
milyin merged 17 commits intoeclipse-zenoh:external-jnifrom
milyin-zenoh-zbobr:zbobr_fix-72-make-zenoh-kotlin-depend-on-zenoh-jni-runtime
Apr 19, 2026
Merged

Zbobr fix 72 make zenoh kotlin depend on zenoh jni runtime#651
milyin merged 17 commits intoeclipse-zenoh:external-jnifrom
milyin-zenoh-zbobr:zbobr_fix-72-make-zenoh-kotlin-depend-on-zenoh-jni-runtime

Conversation

@milyin
Copy link
Copy Markdown
Contributor

@milyin milyin commented Apr 19, 2026

The eclipse-zenoh/zenoh-java#466 introduces itnermediate library zenoh-jni-runtime which wraps the Rust binding and can be reused in higher-level zenoh-java and zenoh-kotlin APIs
This update makes zenoh-kotlin depend on thie zenoh-jni-runtime library.
For development the dependency is made through making zenoh-java git submodule in zenoh-kotlin. This submodule should be updated after merging the zenoh-java PR

milyin and others added 17 commits April 18, 2026 22:59
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t wiring

- Remove :zenoh-jni from settings.gradle.kts, add gated composite build
  for zenoh-java submodule
- Remove rust-android-gradle plugin from root build.gradle.kts
- Rewrite zenoh-kotlin/build.gradle.kts: add zenoh-jni-runtime dependency,
  add jvmAndAndroidMain source set, remove all Cargo/NDK task wiring

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Kotlin reflection (typeOf<T>()) is not available on Kotlin/Native or
Kotlin/JS. Moving these functions to jvmAndAndroidMain mirrors the
intentional design in zenoh-jni-runtime where JNIZBytesKotlin is also
in jvmAndAndroidMain.

Update call sites to use runtime's JNIZBytesKotlin instead of the
deleted local JNIZBytes adapter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…classes

Delete all JNI adapter files (except JNILiveliness.kt which will be
adapted to use runtime's public JNISession methods):
- All callbacks in jni/callbacks/
- JNISession, JNIPublisher, JNISubscriber, JNIQuerier, etc.
- JNIZBytes (replaced by runtime's JNIZBytesKotlin)

Delete duplicate classes that conflict with zenoh-jni-runtime:
- exceptions/ZError.kt (runtime provides io.zenoh.exceptions.ZError)
- jvmMain/Target.kt (runtime provides io.zenoh.Target)
- jvmMain/Zenoh.kt and androidMain/Zenoh.kt (actual ZenohLoad impls,
  runtime provides io.zenoh.ZenohLoad)
- commonMain/Zenoh.kt expect ZenohLoad declaration will be removed next

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t to runtime API

- Zenoh.kt: remove expect ZenohLoad declaration; adapt scout methods to use
  JNIScout.scout(Int, JNIScoutCallback, JNIOnCloseCallback, JNIConfig?)
- Config.kt: loadDefault/loadFromFile/loadFromJson/loadFromYaml replace old
  methods; wrap runtime calls in runCatching where needed
- KeyExpr.kt: tryFrom/autocanonize now return String from runtime, wrap in
  runCatching { KeyExpr(...) }; intersects/includes/relationTo/join/concat
  updated to pass JNIKeyExpr? primitives explicitly
- ZenohId.kt: toStringViaJNI → toString (runtime method)
- Logger.kt: replace private external fun with JNILogger.startLogs(filter)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All JNI functionality is now provided by zenoh-jni-runtime from the
zenoh-java submodule. The local Rust crate is no longer needed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The examples no longer need to build a local Rust JNI library since
zenoh-jni-runtime is now the JNI provider via Maven dependency.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- ci.yml: add submodules: recursive checkout, remove cargo fmt/clippy/build steps
- publish-jvm.yml: remove 6-platform cross-compilation matrix, simplify to
  single publish job that depends on zenoh-jni-runtime via Maven
- publish-android.yml: remove NDK setup, Rust cross-compilation for Android ABIs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix ntpValue property access to ntpValue() function call in Query.kt
- Reorder ReplyKeyExpr enum so MATCHING_QUERY=0, ANY=1 to match Rust mapping
- Fix Session.undeclare(KeyExpr) to null out jniKeyExpr after undeclaring
  and return failure when already undeclared (prevents double-free SIGABRT)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The zenoh-jni Rust crate was deleted; update the release automation script
to stop editing the now-nonexistent Cargo.toml and update README to reflect
that zenoh-kotlin now depends on zenoh-jni-runtime rather than building its
own native JNI library.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ion property

- Gate includeBuild("zenoh-java") behind zenoh.useLocalJniRuntime property so
  publication resolves against the published Maven artifact, not a local submodule build
- Add zenohJniRuntimeVersion in gradle.properties to independently track the
  zenoh-jni-runtime release version, decoupling it from zenoh-kotlin's own version.txt
- Remove submodule checkout and Rust toolchain from publish-jvm and publish-android
  workflows; publish path no longer needs them
- Pass -Pzenoh.useLocalJniRuntime=true in ci.yml test step so CI still builds against
  the local submodule, and remove now-unnecessary Rust toolchain install step

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Clarify that the default build/test path resolves zenoh-jni-runtime from
Maven and requires no Rust toolchain, while the opt-in local submodule
path (-Pzenoh.useLocalJniRuntime=true) builds from source and does require
one. Fixes the documentation to match the actual opt-in build wiring.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…or params

- Query now stores acceptReplies from the JNI callback instead of inferring from selector parameters
- resolveQueryable passes ReplyKeyExpr.entries[acceptReplies] to Query constructor
- Selector param parsing now uses getOrThrow() so malformed data surfaces as a failure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
zenoh-kotlin no longer contains any Rust crates (zenoh-jni/ directory
was removed as part of the migration to zenoh-jni-runtime). The
publish-github job that invoked publish-crates-github@main is now
obsolete and would fail at release time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update to latest common-jni commit with markdownlint fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@milyin milyin merged commit 55a5cda into eclipse-zenoh:external-jni Apr 19, 2026
4 of 7 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.

1 participant