Skip to content

provide zenoh wrapper library common for zenoh-java and zenoh-kotlin#465

Merged
milyin merged 46 commits intoeclipse-zenoh:common-jnifrom
milyin-zenoh-zbobr:zbobr_fix-68-adjust-zenoh-java-functionality-to-zenoh-kotlin
Apr 17, 2026
Merged

provide zenoh wrapper library common for zenoh-java and zenoh-kotlin#465
milyin merged 46 commits intoeclipse-zenoh:common-jnifrom
milyin-zenoh-zbobr:zbobr_fix-68-adjust-zenoh-java-functionality-to-zenoh-kotlin

Conversation

@milyin
Copy link
Copy Markdown
Contributor

@milyin milyin commented Apr 17, 2026

No description provided.

milyin and others added 30 commits April 14, 2026 15:32
- Fix zenoh-ext Cargo.toml to include "unstable" feature (required for AdvancedPublisher/AdvancedSubscriber)
- Add owned_object.rs: safe Arc accessor to prevent early drops
- Add sample_callback.rs: SetJniSampleCallback trait for JNI callback wiring
- Add ext/ module with JNI exports for AdvancedPublisher, AdvancedSubscriber, MatchingListener, SampleMissListener
- Add openSessionViaJNI instance-method variant for zenoh-kotlin compatibility
- Add prepare_publisher_builder and prepare_subscriber_builder helpers
- Add declareAdvancedPublisherViaJNI and declareAdvancedSubscriberViaJNI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Update zenoh and zenoh-ext versions from 1.8.0 to 1.9.0
- Align zenoh-ext features with main branch (only 'internal')
- Update version.txt to 1.9.0
- Merge Cargo.lock changes from main

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The ext module requires unstable features from zenoh-ext. The merge
removed this feature but the ext module still uses it, causing compilation
errors. Also reordered module declarations to group feature-gated modules
together per cargo fmt output.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…kotlin

Add @JvmStatic to openSessionViaJNI in JNISession companion object so
Kotlin emits Java_io_zenoh_jni_JNISession_openSessionViaJNI (outer-class
form) instead of the $Companion-suffixed variant.

Remove the now-redundant Java_io_zenoh_jni_JNISession_00024Companion_openSessionViaJNI
from session.rs, leaving the single canonical JNI binding that both
zenoh-java and zenoh-kotlin share.

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

- Create zenoh-jni-runtime Gradle subproject with public primitive-only JNI adapters
- Move JNI adapter classes (JNIConfig, JNIKeyExpr, JNISession, JNIPublisher, JNIQuery,
  JNIQuerier, JNIScout, JNILiveliness, JNISubscriber, JNIQueryable, JNILivelinessToken,
  JNIZenohId) from zenoh-java to zenoh-jni-runtime with public visibility and primitive APIs
- Add new JNIAdvancedPublisher, JNIAdvancedSubscriber, JNIMatchingListener, JNISampleMissListener
- Add new callback interfaces including JNIMatchingListenerCallback and JNISampleMissListenerCallback
- Add public ZenohLoad expect/actual objects in zenoh-jni-runtime (jvm and android)
- Add public Target enum in zenoh-jni-runtime jvmMain
- Update zenoh-java/build.gradle.kts: depend on zenoh-jni-runtime, remove duplicate native build
- Update Session.kt to inline callback assembly using runtime JNI adapters
- Update Publisher.kt, Query.kt, Querier.kt, Liveliness.kt, Zenoh.kt to use primitive APIs
- Fix Rust bug in session.rs: remove spurious let binding in declareAdvancedSubscriberViaJNI

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Ensure native library is loaded before calling startLogsViaJNI
by touching ZenohLoad in Logger.start(). This makes Logger robust
against direct internal calls that might bypass the usual Zenoh.kt
initialization path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ZError was defined in both zenoh-jni-runtime and zenoh-java under the
same FQCN (io.zenoh.exceptions.ZError). This caused duplicate-class
packaging failures on JVM/Android when both artifacts were on the
classpath.

Fix: delete zenoh-java's copy so zenoh-jni-runtime is the single owner,
and change the runtime dependency from implementation() to api() so that
ZError (used in @throws across zenoh-java's public API) is properly
re-exported to consumers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
zenoh-jni-runtime is the single owner of Android Rust/JNI packaging.
Remove the rust-android-gradle plugin, configureCargo() call, and
mergeDebugJniLibFolders/mergeReleaseJniLibFolders task hooks from
zenoh-java/build.gradle.kts so there is no duplication.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread zenoh-jni-runtime/src/jvmMain/kotlin/io/zenoh/ZenohLoad.kt Outdated
Comment thread zenoh-jni-runtime/src/jvmMain/kotlin/io/zenoh/ZenohLoad.kt Outdated
Comment thread zenoh-jni-runtime/src/jvmMain/kotlin/io/zenoh/ZenohLoad.kt
Comment thread zenoh-jni-runtime/src/jvmMain/kotlin/io/zenoh/ZenohLoad.kt
Comment thread zenoh-jni-runtime/src/jvmMain/kotlin/io/zenoh/ZenohLoad.kt
Comment thread zenoh-jni-runtime/src/jvmMain/kotlin/io/zenoh/ZenohLoad.kt
Comment thread zenoh-jni-runtime/src/jvmMain/kotlin/io/zenoh/ZenohLoad.kt
Comment thread zenoh-jni-runtime/src/jvmMain/kotlin/io/zenoh/ZenohLoad.kt Outdated
Comment thread zenoh-jni-runtime/src/jvmMain/kotlin/io/zenoh/ZenohLoad.kt Outdated
milyin added 2 commits April 17, 2026 20:54
…otlin' of github.com:milyin-zenoh-zbobr/zenoh-java into zbobr_fix-68-adjust-zenoh-java-functionality-to-zenoh-kotlin
@milyin milyin changed the base branch from main to common-jni April 17, 2026 19:08
@milyin milyin merged commit 9c4ed85 into eclipse-zenoh:common-jni Apr 17, 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