Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ The release run heads these entries with the version and opens a fresh

- A pdf that nests parentheses inside a string opens, and keeps its document
metadata β€” `cairo` and `pdfTeX` write their `/Producer` that way.
- A jni build without a JDK fails instead of shipping a package missing
`odr-core-java.jar`. `ODR_JNI_JAR=OFF` is how the AAR build asks for the
native half alone.

## v6.9.0 - 2026-08-18

Expand Down
2 changes: 2 additions & 0 deletions android/build_native.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ def build(architecture: str, conan: str, build_profile: str, output: Path) -> No
# rather than shipped as a second .so the app would have to load
"-DBUILD_SHARED_LIBS=OFF",
"-DODR_JNI=ON",
# the AAR compiles `jni/java/` itself, so no jar and no JDK here
"-DODR_JNI_JAR=OFF",
"-DODR_CLI=OFF",
"-DODR_TEST=OFF",
"-DODR_WITH_HTTP_SERVER=ON"])
Expand Down
2 changes: 1 addition & 1 deletion jni/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package `app.opendocument.core`. Mirrors the surface of the python bindings

| Path | What |
|------|------|
| `CMakeLists.txt` | Builds `libodr_jni` + `odr-core-java.jar`; included from the root build via `ODR_JNI`, or standalone against an installed `odrcore`. |
| `CMakeLists.txt` | Builds `libodr_jni` + `odr-core-java.jar`; included from the root build via `ODR_JNI`, or standalone against an installed `odrcore`. `ODR_JNI_JAR=OFF` builds the native half alone β€” what `../android` does, and the only build needing no JDK. |
| `pom.xml` | Maven distribution of the Java classes only (`app.opendocument:odr-core-java`); published to Maven Central (the `central` profile) and GitHub Packages on release via `.github/workflows/maven.yml`. Keep `--release`/`-Xlint` in sync with `CMAKE_JAVA_COMPILE_FLAGS`. |
| `src/` | JNI sources, one `jni_*` unit per public-API area; `odr_jni.hpp` (strings, exceptions, handles) and `jni_convert.hpp` (struct/POJO marshalling) are the helpers. |
| `java/app/opendocument/core/` | Java API: enums, POJOs (styles, metas, `HtmlConfig`), and handle-backed wrappers extending `NativeResource`. Also compiled as-is into the AAR (`../android`) β€” which is kotlin, but this stays java: `add_jar` below has no kotlin toolchain. |
Expand Down
22 changes: 11 additions & 11 deletions jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ else ()
endif ()

# On android the NDK sysroot ships `jni.h` and the JNI symbols come from the
# runtime, so there is nothing to find or link against. A JDK stays optional
# there rather than unused: the android odrcore package ships
# `odr-core-java.jar` next to `libodr_jni.so` and OpenDocument.droid takes both
# out of it, while `android/` (the AAR) builds the native half alone, with the
# android toolchain compiling `java/` itself.
if (ANDROID)
find_package(Java 11 COMPONENTS Development)
else ()
find_package(Java 11 REQUIRED COMPONENTS Development)
# runtime, so there is nothing to find or link against.
if (NOT ANDROID)
find_package(JNI REQUIRED)
endif ()
if (Java_FOUND)

# Android is no reason to skip the jar β€” the android odrcore package ships it
# next to `libodr_jni.so` for OpenDocument.droid. Only the AAR build wants the
# native half alone, and asks for it, so a missing JDK fails rather than
# quietly shipping half a package.
option(ODR_JNI_JAR "Build the java half, `odr-core-java.jar`" ON)
if (ODR_JNI_JAR)
find_package(Java 11 REQUIRED COMPONENTS Development)
include(UseJava)
endif ()

Expand All @@ -56,7 +56,7 @@ endif ()

install(TARGETS odr_jni LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT jni)

if (NOT Java_FOUND)
if (NOT ODR_JNI_JAR)
return()
endif ()

Expand Down
6 changes: 6 additions & 0 deletions jni/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ This produces `build/jni/libodr_jni.dylib` (or `.so`) and
`build/jni/odr-core-java.jar`. `jni/CMakeLists.txt` can also be configured
standalone against an installed `odrcore` package.

`ODR_JNI_JAR=OFF` builds the native library alone. That is what the AAR build
(`android/build_native.py`) asks for, since it compiles `jni/java/` with the
android toolchain instead, and it is the only build needing no JDK β€” on android
the headers come from the NDK sysroot. Otherwise a missing JDK fails the
configure step rather than producing a package without the jar in it.

## Runtime data

There is none. The renderer's CSS/JS are part of the library and detection needs
Expand Down
Loading