|
1 | | -# polly-test |
| 1 | +# ISL Java Bindings (OSGi / Eclipse RCP) |
2 | 2 |
|
3 | | -This repository aims to enable ISL usage within an Eclipse RCP application. |
| 3 | +Java/JNI bindings intended to make ISL functionality available to Java applications, with a focus on **Eclipse/OSGi** distribution. |
4 | 4 |
|
5 | | -## Versioning and releases |
| 5 | +> Note: The current JNI implementation in this repository is a minimal implementation used to validate the build/tooling and the Java-facing API shape (e.g., it stores the set text and performs argument checks). It is not yet a full binding to the upstream ISL library. See `bundles/com.emmtrix.isl.jni/src/main/c/isl_jni.c`. |
6 | 6 |
|
7 | | -- Keep bundle `Bundle-Version`, feature `feature.xml`, and p2 `category.xml` versions aligned using the same SemVer base (e.g., `0.1.0`) plus the `.qualifier` suffix for OSGi artifacts. |
8 | | -- Tag releases with `vX.Y.Z` (for example, `v0.1.0`) to match the SemVer base used across bundles, features, and the p2 site. |
| 7 | +## Repository structure |
| 8 | + |
| 9 | +This is a multi-module Maven/Tycho build :contentReference[oaicite:1]{index=1}: |
| 10 | + |
| 11 | +- `bundles/com.emmtrix.isl.core` – Java API (core types) |
| 12 | +- `bundles/com.emmtrix.isl.jni` – JNI bundle (native entry points) |
| 13 | +- `bundles/com.emmtrix.isl.native.*` – platform-specific OSGi fragments shipping native code |
| 14 | + - `win32.x86_64`, `linux.x86_64`, `macosx.aarch64` :contentReference[oaicite:2]{index=2} |
| 15 | +- `features/com.emmtrix.isl.feature` – Eclipse feature |
| 16 | +- `releng/com.emmtrix.isl.site` – p2 update site project |
| 17 | +- `tests/*` – build-wiring tests |
| 18 | + |
| 19 | +The build targets **Java 11** :contentReference[oaicite:3]{index=3} and uses **Tycho** :contentReference[oaicite:4]{index=4}. |
| 20 | + |
| 21 | +## Java API (core) |
| 22 | + |
| 23 | +Entry point is `IslContext`. Contexts are **not thread-safe** and must be confined to a thread or externally synchronized :contentReference[oaicite:5]{index=5}. |
| 24 | + |
| 25 | +Native code is loaded on first use via `System.loadLibrary("isl_jni")` :contentReference[oaicite:6]{index=6}. |
| 26 | + |
| 27 | +Example: |
| 28 | + |
| 29 | +```java |
| 30 | +import com.emmtrix.isl.core.IslContext; |
| 31 | +import com.emmtrix.isl.core.IslSet; |
| 32 | + |
| 33 | +try (IslContext ctx = IslContext.create()) { |
| 34 | + try (IslSet set = ctx.readSet("{ [i] : 0 <= i < 10 }")) { |
| 35 | + // work with set |
| 36 | + } |
| 37 | +} |
| 38 | +```` |
| 39 | + |
| 40 | +Resource management: |
| 41 | + |
| 42 | +* Most native-backed objects implement `AutoCloseable` and release native resources in `close()` . |
| 43 | + |
| 44 | +## Native packaging (OSGi) |
| 45 | + |
| 46 | +Native code is shipped as **OSGi fragments** attached to `com.emmtrix.isl.jni`. Each fragment declares its platform-specific native library via `Bundle-NativeCode`, e.g.: |
| 47 | + |
| 48 | +* Linux x86_64: `native/linux/x86_64/libisl_wrapper.so` |
| 49 | +* Windows x86_64: `native/win32/x86_64/isl_wrapper.dll` |
| 50 | +* macOS aarch64: `native/macosx/aarch64/libisl_wrapper.dylib` |
| 51 | + |
| 52 | +## Building |
| 53 | + |
| 54 | +Prerequisites: |
| 55 | + |
| 56 | +* JDK 11 |
| 57 | +* Maven |
| 58 | + |
| 59 | +Build everything (including tests, feature, p2 repo): |
| 60 | + |
| 61 | +```bash |
| 62 | +mvn clean verify |
| 63 | +``` |
| 64 | + |
| 65 | +## Versioning and releases (OSGi + p2) |
| 66 | + |
| 67 | +Keep OSGi and p2 versions aligned: |
| 68 | + |
| 69 | +* Use the same SemVer base across bundles, feature, and p2 category, and append `.qualifier` for OSGi artifacts . |
| 70 | +* Tag releases as `vX.Y.Z` (e.g., `v0.1.0`) matching that SemVer base . |
| 71 | + |
| 72 | +## Development notes |
| 73 | + |
| 74 | +* The current JNI layer provides basic handle validation, lifetime tracking, and error mapping to Java exceptions (e.g., invalid arguments, native failures) implemented in `isl_jni.c` . |
| 75 | +* A small CMake-based native stub exists under `native/isl-wrapper` (builds a shared library named `isl_wrapper`) . |
| 76 | + |
| 77 | +## License |
| 78 | + |
| 79 | +TBD |
0 commit comments