You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation of the API is published at [https://eclipse-zenoh.github.io/zenoh-java/index.html](https://eclipse-zenoh.github.io/zenoh-java/index.html).
29
29
@@ -33,60 +33,23 @@ Alternatively, you can build it locally as [explained below](#building-the-docum
These are 'nightly' packages that need to be imported as explained in the following sections of this README.
55
-
We plan to publish our packages into Maven central for the `1.0.0` stable release.
56
-
57
-
## <imgsrc="android-robot.png"alt="Android"height="50"> For Android applications
58
-
59
-
For this first version we have published a [Github package](https://github.com/eclipse-zenoh/zenoh-java/packages/2019754) with the library which can be imported on your projects.
60
-
61
-
Checkout the [Zenoh demo app](https://github.com/eclipse-zenoh/zenoh-demos/tree/main/zenoh-android/ZenohApp) for an example on how to use the library.
62
-
63
-
First add the Github packages repository to your `settings.gradle.kts`:
38
+
First add the Maven central repository to your `settings.gradle.kts`:
where the username and token are your github username and a personal access token you need to generate on github with package read permissions (see the [Github documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)).
84
-
This is required by Github in order to import the package, even if it's from a public repository.
85
-
86
49
After that add to the dependencies in the app's `build.gradle.kts`:
where the username and token are your github username and a personal access token you need to generate on github with package read permissions (see the [Github documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)).
139
-
This is required by Github in order to import the package, even if it's from a public repository.
140
-
141
90
After that add to the dependencies in the app's `build.gradle.kts`:
This will first, trigger the compilation of Zenoh-JNI in release (if you want debug, specify `-Prelease=false`), and second publish the library into maven local, containing the native library
131
+
This will first, trigger the compilation of Zenoh-JNI in release, and second publish the library into maven local, containing the native library
182
132
as a resource that will be loaded during runtime.
183
133
184
134
:warning: The native library will be compiled against the default rustup target on your machine, so although it may work fine
185
135
for you on your desktop, the generated publication may not be working on another computer with a different operating system and/or a different cpu architecture.
186
136
187
-
Once we have published the package, we should be able to find it under `~/.m2/repository/io/zenoh/zenoh-java-jvm/0.11.0`.
137
+
Once we have published the package, we should be able to find it under `~/.m2/repository/org/eclipse/zenoh/zenoh-java-jvm/1.1.1`.
188
138
189
-
Finally, in the `build.gradle.kts` file of the project where you intend to use this library, add mavenLocal to the list of repositories and add zenoh-java as a dependency:
139
+
Finally, in the gradle file of the project where you intend to use this library, add mavenLocal to the list of repositories and add zenoh-java as a dependency:
This will first trigger the compilation of the Zenoh-JNI for the previously mentioned targets, and secondly will
238
187
publish the library, containing the native binaries.
239
188
240
-
You should now be able to see the package under `~/.m2/repository/io/zenoh/zenoh-java-android/0.11.0`
241
-
with the following files:
189
+
You should now be able to see the package under `~/.m2/repository/org/eclipse/zenoh/zenoh-java-android/1.1.1`.
242
190
243
-
```raw
244
-
zenoh-java-android-0.11.0-sources.jar
245
-
zenoh-java-android-0.11.0.aar
246
-
zenoh-java-android-0.11.0.module
247
-
zenoh-java-android-0.11.0.pom
248
-
```
249
-
250
-
Now the library is published on maven local, let's now see how to import it into an Android project.
251
-
252
-
First, we need to indicate we want to look into mavenLocal for our library, so in your top level `build.gradle.kts` you need to specify
253
-
the `mavenLocal` repository:
191
+
Finally, in the gradle file of the project where you intend to use this library, add mavenLocal to the list of repositories and add zenoh-java-android as a dependency:
254
192
255
193
```kotlin
256
194
repositories {
257
195
mavenCentral()
258
-
...
259
-
mavenLocal() // We add this line
196
+
mavenLocal()
260
197
}
261
-
```
262
198
263
-
Then in your app's `build.gradle.kts` filen add the dependency:
And that was it! You can now import the code from the `io.zenoh` package and use it at your will.
277
-
278
211
## Building the documentation
279
212
280
213
Because it's a Kotlin project, we use [Dokka](https://kotlinlang.org/docs/dokka-introduction.html) to generate the documentation.
281
214
282
215
In order to build it, run:
283
216
284
217
```bash
285
-
gradle zenoh-java:dokkaHtml
218
+
gradle dokkaGenerate
286
219
```
287
220
288
221
## Running the tests
@@ -294,55 +227,66 @@ gradle jvmTest
294
227
```
295
228
296
229
This will compile the native library on debug mode (if not already available) and run the tests afterward against the JVM target.
297
-
Running the tests against the Android target (by using `gradle testDebugUnitTest`) is equivalent to running them against the JVM one, since they are common
298
-
tests executed locally as Unit tests.
299
230
300
231
## Logging
301
232
302
-
Rust logs are propagated when setting the property `zenoh.logger=debug` (using RUST_LOG=debug will result in nothing)
233
+
Rust logs are propagated when setting the `RUST_LOG` environment variable.
303
234
304
235
For instance running the ZPub test as follows:
305
236
306
237
```bash
307
-
gradle -Pzenoh.logger=debug ZPub
238
+
RUST_LOG=debug gradle ZPub
308
239
```
309
240
310
241
causes the logs to appear in standard output.
311
242
312
-
The log levels are the ones from Rust: `trace`, `info`, `debug`, `error` and `warn`.
243
+
The log levels are the ones from Rust, typically `trace`, `info`, `debug`, `error` and `warn` (though other log filtering options are available, see <https://docs.rs/env_logger/latest/env_logger/#enabling-logging>).
313
244
314
-
----
315
-
316
-
# Examples
245
+
Alternatively, the logs can be enabled programmatically through `Zenoh.initLogFromEnvOr(logfilter)`, for instance:
317
246
318
-
You can find some examples located under the [`/examples` folder](examples).
319
-
Once we've built the project, to run them, simply run `./gradlew <EXAMPLE_NAME>`.
247
+
```kotlin
248
+
Zenoh.initLogFromEnvOr("debug")
249
+
```
320
250
321
-
For instance in order to run the [ZPub](examples/src/main/java/io.zenoh/ZPub.java) example, type:
251
+
----
322
252
323
-
```bash
324
-
./gradlew ZPub
325
-
```
253
+
# Examples
326
254
327
-
You can find more info about these examples on the [examples README file](/examples/README.md).
255
+
You can find some examples located under the [`/examples` folder](examples). Checkout the [examples README file](/examples/README.md).
328
256
329
257
----
330
258
331
-
# :warning: Considerations & Future work
332
-
333
-
## Packaging
259
+
# Old packages
334
260
335
-
We intend to publish this code on Maven in the short term in order to ease the installation, but for the moment, until we
336
-
add some extra functionalities and test this library a bit further, we will only publish packages to Github packages.
261
+
Old released versions were published into Github packages.
337
262
338
-
## Potential API changes
263
+
In case you want to use one of the versions published into github packages, add the Github packages repository to your `settings.gradle.kts` as follows:
339
264
340
-
When using this library, keep in mind the api is not fully stable. Changes are to be expected, especially for version 1.0.0.
where the username and token are your github username and a personal access token you need to generate on github with package read permissions (see the [Github documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)).
284
+
This is required by Github in order to import the package, even if it's from a public repository.
343
285
344
-
The communication between the Kotlin code and the Rust code through the java native interface (JNI) has its toll on performance.
286
+
Then after that, add the dependency as usual:
345
287
346
-
Some preliminary performance evaluations done on an M2 Mac indicate around a 50% performance drop regarding the publication throughput
347
-
(compared to Rust-Rust communication), and for subscription throughput the performance is similar to that of zenoh-python, with around 500K messages per second
0 commit comments